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

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.

...

Now we assume that we have multiple JobScheduler Agents and we want that a job executes 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.

...

  • So

...

  • you

...

  • get

...

  • 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 shellOnDynamicAgent and calls hostname as shell command.

    noformat

    So

    you

    get

    the

    following

    configuration

    file

    _

    ./config/live/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>  
    
  • Create the following job (e.g. setAgent) and put it into the job chain as the forerunner of the agent job.

    No Format

    This

    job

    change

    the

    process_class

    setting

    of

    the

    successor

    job

    in

    the

    job

    chain

    according

    the

    order

    parameter

    _

    agent_host_

    and

    _agent_port

    _

    .

    Code Block
    languagehtml/xml
    
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <job  order="yes" stop_on_error="no">
        <params />
    
        <script  language="javascript">
            <![CDATA[
    function spooler_process()\{
    
    	var curOrder = spooler_task.order;
    	var agentHost = curOrder.params.value('agent_host');
    	var agentPort = curOrder.params.value('agent_port');
    	var nextJob = curOrder.job_chain_node.next_node.job;
    	spooler_log.info("Params agentHost:agentPort = "+agentHost+":"+agentPort);
    	spooler_log.info("before: "+nextJob.process_class.remote_scheduler);
            nextJob.process_class.remote_scheduler = agentHost+":"+agentPort;
    	spooler_log.info("after: "+nextJob.process_class.remote_scheduler);
    	return true;
    \}
            ]]>
        </script>
    
        <run_time />
    </job>
    
  • Put these jobs into a job chain (e.g. jobChainWithAgentJob)
    Image Modified

    No Format


    So

    you

    have

    the

    configuration

    file

    _

    ./config/live/jobChainWithAgentJob.job_chain.xml

    _

    :

    Code Block
    languagehtml/xml
    
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <job_chain  orders_recoverable="yes" visible="yes">
        <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> 
    
  • Add an order to the job chain jobChainWithAgentJob 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

    _

    .

    Image Modified

    noformat

    So

    you

    have

    the

    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 >
            <param  name="agent_host" value="HostA"/>
            <param  name="agent_port" value="4444"/>
        </params>
        <run_time/>
    </order>
    
    Code Block
    languagehtml/xml
    
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <order>
        <params >
            <param  name="agent_host" value="HostB"/>
            <param  name="agent_port" value="4444"/>
        </params>
        <run_time/>
    </order>