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 job nodes, i.e. TaskA1,TaskA2,TaskA3
- JobChainA contains 1 job node, i.e. Submit_End_Event, which will send an EVENT notification to JobScheduler that job has finished.
- JobChainB also contains 3 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 DEP_EVENTS.zip - job configuration files into the ./confi/live 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 JOC for the Workload JobScheduler in your browser using http://joc_host:joc_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 the database once JobChainB successfully completed processing.
How it works
The DEP_EVENTS/JobChainA/JobChainA/Submit_End_Event job is a 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
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
- DEP_EVENTS.zip - job configuration files