Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Conversion corrections

Table of Contents
outlinh1. true
outlinh1. true
1printablefalse
2stylh1. none
3indent20px

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
languagejavascript

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

...

Image Modified

...

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
    languagejavascript

...

  • 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 file RemoteSchedulerOrder,ServerGroup.order.xml:

    Code Block
    languagehtml/xml

...

  •  <params>
              <param name="scheduler.remote_scheduler" value="HOST_1:PORT_1,HOST_2:PORT_2" />
     </params>
    

Download the example

...