Class JobProcessManagerImpl

  • All Implemented Interfaces:
    JobProcessManager

    public class JobProcessManagerImpl
    extends java.lang.Object
    implements JobProcessManager
    Configures and launches a job sub-process using metadata passed through ExecutionContext.
    Since:
    4.0.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void kill​(KillService.KillSource source)
      Terminate job process execution (if still running) or prevent it from launching (if not launched yet).
      void launchProcess​(java.io.File jobDirectory, java.io.File jobScript, boolean interactive, java.lang.Integer timeout, boolean launchInJobDirectory)
      Launch the job process (unless launch was aborted by previous a kill call).
      JobProcessResult waitFor()
      Wait indefinitely for the job process to terminate.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JobProcessManagerImpl

        public JobProcessManagerImpl​(org.springframework.scheduling.TaskScheduler taskScheduler,
                                     BraveTracingComponents tracingComponents)
        Constructor.
        Parameters:
        taskScheduler - The TaskScheduler instance to use to run scheduled asynchronous tasks
        tracingComponents - The BraveTracingComponents instance to use for propagating trace information
    • Method Detail

      • launchProcess

        public void launchProcess​(java.io.File jobDirectory,
                                  java.io.File jobScript,
                                  boolean interactive,
                                  @Nullable
                                  java.lang.Integer timeout,
                                  boolean launchInJobDirectory)
                           throws JobLaunchException
        Launch the job process (unless launch was aborted by previous a kill call).
        Specified by:
        launchProcess in interface JobProcessManager
        Parameters:
        jobDirectory - Job directory
        jobScript - job script (a.k.a. run file)
        interactive - launch in interactive mode (inherit I/O) or batch (no input, write outputs to files)
        timeout - The optional number of seconds this job is allowed to run before the system will kill it
        launchInJobDirectory - launch the job process from the job directory rather than the current directory
        Throws:
        JobLaunchException - if the job process failed to launch
      • kill

        public void kill​(KillService.KillSource source)
        Terminate job process execution (if still running) or prevent it from launching (if not launched yet). Optionally sends SIGINT to the process (unnecessary under certain circumstances. For example, CTRL-C in a terminal session, is already received by the job process, issuing a second one is unneeded).
        Specified by:
        kill in interface JobProcessManager
        Parameters:
        source - The KillService.KillSource value representing where this kill request is coming from
      • waitFor

        public JobProcessResult waitFor()
                                 throws java.lang.InterruptedException
        Wait indefinitely for the job process to terminate.
        Specified by:
        waitFor in interface JobProcessManager
        Returns:
        KILLED, SUCCESSFUL, or FAILED
        Throws:
        java.lang.InterruptedException - if the calling thread is interrupted while waiting