Versions Compared

Key

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

...

  • Extends the 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:
    
    Code Block
    languagejavascript
     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;
     \}  
    
    No Format
     This code reads the order parameter _agent_host_ and _agent_port_ and writes the _remote_scheduler_ attribute of the job's process class.    
     After you have added the postprocessing you get the following configuration file _./config/live/shell_on_dynamic_agent.job.xml_:
    
    Code Block
    languagehtml/xml
     <?xml version="1.0" encoding="ISO-8859-1"?>
     
     <job process_class="agents" order="yes">
         <script language="shell">
             <![CDATA[
     #! /bin/sh
     # returns the hostname of the agent
     hostname
             ]]>
         </script>
         <monitor  name="set_agent" ordering="0">
            <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;
     \}
                ]]>
            </script>
         </monitor>
         <run_time/>
     </job>  
    

...