Mastering Automic: How to Configure “Continue on Error” in JobStep after Script Call with Non-Zero Return Code
Image by Lajon - hkhazo.biz.id

Mastering Automic: How to Configure “Continue on Error” in JobStep after Script Call with Non-Zero Return Code

Posted on

Automic, formerly known as UC4, is a powerful automation tool that streamlines business processes and reduces manual interventions. However, when working with scripts in Automic JobSteps, you might encounter scenarios where the script returns a non-zero exit code, indicating an error. This article will guide you through configuring the “Continue on Error” feature in Automic JobStep, allowing your workflow to proceed even when a script call encounters issues.

Understanding Automic JobSteps and Script Calls

In Automic, a JobStep represents a single action or task within a larger workflow. One common type of JobStep is a script call, which executes an external script or program. When a script call returns a non-zero exit code, it typically indicates an error or unexpected behavior. By default, Automic will terminate the JobStep and report an error when this occurs.

The Problem: Script Calls with Non-Zero Return Codes

Imagine a scenario where you have a critical business process that involves executing a script to perform a specific task. The script might return a non-zero exit code due to various reasons, such as:

  • Temporary network connectivity issues
  • Minor configuration errors
  • Expected exceptions or warnings

In such cases, terminating the JobStep and reporting an error might not be the desired behavior. You might want the workflow to continue executing, ignoring the error and proceeding with the next steps. This is where the “Continue on Error” feature comes in.

Configuring “Continue on Error” in Automic JobStep

To configure the “Continue on Error” feature, follow these step-by-step instructions:

  1. Open the Automic Web Interface and navigate to the JobStep that contains the script call.

  2. Click on the “Edit” button to open the JobStep properties.

  3. In the “Advanced” tab, scroll down to the “Error Handling” section.

  4. Check the box next to “Continue on Error” to enable this feature.


    Note: Make sure to review the Automic documentation for the specific version you're using, as the option might be located in a different section.

  5. In the “Error Handling” section, you can also specify a “Maximum retry count” and a “Retry interval” to control how many times the script should be retried before considering it a failure.

Understanding the Consequences of “Continue on Error”

When you enable “Continue on Error,” Automic will ignore the non-zero return code from the script call and proceed with the next JobStep. This means that:

  • The workflow will continue executing, potentially hiding underlying issues.
  • Automic will not report an error or raise an alert, unless you specifically configure an error handler.
  • You should carefully monitor the JobStep execution and script output to detect potential issues.

Best Practices for Using “Continue on Error”

To ensure that you’re using the “Continue on Error” feature effectively and responsibly, follow these best practices:

  1. Use “Continue on Error” judiciously and only when necessary, as it can mask underlying issues.

  2. Implement additional error handling mechanisms, such as logging or notification, to detect and respond to errors.

  3. Regularly review JobStep execution logs and script output to identify potential problems.

  4. Test and validate the script call and JobStep configuration to ensure that it behaves as expected.

Example Scenario: Using “Continue on Error” in a Real-World Context

Suppose you have a business process that involves sending daily reports to stakeholders via email. The report generation script, executed as a JobStep, might occasionally return a non-zero exit code due to temporary network connectivity issues or minor configuration errors.

  +-------------------------------+
  |        JobStep: Send Daily Report      |
  +-------------------------------+
  |  Script Call: generate_report.sh  |
  |  (returns non-zero exit code     |
  |   occasionally due to network issues)  |
  +-------------------------------+
  |  Continue on Error: Enabled      |
  |  Maximum Retry Count: 3          |
  |  Retry Interval: 5 minutes       |
  +-------------------------------+
  |  Next JobStep: Send Email        |
  +-------------------------------+

In this scenario, enabling “Continue on Error” allows the workflow to proceed with sending the email, even if the report generation script returns a non-zero exit code. The maximum retry count and retry interval ensure that the script is retried three times, with a 5-minute interval between retries, before considering it a failure.

Conclusion

By mastering the “Continue on Error” feature in Automic JobSteps, you can create more resilient and adaptable workflows that can handle occasional script errors. Remember to use this feature judiciously, and implement additional error handling mechanisms to ensure that your workflows remain reliable and efficient. With careful planning and configuration, you can create Automic workflows that seamlessly integrate with your business processes, even in the face of errors.

Keyword Description
Continue on Error A feature in Automic JobSteps that allows the workflow to proceed even when a script call returns a non-zero exit code.
Script Call A type of JobStep that executes an external script or program.
Error Handling A section in the Automic JobStep properties that allows configuring error behavior, including the “Continue on Error” feature.

By understanding and leveraging the “Continue on Error” feature, you can take your Automic workflows to the next level, ensuring that your business processes remain efficient, reliable, and adaptable in the face of errors.

Frequently Asked Question

Get the answers to your burning questions about “Continue on Error in Automic JobStep after script call with non-zero return code” below!

What happens if a script in an Automic JobStep returns a non-zero return code?

If a script in an Automic JobStep returns a non-zero return code, the JobStep will terminate by default, and the job will fail. However, if you want the job to continue despite the error, you can configure the “Continue on Error” option. This allows the job to proceed to the next step, even if the previous step failed.

How do I configure the “Continue on Error” option in Automic?

To configure the “Continue on Error” option, you need to add a specific attribute to the JobStep that calls the script. You can do this by editing the JobStep properties and adding the “CONTINUE_ON_ERROR” attribute with a value of “TRUE”. Alternatively, you can also use the Automic Workload Automation (AWA) API to set this attribute programmatically.

Will the “Continue on Error” option affect the overall job status?

Even if you configure the “Continue on Error” option, the overall job status will still reflect the error. The job will not be marked as “successful” if one of its steps failed, even if the job continued to run. However, the subsequent steps will be executed, allowing you to perform error handling or cleanup tasks.

Can I use the “Continue on Error” option for multiple scripts in a single JobStep?

Yes, you can use the “Continue on Error” option for multiple scripts in a single JobStep. Simply add the “CONTINUE_ON_ERROR” attribute to the JobStep, and it will apply to all scripts within that step. If any of the scripts return a non-zero return code, the job will continue to the next step.

Are there any best practices for using the “Continue on Error” option in Automic?

Yes, it’s essential to use the “Continue on Error” option judiciously. Only use it when you have a valid reason to continue the job despite an error, such as for error handling or cleanup tasks. Also, make sure to carefully review the job logs to identify and address the root cause of the error. Finally, consider implementing additional error handling mechanisms, such as sending notifications or running specialized error-handling scripts.

Leave a Reply

Your email address will not be published. Required fields are marked *