Events
Question: How can I create inter dependencies between JobChains?
Introduction
My JobChainA starts at morning 08:00 AM and should finish processing within 2 hours.
My JobChainB starts at morning 10:15 AM , but JobChainB can only be started when JobChainA is 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 nodes i.e. TaskA1,TaskA2,TaskA3
- JobChainA contains 1 job node i.e. Submit_End_Event, which will send a EVENT notification to JobScheduler that job has finished.
- JobChainB also contains 3 Task nodes i.e. TaskB1,TaskB2,TaskB3
- JobChainB contains 1 job node i.e. Check_End_Event, which will check if required EVENT notification is present in the JobScheduler DB.
- JobChainB will wait for JobChainA to finish successfully.
Requirements
- The JobScheduler must run using a database.
- Events are stored permanently in the table "SCHEDULER_EVENTS".
- The JobScheduler must be installed with the Event-Service (JobChain sos/
[[File:Sos-event-service.png]]
Instructions
- Unzip all files of test_event.zip into the ./config folder of your active instance of the 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 for the workload JobScheduler in your browser using http://scheduler_host:scheduler_port
- Find the
DEP_EVENTS/JobChainB/JobChainB
job chain and click on it. - There is an order assigned to the JobChainB. In the order menu press Start order now
- You see the order will 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.
- Find the
DEP_EVENTS/JobChainA/JobChainA
job chain and click on it. - There is an order assigned to the JobChainA. In the order menu press Start 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 DB once JobChainB successfully completed processing.
How it works
The DEP_EVENTS/JobChainA/JobChainA/Submit_End_Event
job is a JobScheduler job to Check if required event is exits in JobScheduler DB.
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 a xml object you have to specify a 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 DEP_EVENTS/JobChainB/JobChainB/Remove_End_Event
RemoveEvents step node will only be executed if all the successor job node are executed succesfully. If JobChainB needs to be restarted due to error ,the prerequisite event will be present there This step executes the DEP_EVENTS/JobChainB/JobChainB/Remove_End_Event
job to delete 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.
The last
Downloads:
- scheduler events - Documentation
- test_event.zip - job configuration files