Search code examples
cronjobsautosys

Autosys job testing


I am new to autosys.. does anyone know how to perform positive and negative test on particluar job


Solution

  • Autosys seems to be painfully limited. You can create a condition in JOB2 that depends on the success of JOB1 e.g. SUCCESS(JOB1). But there seems to be no support for a condition that is the inverse of SUCCESS. Autosys provides a RUNNING and a NOTRUNNING condition, but for some reason they unfortunately omitted to include a NOTSUCCESS.

    The best workaround I've come up with so far is to use the following JIL configuration:

    insert_job: 0AM-7AM_BOX
    job_type: b
    start_times: "00:00"
    description: "Succeeds if JOB1 succeeds, TERMINATED if JOB1 does not succeed"
    term_run_time: 419
    
    insert_job: CHECK_THE_CONDITION
    job_type: c
    box_name: 0AM-7AM_BOX
    command: date
    condition: success(JOB1)
    description: "Succeeds if JOB1 succeeds"
    
    insert_job: ACT_ON_THE_CONDITION
    job_type: c
    command: [put the command you want to execute here]
    condition: SUCCESS(CHECK_THE_CONDITION)
    description: "Run the run between midnight and 7am if the condition is true"
    

    So, if JOB1 enters the state "SUCCESS" between midnight and 7am, then ACT_ON_THE_CONDITION will immediately run. Since the command is just a dummy call to "date" this should run immediately and also become "SUCCESS" and therefore the 0AM-7AM_BOX box will also become "SUCCESS".

    The other possibility is that JOB3 does not enter state "SUCCESS" before 7am. In this case, the "term_run_time" setting will cause the box to enter the state "TERMINATED".

    Summing up,

    1. If JOB1 is SUCCESS, 0AM-7AM_BOX -> SUCCESS
    2. If JOB1 is anything except SUCCESS, 0AM-7AM_BOX -> TERMINATED

    This is useful because you can then set up dependent jobs that test the success condition or the terminated condition (since TERMINATED is a valid test you can put in a condition).