...
The Job Chain, Jobs and Orders
The
...
Parent Order
The Parent Order, in this example, with ID main_order has the following configuration
- The left branch is used by an Order (main_order) that proceeds over the Join Job and Job B to the end of the Job Chain (state: success).
- The right hand branch is used by an Order (main_order_add-order) that starts at Job A and ends at the Join Job.
To run the example, start the main_order Order.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?xml version="1.0" encoding="ISO-8859-1"?> <job_chain title="Y Join"> <job_chain_node state="100" job="generate_orders" next_state="wait" error_state="error"/> <job_chain_node state="150" job="job_a" next_state="join" error_state="error" delay="10"/> <job_chain_node state="wait" job="wait" next_state="join" error_state="error"/> <job_chain_node state="join" job="join" next_state="200" error_state="error"/> <job_chain_node state="200" job="job_b" next_state="success" error_state="error"/> <job_chain_node state="success"/> <job_chain_node state="error"/> </job_chain> |
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?xml version="1.0" encoding="ISO-8859-1"?> <job order="yes" stop_on_error="no"> <script language="java:javascript"> <![CDATA[ function spooler_process(){ // merge parameters from task and order var params = spooler_task.params; params.merge( spooler_task.order.params ); // set variable var generate_orders = params.value( 'generate_orders' ); var jobChain = spooler.job_chain('/test/join/y_join/y_join'); // log parameter spooler_log.info( 'generate_orders = ' + generate_orders); // generate orders for (i=0;i<generate_orders;i++){ var order = spooler.create_order(); order.id = spooler_task.order.id + "_" + i; order.params.merge(spooler_task.order.params); order.end_state="join"; order.state="150"; jobChain.add_order(order); } return true; } ]]> </script> <run_time /> </job> |
The test Order starts the first Job (job_create_ordersgenerate) in the joby_chain_test join Job Chain:
- this Job contains a script that generates the orders the Child Orders (see line XX of the listing) for the branch of the Job Chain from the job_nix Job to the join Job.
...
As the end_state for the generated Orders is the join Job state, these orders will be registered by the join job and counted towards to the value set by the job_create_orders shell script in the for loop (10... parameter (12)
The Orders
The Main Order
...