3 Replies Latest reply on Mar 5, 2013 1:56 AM by Siddu angadi

    Known issue with blcli_execute BatchJob executeJobAndWait ?

      We are using Blade Logic 7.6. Is there a known issue with executeJobAndWait method for BatchJob not waiting? I am running the below block of code and after executing the first line executeJobAndWait, the script flow is not halting for the Batch Job to complete. It is therefore continuing, then when reaching the getJobRunHadErrorsById method, it is returning "false". However, the actual batch job completes about 10 seconds later with a failure.

       

      ========================================================================================================

      Example snippet:

       

      blcli_execute BatchJob executeJobAndWait "$JOB_KEY"
      blcli_storeenv RUN_KEY
      echo RUN KEY is: $RUN_KEY
      RUN_ID=`blcli JobRun jobRunKeyToJobRunId "$RUN_KEY"`
      check_rc
      echo RUN ID is: $RUN_ID
      BATCH_STATUS=`blcli JobRun getJobRunHadErrorsById "$RUN_ID"`
      check_rc
      echo BATCH_STATUS is: $BATCH_STATUS

      if [ "$BATCH_STATUS" = "true" ]
      then
             echo Batch job failed
             exit 1
      else
             echo Batch job completed successfully
      fi

       

      =========================================================================================================

       

      On a separate note, we have been using the executeJobAndWait method for NSHScriptJob daily for well over a year and have never had this problem.

        • 1. Re: Known issue with blcli_execute BatchJob executeJobAndWait ?
          Siddu angadi

          Hi John,

           

          Please use the below script, I have tested it and it worked at my end:

           

          #####################################################

           

          blcli_execute BatchJob executeJobAndWait "$JOB_KEY"

          blcli_storeenv RUN_KEY

          echo RUN KEY is: $RUN_KEY

           

           

          blcli_execute JobRun jobRunKeyToJobRunId "$RUN_KEY"

          blcli_storeenv RUN_ID

           

           

          echo RUN ID is: $RUN_ID

           

           

          blcli_execute JobRun getJobRunHadErrorsById "$RUN_ID"

          blcli_storeenv BATCH_STATUS

           

           

          echo BATCH_STATUS is: $BATCH_STATUS

           

           

          if [ "$BATCH_STATUS" = "true" ]

          then

                 echo Batch job failed

                 exit 1

          else

                 echo Batch job completed successfully

          fi

           

           

           

          ####################################################

          • 2. Re: Known issue with blcli_execute BatchJob executeJobAndWait ?

            Siddu, I tried your solution with some of the replacement blcli performance commands but am still having problems randomly.

             

            My most recent run lost the handle on the batch job entirely - and i've seen this issue in the past. So, after executing the below line:

             

            blcli_execute BatchJob executeJobAndWait "$JOB_KEY"

             

            I lose connection to the spawned batch job - which by the way continues running - and am then no longer able to store the next line:

             

            blcli_storeenv RUN_KEY

             

            Without the $RUN_KEY variable returning, my script fails at the first command that references it:

             

            blcli_execute JobRun jobRunKeyToJobRunId "$RUN_KEY"

            • 3. Re: Known issue with blcli_execute BatchJob executeJobAndWait ?
              Siddu angadi

              Basically you want to find the result of Job right?.. There is another way to do it..

               

              I will upload document today.

               

              Thanks

              Siddu