Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor corrections to text

...

  • The use of both SIGTERM and SIGKILL signals on Unix servers has the following advantages:
    • The use of SIGTERM before SIGKILL means that there is a greater chance of data being saved after the signal has been issued.

    • The SIGTERM signal can - in contrast with SIGKILL - be monitored, i.e. a pre-/postprocessing Script can be carried out. This means that the ending of a task by the JobScheduler can be reacted to and the user process itself can be ended.

    • The implementation of SIGTERM allows post-processing methods such as spooler_process_after() to complete within the timeout period.
  • The time allowed between the SIGTERM and the SIGKILL signal can be specified in the command using the timeout attribute (the default is 15 sec): <kill_task … timeout=".."/>

  • This feature can also be applied for:
    • remote processes, i.e. processes started by SSH and those started by an Agent,
    • child processes started by a process running on an agent (JS-1468).

Implementation

JobScheduler Master

...

The following operations can be carried out from the JobScheduler Operating Center interface (JOC) or by use of the command line:

...

The JobScheduler Universal Agent comes with two scripts - for Windows and for Unix systems - that allow parent and child tasks on the Agent to be killed.

The scripts are:

  • jobscheduler_agent_kill_task.cmd and
  • jobscheduler_agent_kill_task.sh

They are to be found  the ./bin folder of the JUA installation.

The appropriate script is called with the parameter -kill-agent-task-id=...  and

  • finds the process containing that id
  • kills the process including all children

...

  • Should job scripts not be able to catch signals by traps then you can use a monitor script, i.e. a postprocessing post-processing script, that would be called by JobScheduler on receipt of a SIGTERM signal (JS-1463). For example:

    Code Block
    languagexml
    titleWorkaround for shell jobs with a timeout
    <job name="shell_with_javascript_monitor">
        <script  language="shell">
            <![CDATA[
    echo hello world!
    sleep 45
            ]]>
        </script>
    
        <monitor  name="process0" ordering="0">
            <script  language="java:javascript">
                <![CDATA[
    function spooler_process_before(){
    	return true;
    }
                ]]>
            </script>
        </monitor>
    
        <run_time />
    </job>

...