5 Replies Latest reply on Feb 9, 2018 9:17 AM by Bill Robinson

    Get job run status for each target

    Hamish marson

      I'm trying to get the job run status for each target of a jobRun... With information such as available in the GUI. e.g. For each target it should be - Running, not yet started, completed successfully or error

       

      However the call getServersStatusByJobRun only seems to return either 'SUCCESS' or 'ERROR'. There's never any indication of a target not yet started or running... And I can't find a difference between a target that has completed successfully and a target that has just not errored yet

       

      is there another call I'm missing? I can't find one in the online docs for BSA 8.9

        • 1. Re: Get job run status for each target
          Bill Robinson

          JobRun.getServerTargetsAndStatusForJobRunId maybe?  look in the Unreleased blcli commands and documentation after generating the docs.  it says that returns a map object w/ the status and dbkey of the server.  you can feed that to Utility.mapPrint and then parse out the data.  not sure if it will show the status output you want though.  maybe another command in the JobRun namespace will

          • 2. Re: Get job run status for each target
            Hamish marson

            Hi Will.

             

            No luck so far...

             

            I'm wondering if it's because the job is an NSH script job, using runscript independently for each target. That would imply that I really only see the 'master' job and that the individual children (runscripts) that are executed fro each target aren't incldued.

             

            If that's correct, how would I get a list of children jobs (Which I could then presumably interrogate via

            getJobRunProgressByJobRun

             

            If I can work out how to get a scheduleID for each of them...

            • 3. Re: Get job run status for each target
              Bill Robinson

              there's not a schedule id for each target.

               

              why do you want the per-target status ?

              • 4. Re: Get job run status for each target
                Hamish marson

                I have several jobs that can take anywhere from a few minutes to half an hour or so of elapsed time per target. Sometimes I have hundreds of targets. This means a whole job may take 12 or more hours to complete for all targets

                 

                I need to be able to track (For audit & support purposes) when each target starts & finishes, and the state of each target (i.e. waiting to start, running, finished successfully, or error)

                 

                The only status I've been able to get so far is a list for all the targets of the job that either has SUCCESS (Which apparently really means not yet errored - because targets will be 'SUCCESS' until they actually ERROR and there's no distinction between successfully waiting to start & successfully completed) or error.

                • 5. Re: Get job run status for each target
                  Bill Robinson

                  how will knowing if the job has started against a target or not help w/ whatever support need there is ?  why can't the person open up the job run in the gui and see the state ?

                   

                  if the job is running but hasn't started against a particular target, what action is taken ?

                   

                  do you plan to constantly run the check during the day (or just look in tasks in progress ?) ?