Java / Autosys Interview questions
AutoSys is an automated job control system for scheduling, monitoring, and reporting jobs. The jobs reside on an Autosys configured machine attached to a network.
Autosys is a job management and scheduling tool and widely used in businesses on UNIX or Linux based environment, even in windows environment. Autosys is used to start/schedule Java process, takes backup of log files, killJava process, cleaning and purging logs, database, etc.
There are 2 methods to create job definitions:
- Using the AutoSys Graphical User Interface (GUI).Through AutoSys GUI, attributes can be set to describe where, when, and how a job should be run.
- Using the AutoSys Job Information Language (JIL) executed through a command-line interface.
Autosys JIL (Job Information Language) is used for creating Autosys job definitions.
JIL is a specification/scripting language which has its own commands to describe where, when, and how a job should be run.
insert_job: PROD_BATCH_SYNC job_type: c description: Run Sync job machine: example-prod.javapedia.net owner: admin@example-prod.javapedia.net command: /apps/script/start_process.sh application:EXAMPLE_APP permission: gx,wx date_conditions: 1 days_of_week: all start_times: "00:02" run_window: "00:02-23:58" alarm_if_fail: 1 max_exit_success: 1 std_out_file: /apps/control/logs/$AUTO_JOB_NAME.out std_err_file: /apps/control/logs/$AUTO_JOB_NAME.err
Following are the different Autosys job types.
Command job: An AutoSys command job is a single command or executable that executes a windows batch file (*.bat), or Unix script/shell script (*.sh).
AutoSys File Watcher job: The AutoSys file watcher job will watch for the arrival of a particular file/new file.
Box: AutoSys box jobs are containers that consists of other jobs (including other boxes), The box job can be used to control and organize process flow. An boxes can be put another boxes.
An instance refers to the licensed version of Unicenter AutoSys JM and at least one client machine running a unique Remote Agent.
In the realtime environment, the operation is likely to have many Remote Agents communicating concurrently with the same database. Any status changes or service requests posted to the database are called Events.
delete_job command is used to delete the job.
Syntax:
delete_job: job_name
AutoSys consist of 3-tier architecture; there are 3 main components of this system, Event Server, Agent Server, and an Event Processor.
Event server is a database containing the job definitions and events.
Agent server aka Remote Agent is the client component of Autosys and will execute the command as defined and write the result back to Event Server.
Event Processor is the daemon process which reads from the event server and sends job stream to the Remote agent.
Shadow Processor is another daemon process running on the server which takes over from the Event Processor if it is interrupted.
3rd machine acts as an Autosys Remote agent that does the "tie-breaker" job if the Event process and Shadow process lost connectivity with each other.
Simple, easy to create jobs.
Autosys provides a user-friendly interface, which makes it easy to create jobs, schedule/manage.
Autosys automatically triggers an alarm when the job fails which acts as a notification so the experts can look into it on time.
AutoSys provides extensive scheduling functionality.
One job can depend upon another job and can execute, depending upon, success and failure of the other job.
A Box job is a container of other jobs. It can control the inner jobs when and how they should run. If a box job is started, it will start the inner jobs automatically.
Generally, the jobs which do similar operations or generic functions will be grouped together under a box job. We can set the start time and run calendars for a box job to control the execution.
insert_job: box_a job_type: b
STARTING (ST), the job is initiated/starting.
RUNNING (RU), the job is executing or running status. For a command or file watcher job, the process will be running on the remote machine, In case of box job, jobs inside the box may be initiated (given that running condition matches).
SUCCESS (SU), the job execution is completed and it is successful. The job exited with an exit code equal to or less than 0 (Zero) as code "0" is considered as "SUCCESS".
FAILURE (FA) , job exited with an exit code greater than 0 (Zero). Any number greater than zero is interpreted as "FAILURE". Autosys issues an alarm if a job fails.
TERMINATED (TE) , the job terminated while it was in the RUNNING state. A job can be terminated if a user sends a KILLJOB event or defined to terminate if the box is failed. A job may also be terminated if it has exceeded the maximum run time or if it was killed from the command line through UNIX kill command. Autosys issues an alarm if a job is terminated.
INACTIVE (IN) , the job is not processing/running yet. Possibly the job has never been run.
ACTIVATED (AC) , the top-level box job is in RUNNING state, but the job itself has not started yet.
RESTART (RE) , the job was unable to start due to hardware or application problems and has been scheduled to restart.
QUE-WAIT (QU) , the job is about to start given conditions met, but there are not enough machine resources available.
ON_HOLD (OH) , this job is on hold and will not be run until it receives the JOB_OFF_HOLD event.
ON_ICE (OI) , this job is excluded from all conditions to START, but is still defined to Autosys. Operationally, this condition is like deactivating the job. It will remain on ice until it receives the JOB_OFF_ICE event.
Autosys jobs are stored in the Event Server.
autostatus -j job_name
CA Workload Automation is a business process automation solution that helps businesses streamline processes related to resource handling, job scheduling, SLA management, and more from within a unified platform.
User can kill a process or job using the following command:
send event -E KILLJOB -j <job name>
The autorep command is a client component utility that generates reports about objects such as jobs, machines, and global variables that are currently defined in the database. The autorep command retrieves data from the database to formulate the reports.
This example generates a summary report for a run of the "Nightly_Batch" box job:
autorep -J Nightly_Batch
Use the following command to check the Autosys version.
cybAgent -v
You can define a File Watcher job to start a process that monitors for the existence and size of a specific file. When that file reaches the specified minimum size and is no longer growing in size, the File Watcher job completes successfully, indicating that the file has arrived.
When an ON_HOLD job is put off hold, it runs, if it's starting conditions are satisfied, while an ON ICE job will not run, after putting into OFF ICE, even if it's starting conditions are met. It will only run, when it's starting condition will reoccur.
For example, if you have a job which starts your Batch Job at 5.00 A.M., which was ON_HOLD, it will run as soon as you make OFF_HOLD and starting condition met, while in the case of ON ICE, it will only run on next day.
Another difference is that all dependent jobs of an ON_ICE job will execute as though ON_ICE job was succeeded while all dependent jobs of an ON_HOLD job will not run until that job is put on OFF hold.
The run_calendar attribute identifies a custom calendar to use to determine the days of the week on which to run the job you are defining. You can use a standard calendar or an extended calendar as the run calendar.
The eventor command starts the scheduler (aka, the event demon) on UNIX. The eventor runs in the background by default and performs the following tasks:
- Confirms that another scheduler of the same instance is not running on the same machine (as determined by the $AUTOSERV variable).
- Writes scheduler log information from $AUTOUSER/out/event_demon.$AUTOSERV to standard output using the astail command.
sendevent -E OFF_ICE -J "Job Name Here" sendevent -E ON_ICE -J "Job Name Here"
The autocal_asc command provides a text-based command-line mechanism that lets you manage calendar definitions. Calendars let you customize job schedules.