Saturday 28 September 2024

How to Put a Job on Ice in AutoSys

 ### 


In AutoSys, there are various job statuses that determine the current state of a job, and one of the most important statuses is "Ice." When a job is placed on Ice, it does not run as per its scheduled time but retains its dependencies and remains in the AutoSys job database for future use. This is helpful when you want to temporarily disable a job without affecting its downstream dependencies.


In this article, we will explore how to put a job on Ice in AutoSys, including the use of command-line tools and the JIL (Job Information Language) script.


#### What Does "On Ice" Mean in AutoSys?


When a job is in the "Ice" state:

- The job is temporarily disabled and does not run, even if its conditions are met.

- Jobs downstream of an "Ice" job will not run unless the job is explicitly removed from the Ice status.

- The Ice status is retained across server restarts, unlike the "On Hold" status, which does not persist after an AutoSys server restart.


#### Why Put a Job on Ice?


You may want to put a job on Ice in situations such as:

- Temporarily stopping a job for testing purposes without affecting the job schedule or its downstream dependencies.

- Preventing a job from running during maintenance windows.

- Disabling jobs during non-critical times or for holiday schedules.


#### Steps to Put a Job on Ice


##### 1. Using the `sendevent` Command


The `sendevent` command is used to change the status of jobs in AutoSys. To put a job on Ice, the command is as follows:


```bash

sendevent -E JOB_ON_ICE -J <job_name>

```


Here’s a breakdown of the command:

- `sendevent`: The AutoSys command to send events to the job.

- `-E JOB_ON_ICE`: Specifies the event type, which in this case is to put the job on Ice.

- `-J <job_name>`: Specifies the name of the job you want to place on Ice.


##### Example:


```bash

sendevent -E JOB_ON_ICE -J my_job

```


This command will put the job `my_job` on Ice. The job will not run again until you manually remove it from the Ice status.


##### 2. Using a JIL Script


You can also define or modify a job to place it on Ice using a JIL (Job Information Language) script. If you want to place a job on Ice at the time of job creation, add the `job_on_ice` attribute to the job definition:


```jil

insert_job: my_job

job_type: c

command: /path/to/script.sh

machine: my_machine

job_on_ice: 1

```


In this example, the `job_on_ice: 1` attribute ensures that the job is created in the Ice state.


##### 3. Removing a Job from Ice


To remove a job from the Ice state, use the following `sendevent` command:


```bash

sendevent -E JOB_OFF_ICE -J <job_name>

```


##### Example:


```bash

sendevent -E JOB_OFF_ICE -J my_job

```


Once this command is executed, the job will return to its scheduled state and will run according to its defined schedule or conditions.


#### Difference Between "On Ice" and "On Hold"


- **On Ice**: Jobs put on Ice are essentially deactivated but maintain their dependencies and downstream jobs won’t run until the job is taken off Ice. The Ice status persists across server restarts.

- **On Hold**: Jobs placed On Hold do not run, but the status does not persist after an AutoSys server restart. After a restart, jobs on hold will return to their default status.


#### When to Use "On Ice" vs "On Hold"


- Use **On Ice** when you want the job to remain inactive until manually activated and you want the status to persist across server restarts.

- Use **On Hold** for temporary suspensions where the job should resume automatically after server restarts or system changes.


#### Conclusion


Putting a job on Ice in AutoSys is a straightforward process that can be done using the `sendevent` command or by modifying the job definition using JIL. The Ice status is a powerful tool that allows administrators to disable jobs without affecting their dependencies and without losing the job’s configuration.


By understanding how and when to use Ice, you can better manage your AutoSys jobs, control job executions, and ensure smooth operations during maintenance windows or testing phases.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.