Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

Scope

Process Classes for use with JobScheduler Agents

  • We assume that we have a job in a job chain

...

  • to be executed on a JobScheduler Agent.
  • This requires a process_class that is assigned to the job.
  • Please read

...

Process Class configuration

Now we assume that we have use multiple JobScheduler Agents and we want that a job executes the job to be executed on different JobScheduler Agents depending on parameters.

...

...

  • Create

...

  • a

...

  • process

...

  • class

...

  • (e.g.

...

  • with

...

  • the

...

  • name

...

  • _agents_)

...

  • in

...

  • JOE

...

  • with

...

  • empty

...

  • values

...

  • for

...

  • host

...

  • and

...

  • port

...

  • .

...

  • The

...

  • values

...

  • for

...

  • host

...

  • and

...

  • port

...

  • are

...

  • set

...

  • dynamically.

...

  • This should result in the following configuration file ./config/live/agents.process_class.xml

...

  • :

...

  • Code Block
    languagehtml/xml

...

  •  <?xml version="1.0" encoding="ISO-8859-1"?>
     

...

  •  <process_class max_processes="30"/>  
    
  • Assign the process class to the

    order

    job in JOE. In this example the job

    is named shell_on_dynamic_agent

    has the name shellOnDynamicAgent and calls hostname as a shell command.

    noformat

    So

    you

    get

    should see the

    following

    content in the configuration

    file

    _

    ./config/live/

    shell_on_dynamic_agent

    shellOnDynamicAgent.job.xml

    _

    :

    Code Block
    languagehtml/xml
    
     <?xml version="1.0" encoding="ISO-8859-1"?>
     
     <job process_class="agents" order="yes" stop_on_error="no">
         <script language="shell">
             <![CDATA[
     #! /bin/sh
     # returns the hostname of the agent
     hostname
             ]]>
         </script>
         <run_time/>
     </job>  
    

Job configuration

  • Extends

    Create the following job

    with a preprocessing.
    No Format
    
     The [JobScheduler API|http://www.sos-berlin.com/doc/en/scheduler.doc/api/api.xml] is used to set the _remote_scheduler_ attribute of the process class to provide that the job is executed on a JobScheduler Agent.
     The preprocessing script requires the two order parameters _agent_host_ and _agent_port_.
     Here the preprocessing is implemented in javascript and has the following code:
    

    , e.g. setAgent, and add it to the job chain as the forerunner of the JobScheduler Agent job.

    This job modifies the process_class setting of the successor job in the job chain according to the order parameters agent_host_ and _agent_port:

    After you have added the postprocessing you get the following configuration file _
    Code Block
    languagehtml/xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <job  order="yes" stop_on_error="no">
        <params />
    
        <script  language="java:javascript"><![CDATA[
    		function spooler_process() {
    
    			var curOrder
    Code Block
    languagejavascript
    
     function spooler_task_before()\{
    	var agentHost = spooler_task.order;
    			var agentHost = curOrder.params.value('agent_host');
    			var agentPort = spooler_task.ordercurOrder.params.value('agent_port');
    			var nextJob = curOrder.job_chain_node.next_node.job;
    
    			spooler_log.info("The agentParams agentHost:agentPort = " + agentHost + ":" + agentPort + " will be used.");
    	spooler_jobagentPort);
    			spooler_log.info("before: "+nextJob.process_class.remote_scheduler);
    
    	        nextJob.process_class.remote_scheduler = agentHost+":"+agentPort;
     \}  
    
    No Format
    			spooler_log.info("after: "+nextJob.process_class.remote_scheduler);
    			return true;
    		}
        ]]></script>
    
        <run_time />
    </job>

Job chain configuration

  • Add these jobs to a job chain, e.g. jobChainWithAgentJob:

    Image Added

    This will result in the job chain configuration file ./config/live/

    shell_on_dynamic_agent

    jobChainWithAgentJob.job_chain.xml

    _

    :

    Code Block
    languagehtml/xml
    
     <?xml version="1.0" encoding="ISO-8859-1"?>
     
    <job_chain <job processorders_classrecoverable="agentsyes" ordervisible="yes">
          <script language="shell"<job_chain_node  state="setAgent" job="setAgent" next_state="callAgent" error_state="error"/>
        <job_chain_node  state="callAgent" job="shellOnDynamicAgent" next_state="success" error_state="error"/>
        <job_chain_node  state="success"/>
        <job_chain_node  state="error"/>
    </job_chain> 

Order configuration

  • Add an order to the job chain jobChainWithAgentJob for each JobScheduler Agent.

    For example, one JobScheduler Agent runs on HostA with port 4444 and another JobScheduler Agent runs on HostB with port 4444. The order has to be assigned the parameters agent_host_ and _agent_port.

    Image Added


    This should result in the order configuration files ./config/live/jobChainWithAgentJob,hostA-4444.order.xml and ./config/live/jobChainWithAgentJob,hostB-4444.order.xml:

    Code Block
    languagehtml/xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <order>
        <params > <![CDATA[
     #! /bin/sh
     # returns the hostname of the agent
     hostname
            <!-- for ]]>
    use with JobScheduler releases  </script>
    before 1.10
           <monitor <param  name="setagent_agenthost" orderingvalue="0HostA"/>
            <script  language="javascript"-->
                <![CDATA[
     function spooler_task_before()\{
    	var agentHost = spooler_task.order.params.value('agent_host');
    	var agentPort = spooler_task.order.params.value('agent_port');
    	spooler_log.info("The agent " + agentHost + ":" + agentPort + " will be used.");
    	spooler_job.process_class.remote_scheduler = agentHost+":"+agentPort;
     \}-- for use with JobScheduler releases starting with 1.10 -->
            <param  name="agent_host" value="http://HostA"/>
    
            <param    ]]>
            </script>name="agent_port" value="4444"/>
         </monitor>params>
         <run_time/>
     </job>  
    
    Put the job into a job chain (e.g. job_chain_with_agent_job).
    No Format
    
     So you have the configuration file _./config/live/job_chain_with_agent_job.job_chain.xml_:</order>
    
    Code Block
    languagehtml/xml
    
     <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <order>
        <params >
     <job_chain  orders_recoverable="yes" visible="yes">
            <!-- for use with JobScheduler releases before 1.10
           <job_chain_node <param state="100" jobname="shell_on_dynamic_agent" next_state=host"success" error_statevalue="errorHostB"/>
        <job_chain_node  state="success"/>
        -->
         <job_chain_node  state="error"/>
     </job_chain> 
    
    Add an order to the job chain job_chain_with_agent_job for each JobScheduler Agent you want.
    No Format
    
     For example one agent is on HostA with port 4444 and another agent is on HostB with port 4444.
     The orders must have the parameter _agent_host_ and _agent_port_.
     So you have the configuration files _./config/live/job_chain_with_agent_job.job_chain.xml_:!-- for use with JobScheduler releases starting with 1.10 -->
            <param  name="agent_host" value="http://HostB"/>
            <param  name="agent_port" value="4444"/>
        </params>
        <run_time/>
    </order>