Automic Workload Automation

 View Only

Job is not activating when scheduled.

  • 1.  Job is not activating when scheduled.

    Posted Mar 24, 2024 09:34 PM
    Edited by Shashank devadiga Mar 24, 2024 09:35 PM

    Hello, community,

    We have an on-demand application where we can schedule or manually trigger any jobs,  those job names will be stored in  DB table.

    In Automic there is a job that runs every minute and fetches the job name from that db table with a help vara object and activates the job in Automic.

    This is the script under that job.

    ! GET system date
    : SET &SPACE# = ''
    : SET &DATE# = SYS_DATE("YYYYMMDD","TZ.MEZ")
    : SET &TIME# = SYS_TIME("HH:MM:SS","TZ.MEZ")
    : SET &DATES# = STR_CAT(&DATE#,&SPACE#)
    : set &SYSDT# = STR_CAT(&DATE#,&TIME#)
    ! variables - define array with 3 columns
    : DEFINE &REST#,string
    : DEFINE &STRINGS#, string, 5
     
    ! get var results and store in array -- READS ONLY ONE LINE - DONT USE
    : SET &STRING# = GET_VAR(VARA.SQL.PRUSA_OD_AUTOMATE_ESSBASE)
     
    ! get var results and store in array -- LOOPS EVERY ROW
    : SET &HND# = PREP_PROCESS_VAR(VARA.SQL.PRUSA_OD_AUTOMATE_ESSBASE)
    : PROCESS &HND#
    ! GET first column value of every line
    : SET &RES# = GET_PROCESS_LINE(&HND#,1)
    : PRINT "LOOP:  &RES#"
     
    ! spilt result column into array based on semi-colon
    : FILL &STRINGS#[] = STR_SPLIT(&RES#,";")
    ! While loop for all 3 columns
    : SET &VAR# = 1
    : SET &LEN# = LENGTH(&STRINGS#[])
    : WHILE &VAR# LE &LEN#
    :   SET &VAR# = FORMAT(&VAR#,"0")
    :   PRINT "&VAR#. Parm = &STRINGS#[&VAR#]"
    :   SET &VAR# = &VAR#+ 1
    : ENDWHILE
    ! test
    : PRINT "Start Date: &STRINGS#[2] End Date: &STRINGS#[3]  Sys Date: &SYSDT#"
    ! check if within date range.. if so a ctivate job
    : IF &SYSDT# >= &STRINGS#[2]
    :    IF &SYSDT# <= &STRINGS#[3]
    :       PRINT "STARTED JOB: &STRINGS#[1]"
    :       SET &REST# = ACTIVATE_UC_OBJECT(&STRINGS#[1])
    :    ENDIF
    : ENDIF
    : ENDPROCESS
    : CLOSE_PROCESS &HND#

    We have tested the below three scenarios,

    scenario 1: Manually executes JOB from on-demand => JOB gets Active in automic => manually executed the same job in automic second time=> second execution in the status waiting for parallel task to end. => NO ISSUES


    scenario 2:  Schedules the job 2 times in on-demand application. for example, at 10:15 and 10:16. the first execution of the job gets active in Automic at 10:15 and at 10:16 second job shows in Automic with waiting for parallel task status. => NO iISSUES


    scenario 3: Manually executes the job in on-demand => It gets activated in automic, then schedules the same job in on-demand while the first manually triggered execution is Active. but scheduled execution never gets started in Automic.

    In the 3rd scenario, we are facing issues and couldn't figure out why. Can any Automic expert help on this?


    Thank you!

    Shashank