AutoSys Workload Automation

  • 1.  How to run a job multiple times in Autosys

    Posted Jan 13, 2015 05:40 AM

    I have an SFTP job that downloads a file from a remote site. The remote file may be available any time between 10 - 11 am. I need to configure the autosys job in such a way that it retries in case of failure in every 10 minutes(no need to retry on success). I am aware of the n_retrys attribute.  What I need is to set a delay between two retries. Is that possible?

     

    Thanks



  • 2.  Re: How to run a job multiple times in Autosys
    Best Answer

    Posted Jan 19, 2015 06:37 PM

    One way would be to use a lookback job.

     

    For example:

     

    insert_job: BhanuDas     job_type: CMD

    command: false

    machine: localhost

    owner: autosys@localhost

    permission:

    date_conditions: 1

    days_of_week: all

    start_times: "17:00"

    alarm_if_fail: 1

     

    Add this job to retry the operation every 10 minutes if the original job fails or the retry job fails.

     

    insert_job: BhanuDas-retry   job_type: CMD

    command: false

    machine: localhost

    owner: autosys@localhost

    permission:

    date_conditions: 1

    days_of_week: all

    start_times: "17:10, 17:20, 17:30, 17:40, 17:50"

    condition: f(BhanuDas, 00.10) | f(BhanuDas-retry,00.10)

    alarm_if_fail: 1



  • 3.  Re: How to run a job multiple times in Autosys

    Posted Jan 26, 2015 12:41 PM

    Thanks a lot Mark



  • 4.  Re: How to run a job multiple times in Autosys

    Posted Sep 05, 2016 02:33 PM

    Hi Mark,

    I'm new to Autosys usage(Have CA Workload Automation 11.3.6), I had a requirement which I'm not able to figure out the correct way to set it. Your help would be greatly appreciated.

    I got this thread from the CA community where you have replied for a similar requirement as mine,

     

    Requirement,

    I have 1 job which should trigger by 1AM and if it fails then the job should re-trigger by 1.10AM and so on until 4AM with retry every 10mins.

    If the job Succeeds in-between then the Retry should stop, if not the retry should stop after 4AM try.

     

    On this  I read this thread and I tried doing what is said but was not able to succeed.

    I would like to know in this thread,

    →Both the Job's COMMAND is equal to FALSE, Which means these JOBs will always fail?

    → And the ReTRY job has CONDITION as  f(BhanuDas, 00.10) | f(BhanuDas-retry,00.10) . 00.10 Symbolizes time gap? f(BhanuDas-retry,00.10) failure of this job is guaranteed as the command is false, then how will it trigger the first job every 10mins?

     

     

    What I have tried,

    I have 2 jobs: Job 1(Main Job) and JobR(Retry Job)

     

    Job 1:

    Command : <Script path which executes a .JAR>

    Condition: f(<JobR>)

    date_conditions: 1

    days_of_week: all

    start_times: "1:00"

    alarm_if_fail: 1

     

    JobR:

    Command: false

    Condition: f(Job 1 ,00.10) OR f(JobR, 00.10)

    date_conditions: 1

    days_of_week: all

    start_times: "1:10, 1:20, 1:30,...........3:50, 4:00"

    alarm_if_fail: 1

     

    Job1 runs and triggers JobR, but when JobR fails(which is as planned) doesn’t trigger Job 1 L

    Kindly help me with what condition changes are required to meet the requirements.

     

    Thanks for all the support,



  • 5.  Re: How to run a job multiple times in Autosys

    Posted Sep 07, 2016 09:56 PM

    Hi Aditya,

     

    Try this:

     

    job-1 would look like this:

    insert_job: job-1     job_type: CMD

    command: <script that calls .jar>

    machine: localhost

    owner: autosys@localhost

    permission:

    date_conditions: 1

    days_of_week: all

    start_times: "1:00"

    alarm_if_fail: 1

     

    job-r would look like this:

    insert_job: job-r   job_type: CMD

    command: <script that calls .jar>

    machine: localhost

    owner: autosys@localhost

    permission:

    date_conditions: 1

    days_of_week: all

    start_times: "1:10, 1:20, 1:30, 1:40, 1:50. 2:00, 2:10, 2:20, 2:30, 2:40, 2:50. 3:00, 3:10, 3:20, 3:30, 3:40, 3:50. 4:00"

    condition: f(job1, 00.10) | f(job-r,00.10)

    alarm_if_fail: 1

     

    Both jobs run the same command. job-1 runs at 1am if it succeeds, great, we're done.

    Then starting at 1:10 job-r will evaluate starting conditions and run if job-1 failed or moving forward through the start_times if job-r failed during that time period.

     

    Hope this helps.

     

    Regards,

    Mark Hanson



  • 6.  Re: How to run a job multiple times in Autosys

    Posted Sep 08, 2016 11:51 AM

    Yep in the mean time I did the same and its working perfectly. Workload automation is bit different from the Autosys scripting we use to do.

     

    Thanks,

    Adithya



  • 7.  Re: How to run a job multiple times in Autosys

    Posted Sep 29, 2016 11:15 AM

    Hello Mark,

     

    I have a scenario here, Please help us get to resolve this.

     

    I have a job which triggers a shell script(JOB1) by 1AM and 

    ---on "successful" run it creates a 'success.flag' file 

    ---on "failure" it creates a 'rerun.flag' file

     

    Now I want a file watcher job which should monitor the flag file and if its  'success.flag' then I need to trigger file transfer job but if its 'rerun.flag' then I should rerun the JOB1(or RETRY job as per your last answer).

    And this is not a one time activity, This thing runs in cycle between 1am to 4am with an interval of 10min everyday until it succeeds.

     

    Can you please help me with this scenario,

    -. can a file watcher job run in loops to keep checking for a flag file and update the next jobs with some status to proceed further?

    -. is there any other way I can do this? 

     

    Eagerly looking forward for your answer.

     

    Thanks,

    Adithya



  • 8.  RE: Re: How to run a job multiple times in Autosys

    Posted Jan 08, 2021 01:35 PM
    Hi All,

    I have a complex scenario please help -

    Job A - runs all days after 1hr interval 

    Ex - Mon,tu,we,th,fr,sa,su 
    time - 0005,0105,0205,0305,0405,0505,0605 .... 2305

    Now the situaton is at times a random interval job overruns and disturb the processing of downstream interval job.

    Like suppose 0205 overruns and completes at 0320 , so 0305 run will not happen and directly next job i.e 0405 will run,

    I want to implement a solution where 0305 job also run and check for its prev run whether it has completed or not. Please help.


  • 9.  RE: Re: How to run a job multiple times in Autosys

    Posted Jan 11, 2021 01:16 PM
    The job won't start again if it is already running during scheduled time. That time will be skipped and it would start again at next schedule (in your example being 04:05).

    A couple options for you to consider:
    - configure term run time to kill the job if it runs longer than X minutes (i.e. set to 58 minutes), meaning it would start again at next scheduled time. This could impact your downstream job if not configured to run on completion versus only success.
    - configure max run alarm or must complete times and set up to notify someone that the job ran long and they can monitor and start manually once completed (not ideal for hourly job as window to resolve is rather short)
    - make a copy of the jobs and run each in alternating hours (gives you 2 hour run gap before next scheduled start instead of 1)

    I have a similar scenario in which I configured my jobs for a must complete time to notify my team when a job runs past it's schedule, so we can monitor completion and start it again manually.
    Somewhat similar to your situation that mine need to run hourly as well, but they do run longer so I split them up into 24 individual jobs starting each hour so they run independently and there is no impact to the other start times. We then would get notified so we can resolve each individually. So my scenario they are each 1x per day jobs so we get notified if they run longer than 5 minutes before 24 hours and likely to miss their scheduled start.