Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The functions for terminating task processes by for the JobScheduler Master and Universal Agent have been extended to allow the use of both SIGTERM and SIGKILL signals on Unix servers:
    • SIGTERM is sent first and allows an orderly termination of task processes to take place within a limited period of time.
    • If the time allowed has been exceeded and the processes are still running then SIGKILL will be sent.
  • The information contained in this article draws together detailed information contained in a range of issues and should primarily be of interest to persons in engineering and to a lesser extent persons in operating functions.

Feature History

This feature has been implemented stepwise between releases 1.9.0 and 1.10.0 (see the table of issues below for more detailed information).

Display feature availability
StartingFromRelease1.9

Related Issues

Support of this feature is subject to the following issues:features:

  • Jira
    serverSOS JIRA
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJS-1495
  • Jira
    serverSOS JIRA
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJS-1468
  • Jira
    serverSOS JIRA
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJS-1463
  • Jira
    serverSOS JIRA
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution

...

  • serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJS-1421
  • Jira
    serverSOS JIRA
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJS-1420
  • Jira
    serverSOS JIRA
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJS-1382
  • Jira
    serverSOS JIRA
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJS-1307
  • Jira
    serverSOS JIRA
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJS-1163
  • Jira
    serverSOS JIRA
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution

...

  • serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJOC-10

Use Case

Users who schedule programs and scripts that are aware of SIGTERM signals can implement clean-up procedures on receipt of the signal. Clean-up includes e.g. removal of temporary files, disconnect from a database and similar tasks.

  • 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-/ post-processing 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 SIGKILL signals 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 (
      Jira
      serverSOS JIRA
      columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
      serverId6dc67751-9d67-34cd-985b-194a8cdc9602
      keyJS-1468
      ).

Implementation

JobScheduler Master

...

  1. Operation: kill immediately
    • JOC sends <kill_task immediately="yes"/>
    • The process is killed immediately using the SIGKILL signal.
  2. Operation: terminate with timeout
    • JOC sends <kill_task immediately="yes" timeout="15"/>
    • The process receives a SIGTERM signal. Should that process not terminate within the specified timeout period then it will be killed with a SIGKILL signal.
  3. Operation: terminate
    • JOC sends <kill_task immediately="yes" timeout="never"/>
    • The process receives a SIGTERM signal. Monitoring of the process termination as described in Operation 2 above is not carried out.

See also

  • Jira
    serverSOS JIRA
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJOC-10

JobScheduler Universal Agent (JUA)

The JobScheduler Universal Agent comes with two scripts - for Windows and for Unix systems - that allow uses a script to monitor and kill 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 script is to be found  the ./bin folder of the JUA installation.

The -kill-script option can be  used to specify a different kill script if necessary. See the Command Line Options section in JobScheduler Universal Agent - Installation & Operation for more information.

See also

  • Jira
    serverSOS JIRA
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJS-1468
  • Jira
    serverSOS JIRA
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJS-1495

JS-1468 & JS-1495 for more detailed information about the implementation.

...

  • This feature has been fully implemented for the Universal Agent and for the Classic JobScheduler Agents (
    Jira
    serverSOS JIRA
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
    serverId6dc67751-9d67-34cd-985b-194a8cdc9602
    keyJS-1420
    ).

Implementation Summary

The implementation of the different termination operations available for the JobScheduler Master and Universal Agent is summarized in the table below.

The links lead to the issues relevant to the implementation of the feature.

The termination operations available are:

...

key(tick)

JS-1420

6dc67751-9d67-34cd-985b-194a8cdc9602

JS-1421

key

JS-1468

JS-1468

JS-1463

6dc67751-9d67-34cd-985b-194a8cdc9602

JS-1463

JS-1468

JS-1468

key

JS-1382

JS-1468

JS-1382

 Windows
Standalone
Linux
Standalone
Windows
Classic Agent
Linux
Classic Agent
Windows
Universal Agent
Linux
Universal Agent
Shell job      
Terminatenot supported(tick)not supported

(error)

Jira
serverJIRA Extern
serverId6dc67751-9d67-34cd-985b-194a8cdc9602
not supported(tick)
Kill(tick)(tick)(tick)

(tick)

Jira
serverJIRA Extern
serverIdkey

(tick)

Jira
serverJIRA Extern
serverId6dc67751-9d67-34cd-985b-194a8cdc9602

(tick)

Jira
serverJIRA Extern
serverId6dc67751-9d67-34cd-985b-194a8cdc9602
key
Timeout

(tick)jira

serverJIRA Extern
serverId6dc67751-9d67-34cd-985b-194a8cdc9602
key

(tick)

Jira
serverJIRA Extern
serverIdkey(tick)(tick) 

(tick)jira

serverJIRA Extern
serverId6dc67751-9d67-34cd-985b-194a8cdc9602
key
Shell job with monitor      
Terminatenot supported(tick)not supported(tick)not supported

(tick)

(error)

Jira
serverJIRA Extern
serverId6dc67751-9d67-34cd-985b-194a8cdc9602
key
Kill(tick)(tick)(tick)(tick)

(tick)

Jira
serverJIRA Extern
serverId6dc67751-9d67-34cd-985b-194a8cdc9602

(tick)

(error)

Jira
serverJIRA Extern
serverId6dc67751-9d67-34cd-985b-194a8cdc9602
key
Timeout(tick)(tick)   

(tick)

(error)

Jira
serverJIRA Extern
serverId6dc67751-9d67-34cd-985b-194a8cdc9602
key
API job      
Terminatenot supported(tick)not supported(tick)not supported(tick)
Kill(tick)(tick)(tick)(tick)(tick)(tick)
Timeout(tick)(tick)    

Task Termination in JOC

The following screenshot shows how a task can be terminated using the Task menu in JOC's Task pane. This pane is shown in the Jobs tab when the task is running and the task can be terminated either with timeout or immediately.

Image Added

Examples

Using a SIGTERM trap to show the difference between the kill and terminate commands

...

Code Block
languagexml
<?xml version="1.0" encoding="ISO-8859-1"?>
<job  title="test test">
    <script  language="shell">
        <![CDATA[
trap 'echo sigterm will be ignored' 15
for i in 1 2 3 4 5 6 7 8 9 0
do
date
sleep 10
done
sleep 60
        ]]>
    </script>

    <run_time />
</job>

Change Management References

Jira
serverSOS JIRA
columnstype,key,issuelinks,fixversions,status,priority,summary,updated
maximumIssues20
jqlQuerylabels in (terminate-tasks)
serverId6dc67751-9d67-34cd-985b-194a8cdc9602

References

...