Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Introduction
The following example is a more complex version of dynamic setting of remote JobSchedulers. It is just an extension of the basic principle, that is described in:
...
Code Block | ||
---|---|---|
| ||
function spooler_process() \{ var remote_scheduler_list = String(spooler_task.order.params.value("remote_scheduler_list")); var parameters = spooler_task.order.params; if( parameters.count > 0 ) \{ spooler_log.info( "Parameters given" ); \} else \{ spooler_log.info( " no Parameters given" ); \} spooler_log.info( " remote_scheduler_list : " + remote_scheduler_list ); var valuePart = remote_scheduler_list.split(","); spooler_log.info(" valuePart.length :" + valuePart.length) for ( var i = 0; i < valuePart.length; i++) \{ spooler_log.info( " valuePart : " + valuePart[i]); var order = spooler.create_order(); var variable_set = spooler.create_variable_set(); variable_set.set_var("scheduler.remote_scheduler", valuePart[i]); spooler_log.info(variable_set); order.params = variable_set; var order_secs = 10 * i; spooler_log.info( " order_secs : " + order_secs); order.at = "now+10"; spooler.job_chain( "MY_JOB_CHAIN").add_order( order ); \} return true; \} |
The Job Chain
This is a simple JobChain just using the Job defined above.
...
These objects can be seen in the following screenshot from JOE:{{DiagramBox | BoxTitlh1.
Remote Scheduler Parameter List
...
...
Configuring the example in your environment
There are just two things that you should configure to make this example run in your environment:
- The Job:
In the last line "MY_JOB_CHAIN" is the name of the Job Chain you want to send the orders to (in the main JobScheduler).Code Block language javascript
...
for ( var i = 0; i < valuePart.length; i++)
...
{ spooler_log.info( " valuePart : " + valuePart[i]);
...
var order = spooler.create_order();
...
var variable_set = spooler.create_variable_set();
...
variable_set.set_var("scheduler.remote_scheduler", valuePart[i]);
...
spooler_log.info(variable_set); order.params = variable_set; var order_secs = 10 * i; spooler_log.info( " order_secs : " + order_secs); order.at = "now+10"; spooler.job_chain( "MY_JOB_CHAIN").add_order( order );
...
}
The Order Parameter:
Configure your own hosts and ports for your environment. You can configure this in JOE. Alternatively, the list of hosts and ports can be edited in the XML fileRemoteSchedulerOrder,ServerGroup.order.xml
:Code Block language html/xml
...
<params> <param name="scheduler.remote_scheduler" value="HOST_1:PORT_1,HOST_2:PORT_2" /> </params>
Download the example
...