Post4

How to Build & Run Workflow with Control-M Automation API

Posted by Rohit Bajpai

Hi readers, we are back with another blog on Control-M Automation. We hope you have already read our previous blog, which gave an overview of Control-M Automation API. In this blog, we’ll try to take the things to the next level by describing how we can build and run workflows with Control-M Automation API.

Let’s get started!

Use of BUILD & RUN API Service

The Control-M Automation API enables us to automate and schedule workflows via Control-M capabilities. Majorly, there are two types of services (Build & Run) available in the API, both of which are available as CLI (Command Line Interface) or as REST API commands. These defined services can build job definitions & run through pre-defined instructions.

Build Service

The build service can compile job definitions and verify that they are feasible for Control-M environment. This is similar to Jenkins build creation, which is performed in the DevOps method. Build can handle definition files in .json, .zip and tar.gz format. It will also validate if the file definition is valid & error-free.

Creating Build via CLI Method

Below is the command line syntax, which we can use to create a build through CLI.

Where:

<definitionsFile> is the file or archive with the code for jobs. The valid format for the definitionsFile are .json, .zip, and .tar.gz.

[deployDescriptorFile] is an optional file with a set of rules to apply over the definationsFile.

Creating Build via REST API Method

For the REST API method, we’ll first use the POST/ session/ login request to obtain a login token. This token status is valid for only 30 Minutes. The credentials are processed in the request body in JSON format. POST syntax looks like the following:

Upon establishing a token, we can see the following message:

Now, we can use the curl call method to create the build.

Another method to use build command is with Python.

Run Service

Once we have the build command in place, we’ll need run service to execute build.

In Control-M Workload Automation, there are many functionalities to execute a job, such as run, rerun, kill, run now, hold, delete, undelete, SetToOk, etc. We can perform a similar action through Control-M API run service.

The run service allows us to view job output, logs, and perform job actions. We can also use it to manage resource & events.

The run command is used to run jobs on the Control-M environment, while returned runid helps in checking the job status.

Here’s what a typical command and response looks like, where build service takes place as part of the run service.

CLI Syntax for Run Service

Where:

<jobsDefinitionsFile> is the file or archive with the code for jobs and the valid format for the file is .json.

[deployDescriptorFile] is an optional file with a set of rules to apply over the definationsFile.

REST API for Run Service

Resource Management

In Control-M, we use resource management to handle resource utilization at the infrastructure & application level.

A quantitative resource is the maximum number of resources that are available for jobs. It is difficult to run jobs that require a quantitative resource unless there are enough resources available to execute the job.

CLI Syntax

Where:

<ctm> is the name of Control-M/ Server (Not EM server name)

<name> is the name of the resource

<max> is the maximum number of resources available to execute the job

REST API Syntax

We can perform the same action via REST API.

Final Words

Control-M Automation API provides REST APIs and CLIs to automate workflow as a code by building more functionality and management features into applications when they are created. It gives us the ease of coding less & standardized automation for running, scheduling, and managing batch applications during the entire software development lifecycle (SDLC) as Control-M Automation API supports all latest tools in the delivery model.

This is it from our side, let us know your thoughts in the comments below.

Until next time!

 

Reference for most of the codes: https://docs.bmc.com/docs/automation-api/918/services-783053199.html

Related Posts

  • Control-M Automation API in a NutshellControl-M Automation API in a Nutshell

    Automation is taking over the world in a big way. Organizations across industry verticals are constantly exploring ways to improve business performance at lower operational cost. The idea is to…

  • An Overview of CA Workload Automation AEAn Overview of CA Workload Automation AE

    CA Workload Automation AE (Autosys Edition) is an industry-leading robust workload automation system, which provides enterprise-wide unparalleled reliability to support business-critical applications. It is designed to support distributed environments and…

  • Why Migrate From HP QC to JIRA (Zephyr)?Why Migrate From HP QC to JIRA (Zephyr)?

    Many experts have pointed out that HP QC (Quality Center) – a comprehensive test management tool – isn’t a healthy option anymore. Popularly known as HP QC 10.0, it poses…

  • HDFS on Mesos Installation

    HDFS on Mesos Installation Mesos cluster optimize the resources and bring the whole data-center at one platform where all the resources can be managed efficiently. Setting up mesos cluster with…

  • Hadoop Cluster Verification (HCV)Hadoop Cluster Verification (HCV)

    Verification scripts basically composed of idea to run a smoke test against any Hadoop component using shell script. HCV is a set of artifacts developed to verify successful implementation of…

  • DevOps is more than DEV + OPSDevOps is more than DEV + OPS

    Initially, when I heard about DevOps around 5 years back, I understood that we were trying to remove barriers between teams, which were created based on phases in traditional development…

Leave a Reply

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