Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Events
Question: How can I create inter dependencies between JobChains?
...
Introduction to events
- My JobChainA starts morning at
...
- 08:00 AM and should finish processing within 2 hours.
- My JobChainB starts morning at
...
- 10:15 AM, but JobChainB can only be started when JobChainA
...
- has successfully ended processing.
JobScheduler provides a solution to set off events and to handle these events on an active instance of the event service JobScheduler. However, it is also possible to check for events in job chains and then conditionally proceed.
You find the complete documentation in scheduler_events.pdf - Documentation. In particular, how to define event handlers with JOE is described in chapter XML Event Handlers (However this should not be needed for the actual example here.)
To demonstrate how to create an event and wait for it in a job chain we will draw up a simple scenario:
- JobChainA contains 3 Task job nodes, i.e. TaskA1,TaskA2,TaskA3
- JobChainA contains 1 job node, i.e. Submit_End_Event, which will send a an EVENT notification to JobScheduler that job has finished.
- JobChainB also contains 3 Task job nodes i.e. TaskB1,TaskB2,TaskB3
- JobChainB contains 1 job node i.e. Check_End_Event, which will check if the required EVENT notification is present in the JobScheduler database and contains 1 job node i.e. Remove_End_Event which will remove the
- events from JobScheduler database.
- JobChainB will wait for JobChainA to complete successfully.
Requirements
- The JobScheduler must run using a database.
- Events are stored permanently in the
...
- reporting database table REPORTING_CUSTOM_EVENTS
...
- .
- The JobScheduler must be installed with the Event
...
- Service (
...
- job Chain sos
...
/events/scheduler_event_service
)
Instructions
- Unzip all files of testDEP_eventEVENTS.zip - job configuration files into the ./confi/config live folder of your active instance of the event service Event Service JobScheduler installation. After unzipping you will have all the objects needed to run the example in the live/DEP_EVENTS subfolder.
- Open the JS operations gui JOC for the workload Workload JobScheduler in your browser using using http://schedulerjoc_host:schedulerjoc_port
- Find the DEP_EVENTS/JobChainAJobChainB/JobChainAJobChainB job chain and click on it.
- There is an order assigned to the job chainJobChainB. In the order menu press Start order now
- You see the order will run until the step 3 is reached. As the EVENT start, but since the JobChainA is not yet started, thus JOB_CHAINA_END event does not exist, the order will wait for 10s and then check again.Switch to the tab Jobs.
- Find the {{test_event/job_event_add }} DEP_EVENTS/JobChainA/JobChainA job chain and click on it.
- There is an order assigned to the JobChainA. In the Job order menu press Start task immediately. This will create the EVENT event.
- Switch to the tab Job Chains. See the order proceeding with execution of the next step
- order now
- JobChainA will start and after successful completion will submit JOB_CHAINA_END event to the JobScheduler.
- JobChainB node CheckEvent is checking periodically, as soon as it finds the matching event, JobChainB will also start processing.
- JobChainB has a node RemoveEvent to remove the event from the database once JobChainB successfully completed processing.
How it works
The test_event/job_event_add
DEP_EVENTS/JobChainA/JobChainA/Submit_End_Event job is a dummy shell script job with a post processing part. In the post processing the com.sos.jitl.eventing.EventMonitorTaskAfter
JITL class is used to add an TEST.TEST_EVENT event.
...
JobScheduler job to check if the required event exists in the JobScheduler database.
- The job DEP_EVENTS/JobChainB/JobChainB/Check_End_Event in JobChainB will wait for the event
...
- . This step executes the
...
- DEP_EVENTS/JobChainB/JobChainB/Check_End_Event job to look for the desired event specified in the scheduler_event_spec parameter. As the events are stored in
...
- an XML object you have to specify
...
- an XPath expression here.
- If the event is not raised, the order executes a setback. The wait time between two checks is configured in the delay_order_after_setback definition of the job (and the job chain node).
- After adding the event, the order will proceed with the next step and the event will be removed.
- The
...
example:
Code Block |
---|
class_a.event_1:99 and not (class_b.event2 or class_b.event3)
if the event_1 in class class_a exists with exit_code=99 and event2 and event3 from class_b do not exist, this expression evaluates to true.
|
You also can specify how to handle the existing or not existing of events with the paramters handle_existing_ah1. "error|success" or handle_not_existing_as"error|success"
example
...
-
DEP_EVENTS/JobChainB/JobChainB/Remove_End_Event
RemoveEvents step node will only be executed if all the successor job node is executed successfully. If JobChainB needs to be restarted due to an error, then the prerequisite event will be present there This step executes the DEP_EVENTS/JobChainB/JobChainB/Remove_End_Event job to delete the desired event. - If the event is not raised, the order executes a setback. The wait time between two checks is configured in the delay_order_after_setback definition of the job (and the job chain node).
- After adding the event, the order will proceed with the next step and the event will be removed.
JOC Cockpit Events GUI
Starting from release 1.12.0, the JOC Cockpit has a central Events view to view, add or delete the events. See JOC Cockpit - Resources Events section for more information
Related Downloads
...
- scheduler events - Documentation
- testDEP_eventEVENTS.zip - job configuration files