Automic Workload Automation

 View Only
Expand all | Collapse all

Variables & Restarts

  • 1.  Variables & Restarts

    Posted Jul 12, 2019 02:36 PM
    Hi.  I have a customized solution that I got from consulting to trigger QlikSense Tasks from Automic.  Basically the process triggers the task and then there's a 2nd job that  queries QlikSense for the status of that task and keeps checking until the task has a FinishedSuccess status on the QlikSense side.  The 2nd job has a post condition that checks the status and if it isn't FinishedSuccess, it will "restart" the 2nd job in 1 minute.

    It works fine, but I'm trying to add some enhancements to the process.

    I need to keep track of the number of restarts.  For example, if there's a problem on the QlikSense side and the process is stuck - we don't want it to keep restarting the get status job indefinetely.  So we're setting a "max # of restarts" value.  But I need to be able to compare that number to the actual number of restarts.

    I tried using PSET and RSET, but it isn't doing exactly what I want.  It sets the value for the 1st and 2nd runs, but then after that it doesn't increase, it remains at 2.

    I just have this in the Post Process of this 2nd job.

    : PSET &RESTART_NO# = ADD(&RESTART_NO#, 1)
    : PRINT 'This is Restart Number &RESTART_NO#'

    I really don't want to have to create a temporary variable to store this info.  It seems like there should be a way to do this, but I'm missing something.

    Any ideas?  

    Thanks.


    ------------------------------
    Enterprise Scheduling Lead
    Takeda
    ------------------------------


  • 2.  RE: Variables & Restarts

    Posted Jul 12, 2019 02:51 PM
    Check out system variable: &$RESTART_COUNT#

    ------------------------------
    Pete (AE V11.2)
    ------------------------------



  • 3.  RE: Variables & Restarts

    Posted Jul 12, 2019 03:03 PM
    Dude!  @Pete Wirfs you are AWESOME!  Thank you so much!​

    ------------------------------
    Enterprise Scheduling Lead
    Takeda
    ------------------------------



  • 4.  RE: Variables & Restarts

    Posted Jul 17, 2019 07:40 AM
    @Laura Albrecht, @Pete Wirfs
    Please note that the variable &$RESTART_COUNT# is only incremented during automatic restarts. If the task is restarted manually by a user, this does not happen.

    You are welcome to have a look at the following idea (and vote for it :-) ):
    https://community.broadcom.com/participate/ideation-home/viewidea?IdeationKey=62214f7d-f2d1-472e-849a-c1985b854290 ​​

    ------------------------------
    Automation Evangelist
    Fiducia & GAD IT AG
    ------------------------------



  • 5.  RE: Variables & Restarts

    Posted Jul 17, 2019 10:14 AM
    @laura_albrecht_automic @Pete Wirfs
    Please note that the variable &$RESTART_COUNT# is only incremented during automatic restarts. If the task is restarted manually by a user, this does not happen.

    You are welcome to have a look at the following idea (and vote for it :-) ):
    https://community.broadcom.com/participate/ideation-home/viewidea?IdeationKey=62214f7d-f2d1-472e-849a-c1985b854290 ​​

    ------------------------------
    Automation Evangelist
    Fiducia & GAD IT AG
    ------------------------------



  • 6.  RE: Variables & Restarts

    Posted Jul 17, 2019 10:14 AM
    @Pete Wirfs, @Laura Albrecht
    Please note that the variable &$RESTART_COUNT# is only incremented during automatic restarts. If the task is restarted manually by a user, this does not happen.

    You are welcome to have a look at the following idea (and vote for it :-) ):
    https://community.broadcom.com/participate/ideation-home/viewidea?IdeationKey=62214f7d-f2d1-472e-849a-c1985b85429 ​​

    ------------------------------
    Automation Evangelist
    Fiducia & GAD IT AG
    ------------------------------



  • 7.  RE: Variables & Restarts

    Posted Jul 17, 2019 10:21 AM
    That's THREE ​points to Gryffindor ... :p


  • 8.  RE: Variables & Restarts

    Posted Jul 18, 2019 03:49 AM
    I guess you meant "THREE points FROM Gryffindor"? ;-)

    ------------------------------
    Automation Evangelist
    Fiducia & GAD IT AG
    ------------------------------



  • 9.  RE: Variables & Restarts

    Posted Jul 18, 2019 04:23 AM
    ​You're probably right. After all, I was never THAT much into Star Trek ... ;)


  • 10.  RE: Variables & Restarts

    Posted Jul 19, 2019 11:00 AM
    Wow... That sounds a lot cleaner than what we do!  We should replace some of our complicated code by just checking that variable?
    We have a combination of a "pre-processing" include and a "post-processing" include to check/update a "Published value" in the system.

    Pre-processing include:
    :DEFINE &PRP_ITER#, UNSIGNED
    :DEFINE &PRP_UPD_ITER#, STRING
    :IF SYS_ACT_RESTART() = "Y"
    : IF ISNUMERIC(&PRP_ITER#) = "N"
    : PSET &PRP_ITER# = 0
    : ENDIF
    : PRINT "------------------------------------------------"
    : PRINT "FROM PREP: THIS TASK WAS STARTED IN RESTART MODE"
    : PRINT "------------------------------------------------"
    : PRINT "FROM PREP: ACTIVATOR RUNID - &$ACTIVATOR_RUNID#"
    : PRINT "FROM PREP: RESTART RUNID - &$RESTART_RUNID#"
    : PRINT "FROM PREP: RUNID - &$RUNID#"
    : PSET &PRP_UPD_ITER# = GET_PUBLISHED_VALUE(&$ACTIVATOR_RUNID#,PRP_ITER#)
    : PSET &PRP_UPD_ITER_TRIM# = STR_TRIM(&PRP_UPD_ITER#)
    etc...

    Post-processing include:
    :IF &RETCODE# <> 0
    : PSET &PRP_ITER# = FORMAT(&PRP_ITER#)
    : IF &PS_RESTART_ATTEMPTS# > 0
    : IF &PRP_ITER# < &PS_RESTART_ATTEMPTS#
    : PRINT "----------------------------------------------------------------------"
    : PRINT "FROM POST: THIS IS RESTART ATTEMPT &PRP_ITER# OF &PS_RESTART_ATTEMPTS#"
    : PRINT "FROM POST: WAITING &PS_RESTART_WAIT# SECONDS UNTIL NEXT ATTEMPT"
    : PRINT "----------------------------------------------------------------------"
    : PSET &PRP_ITER# = ADD(&PRP_ITER#,1)
    : WAIT &PS_RESTART_WAIT#
    : PSET &POP_RESTRUNID# = RESTART_UC_OBJECT(&$NAME#,&$RUNID#,,,&$QUEUE#)
    etc...