...
This example configures a job chain which is made up of three other job chains.
- The check_day job
...
- is positioned at the start of the middle job chain and is used to test if the skip condition is met.
- If the condition is met then the order state for the middle job chain will be changed as required.
- In the example, the "main" job in the middle job chain is skipped on certain days.
Downloads
- meta_chains_skip.zip - configuration files
...
Instructions
- Unzip all files into the ./config/live folder of your JobScheduler installation.
- Open the JobScheduler Operating Center, JOC, in your browser using http://scheduler_host:scheduler_port
- Open the JOB CHAINS tab and enable "Show orders".
- Find the job chain
samples/meta_chains_skip/big_chain
. - Click on that chain. In the right window you will see that this job chain consists of 3 other chains: chain_a, chain_b and chain_c and that whilst all three job chains have a common job,
readparam
, chain_b has an additional job,check_day
. - On the left side click on
samples/meta_chains_skip/chain_a
- Find the order
my_order
and press "Start order now" in the Order menu.
...
Click on samples/meta_chains_skip/chain_b
and enable show_order_history on the right side and view the log of the order that just passed through the chain. If it's not the 12th day of the month you should see that the order has moved through both jobs check_day
and read_param
.
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="ISO-8859-1"?>
<job order="yes" stop_on_error="no">
<script language="javax.script:ecmascript">
<![CDATA[
function spooler_process(){
var today = new Date();
var day_of_month = today.getDate();
if (day_of_month == 12){
spooler_log.info("Today is the 12th - skipping job chain b");
spooler_task.order().set_state("end_of_chain_b");
}
return true;
}
]]>
</script>
<run_time />
</job> |
- Edit
./config/live/samples/meta_chains_skip/check_day.job.xml
, either with a code editor or with JOE - JobScheduler Object Editor - Change
day_of_month == 12
to check for the current day and save
Once JobScheduler has noticed the change in the configuration file, it will update the job definition. This may take up to one minute on non-Windows machines and may be accelerated by enabling "incl. hot folders" and pressing update on the web interface.
- Start the order again as described above
- Check the new log in the history of
samples/meta_chains_skip/chain_b
to see that the order has skipped the rest of the chain.
How it works:
By setting The change to the order state field of the order carried out by the set_state() causes JobScheduler to go to the end state of the current (in this case, the middle) job chain, JobScheduler is forced to skip . JobScheduler skips the jobs in between and to ignore ignores the return value of the job and the next_state
and error_state
configuration of the job chain node.
<?xml version="1.0" encoding="ISO-8859-1"?>
<job order="yes" stop_on_error="no">
<script language="javax.script:ecmascript">
<![CDATA[
function spooler_process(){
var today = new Date();
var day_of_month = today.getDate();
if (day_of_month == 12){
spooler_log.info("Today is the 12th - skipping job chain b");
spooler_task.order().set_state("end_of_chain_b");
}
return true;
}
]]>
</script>
<run_time />
</job>