Automic Workload Automation

 View Only
  • 1.  Auto restart automic JOBS and JOBP if they abort or block

    Posted Mar 14, 2024 11:26 PM

    Hello community,

    Is there any way to auto restart the JOBP and JOBS if they abort or blocked.

    Thank you! 



  • 2.  RE: Auto restart automic JOBS and JOBP if they abort or block

    Posted Mar 15, 2024 07:51 AM

    Depending on the use case, you may want to try using the Post Conditions.

    We use the following on some ftp jobs so it will attempt every 5 minutes, for a count of 13




  • 3.  RE: Auto restart automic JOBS and JOBP if they abort or block

    Posted Mar 17, 2024 12:49 AM

    Hi Rick,

    Thanks for your response, can you please tell us more about the variable &$RESTART_COUNT, where and how to store this variable, and whether we have to define the variable in in the job itself or in the workflow?

    Thanks,

    Abhishek




  • 4.  RE: Auto restart automic JOBS and JOBP if they abort or block

    Broadcom Employee
    Posted Mar 18, 2024 12:15 AM

    &$RESTART_COUNT# is a Predefined variable (used to provide information about either the system or the currently executing task).  This will work the same as using the script element SYS_ACT_RESTART_COUNT ().

    You can see the list of Predefined variables here: https://docs.automic.com/documentation/WEBHELP/English/AA/21.0/DOCU/21.0.9/Automic%20Automation%20Guides/Content/AWA/Variables/Variables_Object_ScriptValues.htm?tocpath=Reference%7CVariables%20for%20System%20and%20Object%20Values%7C_____2




  • 5.  RE: Auto restart automic JOBS and JOBP if they abort or block

    Posted Mar 19, 2024 08:11 AM

    For a much better formatted list of predefined variables, see the old v12.0 documentation.  Note that there may be some missing variables for the newer AE versions but that majority are there.  I have suggested they get back to old formatted version as it is much easier to use.

    https://docs.automic.com/documentation/webhelp/english/AWA/12.0/DOCU/12.0/AWA%20Guides/help.htm#AWA/Objects/varaPredefinedList.htm




  • 6.  RE: Auto restart automic JOBS and JOBP if they abort or block

    Posted 30 days ago

    Hello everyone,

    thank you for all the responses. We have a lot of JOBS and workflows, and adding postconditions to each job is not possible.

    We got the script from another thread for the same purpose, we are testing it, however, the 1st execution will not end and restarted execution ends with fault another error.


    The script we are using: 

    You can adjust it as per your requirements or remove some of the comments.

    We are using it as include (JOBI) in whichever object is required.

    We decided to keep the values in a static VARA object and perform the restart with 5minutes inbetween executions.

    P.S. JOBI.MONITORING is our include for the alerting, you can disregard that line.

    :SET &THISJOBNAME# = SYS_ACT_ME_NAME()
    :SET &THISJOBNR# = SYS_ACT_RESTART_ME_NR()
    :SET &THISSTATUS# = GET_UC_OBJECT_STATUS('JOBS', '&THISJOBNR#', 'STATUS')
    :SET &THISTIME# = SYS_TIME('HH:MM:SS')
    :SET &THISDATE# = SYS_DATE('TT.MM.JJJJ')
    :SET &VALUE# = 1
    :SET &VALUE# = FORMAT(&VALUE#)
    :SET &VALUE2# = 3
    :SET &VALUE2# = FORMAT(&VALUE2#)
    ! Check if status is ENDED_OKAY or ENDED_NOTOK
    :IF &THISSTATUS# = '1900' or 'ENDED_OK'
    : SET &THISSTATUS# = 'ENDED_OK'
    : p "&THISSTATUS#"
    :ELSE
    : SET &THISSTATUS# = 'ENDED_NOTOK'
    : p "&THISSTATUS#"
    :ENDIF
    ! Print Execution Information
    :PRINT "Job name: &THISJOBNAME#"
    :PRINT "Job RunID: &THISJOBNR#"
    :PRINT "Status of the job: &THISSTATUS#"
    :PRINT "Time of End: &THISTIME# &THISDATE#"
    ! If the status is ENDED_NOTOK add 1 to the variable and rerun after 5 minutes.
    ! If there is already an entry for the job the monitoring include will do its magic
    :IF &THISSTATUS# = 'ENDED_NOTOK'
    : S &TRG1# = GET_VAR(VARA.AUTO_RERUN_X3, &THISJOBNAME#, 1)
    : IF &TRG1# = ''
    : P "First Failure of the job.Rerunning after 5 minutes."
    : PUT VARA.AUTO_RERUN_X3, &THISJOBNAME#, &VALUE#, &VALUE#, &THISDATE#, &THISTIME#
    : WAIT 300
    : SET &RERUNNAME# = SYS_ACT_ME_NAME()
    : SET &RERUNRET# = RESTART_UC_OBJECT (&THISJOBNAME#,LAST)
    : PRINT '&RERUNNAME# restarted.'
    : ELSE
    : IF &TRG1# < &VALUE2#
    : S &TRG1# = FORMAT(&TRG1#)
    : S &TRG1# = &TRG1# + 1
    : S &TRG1# = FORMAT(&TRG1#)
    : PUT_VAR_COL VARA.AUTO_RERUN_X3, &THISJOBNAME#, 1, &TRG1#
    : P "This will be the &TRG1# rerun of the job.Rerunning after 5 minutes."
    : WAIT 300
    : SET &RERUNNAME# = SYS_ACT_ME_NAME()
    : SET &RERUNRET# = RESTART_UC_OBJECT (&THISJOBNAME#,LAST)
    : PRINT '&RERUNNAME# restarted.'
    :ELSE
    : P "The &TRG1# rerun of the job has failed. Taking appropriate action."
    : INC JOBI.MONITORING,NOFOUND=IGNORE
    :IF &TRG1# = 3
    : DELETE_VAR VARA.AUTO_RERUN_X3, &THISJOBNAME#
    :ENDIF
    : ENDIF
    : ENDIF
    : ENDIF
    ! If the status is ENDED_OK, the entry will be deleted.
    :IF &THISSTATUS# = 'ENDED_OK'
    : p "Deleting Variable Entry"
    : DELETE_VAR VARA.AUTO_RERUN_X3, &THISJOBNAME#
    :ENDIF


    Link for other thread: https://community.broadcom.com/communities/community-home/digestviewer/viewthread?MID=784569

    Thank you!