Thursday, 17 October 2024

AutoSys Workload Automation: Bulk ON_HOLD Action

 

AutoSys Workload Automation: Bulk ON_HOLD Action

Introduction

AutoSys is a powerful workload automation tool that helps organizations manage and schedule jobs across various platforms. One of the functionalities it offers is the ability to change the status of jobs in bulk. The ON_HOLD status can be particularly useful for managing job dependencies, maintenance windows, or temporarily pausing jobs without deleting them. This article explores the steps and best practices for implementing a bulk ON_HOLD action in AutoSys.

Understanding the ON_HOLD Status

When a job is set to ON_HOLD, it is temporarily suspended. This means that the job will not run until it is explicitly released from this state. This feature is essential for system administrators and DevOps teams who need to control job execution during maintenance periods, changes in business processes, or when dependencies are not met.

Use Cases for Bulk ON_HOLD Action

  1. System Maintenance: During system upgrades or maintenance activities, jobs may need to be paused to avoid conflicts or performance issues.
  2. Dependency Management: If a dependent job fails or is delayed, putting related jobs ON_HOLD can prevent them from running and encountering errors.
  3. Resource Allocation: When resources are limited, it may be necessary to pause non-critical jobs to free up resources for priority tasks.

Steps to Execute Bulk ON_HOLD Action

Executing a bulk ON_HOLD action can be done through the AutoSys command-line interface (CLI) or using JIL (Job Information Language). Below are the methods to implement this action.

Method 1: Using JIL Scripts

JIL scripts allow for programmatic control of jobs in AutoSys. Here’s how to bulk set jobs to ON_HOLD using a JIL script:

  1. Create a JIL Script: Create a JIL file (e.g., hold_jobs.jil) with the following syntax:

    jil
    insert_job: job_name_1 job_type: c machine: machine_name owner: owner_name permission: gx,wx date_conditions: n condition: s(job_name_2) action: hold

    Repeat the insert_job block for each job you wish to put ON_HOLD. Make sure to replace job_name_1, machine_name, and owner_name with the appropriate values.

  2. Load the JIL Script: Use the following command to load the JIL script into AutoSys:

    bash
    jil < hold_jobs.jil
  3. Verify Job Status: After loading the JIL, verify that the jobs have been placed ON_HOLD using the following command:

    bash
    autorep -J job_name_1

Method 2: Using Command Line Interface

You can also set jobs to ON_HOLD using the AutoSys command line. Here’s a simplified approach:

  1. Identify Jobs: Use the autorep command to identify the jobs that need to be put ON_HOLD:

    bash
    autorep -J job_name_pattern
  2. Put Jobs ON_HOLD: Use the sendevent command to change the status of jobs. The following command can be executed for each job:

    bash
    sendevent -E ON_HOLD -J job_name

    For bulk action, you can script this command in a shell script that loops through a list of job names.

Example Shell Script for Bulk ON_HOLD

Here’s a basic shell script example to put multiple jobs ON_HOLD:

bash
#!/bin/bash # List of jobs to put ON_HOLD jobs=("job_name_1" "job_name_2" "job_name_3") # Loop through each job and set to ON_HOLD for job in "${jobs[@]}"; do sendevent -E ON_HOLD -J "$job" echo "Job $job is now ON_HOLD." done

Best Practices

  • Document Changes: Always document changes made to job statuses for auditing and troubleshooting purposes.
  • Monitor Job Dependencies: After putting jobs ON_HOLD, monitor the status of dependent jobs to avoid unwanted delays in job execution.
  • Regular Reviews: Regularly review ON_HOLD jobs to determine if they should be released or permanently removed.

Conclusion

The bulk ON_HOLD action in AutoSys provides significant control over job scheduling and execution. By using JIL scripts or command-line operations, administrators can efficiently manage job states in response to changing business needs or system conditions. Implementing these practices can help maintain operational efficiency and reduce errors in job execution.

No comments:

Post a Comment

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