Autosys failing a job if the dependent job doesnot complete/success before a particular time - autosys

Autosys job retail_daily_job runs at 8:00 GMT. It is dependent on success of runner_daily_job.
Condition is If runner_daily_job is not success by 7:30 GMT, then status of retail_daily_job should be made to fail.i.e retail_daily_job should fail.
How to do this in autosys? what is the command to be used in jil file?
Thanks and Regards,
Simi

Not easy to do. Autosys doesn't support a negation condition for example NOT SUCCESS. I would try creating a job that would run at 0730 that would change the status of the retail_daily_job job to FAILURE if the runner_daily_job is FAILURE or TERMINATED or RUNNING.

Agree with clmccomas, not easy due to lack of certain operators.
We get around this by having our jobs create "status" files that other jobs can reference if need be. I've found that trying to parse/depend on output from autorep can be troublesome but is also doable. So we usually have a job status directory and create dated folders
/yyyymmdd/jobname_
The your command job would check the existing status file that's there. Often you may only want to write the status on completion.
The suggestion of having a job to alter statuses might work out well too.

Itseems like you are making the situation a bit complex.
If you want retail_daily_job to run based on the success of runner_daily_job, then simply put the condition as success(runner_daily_job).
So as you said if runner_daily_job is not success by 7:30 GMT (which means failure), then automatically the status of retail_daily_job will become to fail.
Hope this clarifies your question.

Related

Is there a way to get the time dependency as a variable in Autosys similar to AUTO_JOB_NAME?

I need to somehow get the start_time for the current job run dynamically from Autosys. It would be passed as an argument into our Python script. Current time isn’t good enough, it has to be the time for which the job is currently triggered which was supplied in the Jil. I haven’t found anything other than $AUTO_JOB_NAME that would get any jil attributes.
command: python3 /path/path/script.py —-job_id ${AUTO_JOB_NAME} —-conf file.conf
I want to add something like:
command: python3 /path/path/script.py —-job_id ${AUTO_JOB_NAME} —-conf file.conf —-time ${CURRENT_START_TIME}
And no current Autosys time is not what I’m looking for.
I already looked through documentation and it seems the only values defined in the runtime environment for a job are $AUTORUN and $AUTO_JOB_NAME
Why don't we use current time in the remote agent server where the Python script is hosted. It would be the same as tge job start time yoy are looking for. May differ my milliseconds, but you may experiment on that

Autosys Can a job run multiple instance at the same time

I am trying to understand autosys job. Suppose I have Job A that runs every 15 minutes. Suppose for some reason if Job A takes more than 15 minutes, will another instance of it run or it will wait for the job to finish before running another instance?
In my experience, if the previous job run is still running, another instance will not run if the next scheduled time comes. The next time the job runs is when the previous run is finished and the next scheduled time comes.
Another user also experienced this according to this answer.
I did not find any AutoSys documentation that officially confirms what happens in this situation, but I guess the best way to find out is to test it on your AutoSys instance.
I have experienced this first hand and can confirm that there won't be two instances in the mentioned scenario. The job will wait on the previous run to complete and will immediately kick off the next instance if the time condition is met before the previous completes.
But this will be the case only when the job is in running state, if the job is in any other state it will kick off based on the given start_time condition.

How to reschedule a coordinator job in OOZIE without restarting the job?

When i changed the start time of a coordinator job in job.properties in oozie, the job is not taking the changed time, instead its running in the old scheduled time.
Old job.properties:
startMinute=08
startTime=${startDate}T${startHour}:${startMinute}Z
New job.properties:
startMinute=07
startTime=${startDate}T${startHour}:${startMinute}Z
The job is not running at the changed time:07th minute,its running at 08th minute in every hour.
Please can you let me know the solution, how i can make the job pickup the updated properties(changed timing) without restarting or killing the job.
You can't really change the timing of the co-ordinator via any methods given by Oozie(v3.3.2) . When you submit a job the contents properties are stored in the database whereas the actual workflow is in the HDFS.
Everytime you execute the co-ordinator it is necessary to have the workflow in the path specified in properties during job submission but the properties file is not needed. What I mean to imply is the properties file does not come into the picture after submitting the job.
One hack is to update the time directly in the database using SQL query.But I am not sure about the implications of it.The property might become inconsistent across the database.
You have to kill the job and resubmit a new one.
Note: oozie provides a way to change the concurrency,endtime and pausetime as specified in the official docs.

Autosys Job Statistics from 3 months

I want to make a report of start and end times of a Autosys job from last three months.
How can i get it. Do i need to check archived history or logs?
If yes, please lemme know the details.
TIA
Autosys internally uses Oracle or Sybase database. As long as the data is available in the DB you can fetch it using autorep command. To get past run time use -r handle.
For example: autorep -J JobA -r -30
The above will give you last 30th run time for the job.
However, due to performance bottleneck that may arise due to historical data in the DBs the DBAs generally purge the data after a while. I have seen period of 1 day to 7 days based on the number of the jobs and database instance power.
Other approximate way would to be use the log files created by autosys if the option stdout is specified with unique filenames.
For example: you can have the attribute as std_out: $JOB_NAME.out.date +%m.%s
In this case the log file will be created as soon as the job starts which you can get from the filename using text function on unix,etc.
For the end-time, you can use the last modified time - this is where the approximate part comes in as the time would depend if your job had an echo to the log file or not. It can either be close or far based on the command of the script.
This method will not let you know the times for the box jobs as they never have a log attribute, for that you can depend on the first job in the box.

Autosys job to start after another job with any status

I need to run job after another job with whatever status the previous job finished.
So far I use
condition: success(x) or failure(x)
can it be written for any status?
I dont know the exact version of the autosys. But not the very latest.
condition: done(x)

Resources