Story

Autosys Job Handling

Defining Jobs: Can be done through GUI or Job Instruction Language (JIL)

System Components:

  1. Event server: (Autosys Database)
  2. Event Processor: Heart of Autosys Also called event daemon. Schedules and starts jobs. Instructs the remote agent to perform actions.
  3. Remote Agent: A temporary process start by event processor to perform a specific task on client machine. It starts the commands and sends back the status of the job back to event processor

Types of Jobs:

  1. Command Jobs:Can be a shell script or an executable program.
  2. Box Jobs:is a container of other jobs. And is used to organize and control process flow. If no other starting conditions are specified at the job level, a job within a box will run as soon as the starting conditions for the box are satisfied. If several jobs in a box do not have job-level starting conditions, they will all run in parallel.
  3. File watcher:starts a process that monitors for the existence and size of a specific operating system file. When that file reaches a certain minimum size, and is no longer growing in size, the File Watcher Job completes successfully, indicating that the file has arrived.

Job Definition:

The basic Command Job definition has the following required attributes:

Job Name - The unique job identifier by which a job is referenced.

Command -The UNIX shell script, command, or application program to be executed.

Machine Name- The name of the machine on which the command is to be run.

Starting Conditions -The date/time and/or job dependency conditions necessary for the job to be run.

Example:

            days_of_week: mo, we, fr

            start_times: "10:00, 14:00”

Autorep Commands

1)      Autorep

Syntax : autorep -J job_name [ -d | -q | - r run_number ]

Description : autorep lists a variety of information about jobs

Options       :

-J job_name

 Indicates that a Job Report is desired. To report on all jobs, specify ALL. The %    character may be used in the job name as a wildcard

-d   Indicates a Detail Report is desired.

For a Job Report, all events from the last run of the requested job will be listed.

 -q   Indicates a Query Report is desired, providing the current job or machine definition, in JIL format, as it exists in the AutoSys database.

-r run_num

Indicates a report is desired for a specific job run (run_num). This option can only be used with the -s and -d options. If this option is omitted, or run_num is zero, the most current job run is reported. A minus sign (-) can be used before the run_num value to indicate a relative counter for a past job run, relative to the current run number. For example, the option r -2 would generate a report for the job run two runs back.

STATUS codes

Code

Status

AC

Activated

FA

Failure

IN

Inactive

OH

On hold

OI

on ice

QU

Queue wait

RE

Restart

RU

Running

ST

Starting

SU

Success

TE

Terminated

Examples : 

autorep -J pfvw%box%

autorep -J pfvw_d_cmd_mscifeed_proc_1602

autorep -J pfvw_d_cmd_mscifeed_proc_1602 -d

autorep -J pfvw_d_cmd_mscifeed_proc_1602 -q

autorep -J pfvw_d_cmd_mscifeed_proc_1602 - r -2

 

2)       Job Dependents

Reports information about the dependencies and conditions of a job.

job_depends [-c | -d ] [-J job_name]

Options

-c   Current Condition Status

         Prints out the current state of a job and its job

          dependency conditions (the jobs that are dependent on

          this job).

 -d   Dependencies Only

          Prints out the starting conditions for a job; no indi-

          cation of the current status of the job is provided.

Example :

job_depends -c -J pfvw_d_cmd_mscifeed_proc_1602

 

3)      Sendevent

Sends events to AutoSys for a variety of purposes, including starting or stopping AutoSys jobs, stopping the Event Processor, and putting a job on hold. To issue a sendevent on a job, you must have execute permis-

sion on that job.

Syntax :

sendevent -E event [ -J job_name] [-s   status]

Options :

-E event

Specifies the event to be sent. This option   is required. Any one of the following values may be specified:

 

STARTJOB- Start the job specified in job_name if the starting conditions are satisfied. That is, a STARTJOB event ignores time and date conditions, but it does not ignore dependencies on other jobs.

KILLJOB- Kill the job specified in job_name. The action depends on one of the job types given below:

Command Jobs- Kills the process that is currently running and all the processes that it has spawned; i.e.,the process group.

Box Jobs- Changes the status to TERMINATED. No more jobs within the box will be started. Jobs that are already running will continue to run to completion.

File Watcher Jobs - Kills the File Watcher job and changes the status to TERMINATED.

DELETEJOB- Delete the job specified in job_name from the database. If job_name is a box, deletes the box and all the jobs in the box.

FORCE_STARTJOB- Start the job specified in job_name, regardless of whether the starting conditions are satisfied or not. Because multiple instances of the same job could be started using this command, we recommended you use the FORCE_STARTJOB event only in extreme situations. Do not force start a job in QUE_WAIT state because jobs in QUE_WAIT state are already started and are waiting for machine resources to become available to run.

JOB_ON_ICE- Puts the job specified in job_name on ice. On  Ice is the functional equivalent of deactivating a job definition. For example, the starting conditions for jobs downstream from JobA, which has been put on ice, will evaluate as shown below.

 

Evaluation of Dependent Jobs Conditions

Job Condition              

Will Evaluate to

success (JobA)

TRUE

failure (JobA)

FALSE

terminated (JobA)

FALSE

done (JobA)

TRUE

notrunning (JobA)

TRUE

exitcode 

FALSE

 

While a job status is RUNNING or STARTING, AutoSys will not allow the job be put On Ice.

JOB_OFF_ICE- Takes the job specified in job_name Off Ice. This is like reactivating the job description. Jobs that are taken Off Ice will not start until the next time their starting conditions are met.

JOB_ON_HOLD- Puts the job specified in job_name On Hold. When a job is On Hold, it will not be started. A box will not be considered done if a job within it is ON_HOLD, and downstream dependent jobs will not run. If the job is already STARTING or RUNNING, you cannot put it ON_HOLD.

JOB_OFF_HOLD- Takes the job specified in job_name Off Hold. If the starting conditions are met, the job will be started.

CHANGE_STATUS- Forces a change in the status of the job specified in job_name. Ordinarily this should not be used, since AutoSys manages job state changes internally. If this option is selected, the -s status option must also be selected.

STOP_DEMON- Stops the event demon. This is the only way to stop the Event Processor. However, this does not stop the RDBMS(s).

CHANGE_PRIORITY- Takes the -j job_name and the -q priority arguments. Changes the Job Queue Priority of the job to the priority specified. Queue priority is  the relative priority of all jobs in the queue. The lower the number, the higher the priority; zero means to run the job right away. If the job has not been started, priority is changed for the next run only. If the job has been started, and is in a queue, priority is changed immediately.

-s status

Specifies the status to which the job specified in job_name should be changed. This option is used only when the specified event is CHANGE_STATUS,   which requires this option.

These are the valid statuses: RUNNING, STARTING, SUCCESS, FAILURE, INACTIVE, and TERMINATED.

Changing the status to RUNNING does not cause the job to run. It only changes the system's current notion of the status of the job. Therefore, this option should be used with caution. Changing the state of a box to INACTIVE will recursively cause all the jobs in the box to also be changed to INACTIVE.

Examples :

sendevent -E CHANGE_STATUS -J pfvw_d_cmd_mscifeed_proc_1602 -s INACTIVE

sendevent -E CHANGE_STATUS -J pfvw_d_cmd_mscifeed_proc_1602 -s SUCCESS

sendevent -E JOB_ON_HOLD -J pfvw_d_cmd_mscifeed_proc_1602

sendevent -E JOB_OFF_HOLD -J pfvw_d_cmd_mscifeed_proc_1602

sendevent -E JOB_ON_ICE -J pfvw_d_cmd_mscifeed_proc_1602

sendevent -E JOB_OFF_ICE -J pfvw_d_cmd_mscifeed_proc_1602

sendevent -E KILLJOB -J pfvw_d_cmd_mscifeed_proc_1602

sendevent -E FORCE_STARTJOB -J pfvw_d_cmd_mscifeed_proc_1602

sendevent -E CHANGE_STATUS -J -s TERMINATED

AttachmentSize
AutoSys.doc71.5 KB