Uploaded image for project: 'JS - JobScheduler'
  1. JS - JobScheduler
  2. JS-1607

spooler_task.exit_code() is always 0 if the task has run on an Agent

    XMLWordPrintable

    Details

      Description

      Current Situation

      • We assume that we have a shell job with an exit code unequal 0 and it run on an Universal Agent.
      • Then the exit code in the spooler_task object of the JobScheduler API is nevertheless 0.
      • So, it is not possible for example to do something depends on the exit code in a post-processing.
      job
      <?xml version="1.0" encoding="ISO-8859-1"?>
      
      
      <job  order="yes" stop_on_error="no">
          <script  language="shell">
              <![CDATA[
      exit 2
              ]]>
          </script>
      
          <monitor  name="process0" ordering="0">
              <script  language="javax.script:ecmascript">
                  <![CDATA[
      function spooler_task_after(){   
          spooler_log.info("Task ends with exit code " + spooler_task.exit_code());
          //It is always 0.
      }
                  ]]>
              </script>
          </monitor>
      </job>
      
      task log
      2016-03-16 14:54:21.717+0100 [info]   
      2016-03-16 14:54:21.717+0100 [info]   Task test/changeExitCodeInMonitor:2842094 - Protocol starts in C:/ProgramData/sos-berlin.com/jobscheduler/scheduler.1.10/logs/task.test,changeExitCodeInMonitor.log
      2016-03-16 14:54:21.716+0100 [info]   SCHEDULER-842  Task is going to process Order test/job_chain3:1584, state=100, on JobScheduler 'http://OH:4410', Order's Process_class test/agent4447-oh
      2016-03-16 14:54:21.742+0100 [info]   SCHEDULER-726  Task runs on remote scheduler http://oh.sos:4447
      2016-03-16 14:54:21.742+0100 [info]   SCHEDULER-918  state=starting (at=never)
      2016-03-16 14:54:24.274+0100 [info]   [stdout] 2016-03-16 14:54:23,077 +0100 [DEBUG] com.sos.scheduler.engine.common.tcp.TcpConnection - Connecting with /127.0.0.1:58975 ...
      2016-03-16 14:54:24.293+0100 [info]   [stdout] 2016-03-16 14:54:23,082 +0100 [DEBUG] com.sos.scheduler.engine.common.tcp.TcpConnection - Connected own /127.0.0.1:59223 with remote /127.0.0.1:58975
      2016-03-16 14:54:24.299+0100 [info]   [stdout] 2016-03-16 14:54:23,124 +0100 [DEBUG] com.sos.scheduler.engine.minicom.remoting.Remoting - (AgentTaskId(7-2090546150523515668)) Started
      2016-03-16 14:54:24.306+0100 [info]   [stdout] 2016-03-16 14:54:23,135 +0100 [DEBUG] com.sos.scheduler.engine.minicom.remoting.Remoting - (AgentTaskId(7-2090546150523515668)) CreateInstanceCall
      2016-03-16 14:54:24.320+0100 [info]   [stdout] 2016-03-16 14:54:23,293 +0100 [DEBUG] com.sos.scheduler.engine.minicom.remoting.Remoting - (AgentTaskId(7-2090546150523515668)) CreateInstanceResult
      2016-03-16 14:54:24.329+0100 [info]   [stdout] 2016-03-16 14:54:23,319 +0100 [DEBUG] com.sos.scheduler.engine.minicom.remoting.Remoting - (AgentTaskId(7-2090546150523515668)) CallCall
      2016-03-16 14:54:24.337+0100 [info]   [stdout] 2016-03-16 14:54:23,350 +0100 [INFO ] com.sos.scheduler.engine.taskserver.task.RemoteModuleInstanceServer - AgentTaskId(7-2090546150523515668) is Master's task changeExitCodeInMonitor:TaskId 2842094
      2016-03-16 14:54:24.344+0100 [info]   [stdout] 2016-03-16 14:54:23,352 +0100 [DEBUG] com.sos.scheduler.engine.minicom.remoting.Remoting - (AgentTaskId(7-2090546150523515668)) InvokeResult
      2016-03-16 14:54:24.352+0100 [info]   [stdout] 2016-03-16 14:54:23,372 +0100 [DEBUG] com.sos.scheduler.engine.minicom.remoting.Remoting - (AgentTaskId(7-2090546150523515668)) CallCall
      2016-03-16 14:54:24.359+0100 [info]   [stdout] 2016-03-16 14:54:24,199 +0100 [INFO ] com.sos.scheduler.engine.taskserver.task.process.RichProcess - Start process 
      2016-03-16 14:54:24.368+0100 [info]   [stdout] 2016-03-16 14:54:24,218 +0100 [INFO ] com.sos.scheduler.engine.taskserver.task.process.ShellScriptProcess - (java.lang.ProcessImpl@78b87a7b C:\Users\oh\AppData\Local\Temp\JobScheduler-Agent-changeExitCodeInMonitor-467171089428626521.cmd) Process started
      2016-03-16 14:54:24.374+0100 [info]   [stdout] 2016-03-16 14:54:24,220 +0100 [DEBUG] com.sos.scheduler.engine.taskserver.task.process.RichProcess - waitFor java.lang.ProcessImpl@78b87a7b ...
      2016-03-16 14:54:24.381+0100 [info]   [stdout] 
      2016-03-16 14:54:24.387+0100 [info]   [stdout] C:\Users\oh>exit 2 
      2016-03-16 14:54:24.396+0100 [info]   [stdout] 2016-03-16 14:54:24,232 +0100 [DEBUG] com.sos.scheduler.engine.taskserver.task.process.RichProcess - waitFor java.lang.ProcessImpl@78b87a7b exitCode=2
      2016-03-16 14:54:24.402+0100 [info]   [stdout] 2016-03-16 14:54:24,233 +0100 [INFO ] com.sos.scheduler.engine.taskserver.task.process.ShellScriptProcess - (java.lang.ProcessImpl@78b87a7b C:\Users\oh\AppData\Local\Temp\JobScheduler-Agent-changeExitCodeInMonitor-467171089428626521.cmd) Process ended with ReturnCode(2)
      2016-03-16 14:54:24.407+0100 [info]   [stdout] 2016-03-16 14:54:24,236 +0100 [DEBUG] com.sos.scheduler.engine.minicom.remoting.Remoting - (AgentTaskId(7-2090546150523515668)) InvokeResult
      2016-03-16 14:54:24.412+0100 [info]   [stdout] 2016-03-16 14:54:24,266 +0100 [DEBUG] com.sos.scheduler.engine.minicom.remoting.Remoting - (AgentTaskId(7-2090546150523515668)) CallCall
      2016-03-16 14:54:24.418+0100 [info]   [stdout] 2016-03-16 14:54:24,268 +0100 [DEBUG] com.sos.scheduler.engine.taskserver.task.process.RichProcess - waitFor java.lang.ProcessImpl@78b87a7b ...
      2016-03-16 14:54:24.424+0100 [info]   [stdout] 2016-03-16 14:54:24,268 +0100 [DEBUG] com.sos.scheduler.engine.taskserver.task.process.RichProcess - waitFor java.lang.ProcessImpl@78b87a7b exitCode=2
      2016-03-16 14:54:24.531+0100 [info]   Task ends with exit code 0
      2016-03-16 14:54:24.573+0100 [ERROR]  SCHEDULER-280  Process terminated with exit code 2 (0x2)
      

      Desired Behavior

      If a task runs on the Universal Agent then the API method spooler_task.exit_code() has to return the exit code of the Agent task.

        Attachments

          Activity

            People

            • Assignee:
              jz Joacim Zschimmer
              Reporter:
              oh Oliver Haufe
              Approver:
              Oliver Haufe
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: