views:

627

answers:

1

We have an Autosys job (let's call it job_a) that has a 3am time dependency and is also supposed to await successful completion of a mainframe job (job_m, which in our case is always successful). Job_m is run via the OPC scheduler on the mainframe, which communicates job completion to Autosys. It can run any time between 2am and 6am.

My understanding of how Autosys works is that it writes an entry into a table in its database when job_m completes, and when job_a checks its dependencies, it looks in this table to see the status of job_m. This status is not automatically cleared. As a result, the job dependency will always be met after the first ever successful run of job_m, even though we are only interested in job_m runs on the same day.

Day 1 4am: job_m completes
Day 1 4:01am: job_a runs, since Day 1 4am run of job_m was successful
Day 2 3am: job_a runs, since Day 1 4am run of job_m was successful
Day 2 5am: job_m completes

Our current proposed workaround is to have a job (job_c) that periodically checks the table and only complete if the status of job_m was changed in the last 6 hours.

Day 1 3am: job_c starts, sees no status change for job_m within the last 6 hours
Day 1 4am: job_m completes
Day 1 4:01am: job_c completes
Day 1 4:02am: job_a runs following completion of job_c
Day 2 3am: job_c starts, sees no status change for job_m within the last 6 hours
Day 2 5am: job_m completes
Day 2 5:01am: job_c completes
Day 2 5:02am: job_a runs following completion of job_c

Is there an Autosys command that can be used to reset the status of job_m in the table? If not, is there a better method of enforcing this dependency than the one outlined above?

A: 

The solution depends on the version of Autosys you are using. If it is R11, the newest version, you can set look back dependencies on job_a to only run if job_c has ran to S within X hours.

In earlier versions you can run a job on the S of job_a that will change the status of job_c to INACTIVE. If job_c is inactive, job_a sees that starting condition as FALSE, but job_c will run the next time its starting conditions are met.

The command is sendevent -E CHANGE_STATUS -s INACTIVE -J job_c. This command has to be ran as the Autosys superuser account. Your Autosys Admins may not allow this. Also best practice is to run sendevent commands on the Autosys Event processor server so that if you are running dual server high availability and the system rolls over to single server mode, the sendevent command works after the roll over.

Example

insert_job: job_a job_type: c
command: do_something
machine: machine1
owner: my_id@machine1
conditions: s(job_c)
date_condition: 1
start_time: 03:00

insert_job: job_c job_type: c
command: do_something_else
machine: machine1
owner: mainframe@machine1
comment: "This is the mainframe job"


insert_job: job_d job_type: c
command: sendevent -E CHANGE_STATUS -s INACTIVE -J job_c
owner: superuser@autosys_server
machine: autosys_server
conditions: s(job_a) and s(job_c)
clmccomas
The mainframe job is not scheduled on Autosys, but by OPC on the mainframe, which sends the job status to be stored in Autosys. Because of this, we weren't able to get sendevent working (we do have the appropriate permissions as it's run on Autosys scheduled boxes regularly).
lins314159