APEX Job Management APIs – Pause and Resume Operations
Wed, 28 Feb 2024 19:18:53 -0000
|Read Time: 0 minutes
Welcome back to our APEX Job Management blog series! In our previous post, we explored the query APIs for the job - “APEX Job Management APIs – Get Job Instances”.
Today, we will delve into two crucial operations “Pause” and “Resume”. Let’s get started.
Prerequisites:
1. APEX API access key and secret has been generated and is available. You can check out the “Creating & Managing Dell APEX API access key Id and secret” blog addressing how to create an APEX API access key & secret.
2. You have a Dell Identity (DI) token. You can take a look at the “Requesting Dell Identity JSON web token” blog for steps on requesting a DI token.
Pause Operation
When you encounter a situation where you need to temporarily halt the execution of a job, the “Pause” operation comes to the rescue. Whether it’s to address an issue, perform maintenance, or simply pause a long-running task, this feature ensures that the job remains in a suspended state until you’re ready to resume.
How does Pausing Work?
1. Identify the Job: First, you’ll need to identify the specific job you want to pause. This could be a job that is currently RUNNING (actively executing).
2. Invoke the Pause Operation: Using the appropriate APEX APIs, invoke the “Pause” operation for the selected job. This action will temporarily suspend its execution.
3. The Job Remains Paused: Once paused, the job will remain in this state until the “Resume” operation is performed. During this time, no further progress occurs, and the job waits patiently for further instructions.
URL:
Endpoint:
/rest/v1/jobs/{id}/pause
Replace {id} with actual job ID.
Example:
curl --location "https://apex.apis.dell.com/apex/rest/v1/jobs/123456789/pause \
--header "Accept: application/json" \
--header "Authorization: Bearer {DI Token}" \
--header "Content-Type: application/json"
Replace {DI Token} with DI token.
The response will be something like this:
{
"id":"123456789",
"name":"My job",
"state":"PAUSING",
"create_time":"2024-01-30T23:38:52.475+00:00",
"start_time":"2024-01-30T23:38:52.475+00:00",
"end_time":"2024-01-30T23:41:45.087+00:00",
"progress":0,
.........
}
Documentation:
API details can be found here.
Resume Operation
When a job is in a PAUSED state, it means its execution has been temporarily halted. Perhaps you need to address an issue, perform maintenance, or simply pause a long-running task. Now, you’re ready to get things moving again. The “Resume” operation allows you to kickstart the job’s execution from where it left off.
How does Pausing Work?
1. Identify the Paused Job: First, you’ll need to identify the specific job that is currently in a PAUSED state. Retrieve its details, including the job ID.
2. Invoke the Resume Operation: Using the appropriate APEX APIs, invoke the “Resume” operation for the selected job. This action signals the job to continue its execution.
3. Job Progresses: Once resumed, the job will pick up where it left off.
URL:
Endpoint:
/rest/v1/jobs/{id}/resume
Replace {id} with actual job ID.
Example:
curl --location "https://apex.apis.dell.com/apex/rest/v1/jobs/123456789/resume \
--header "Accept: application/json" \
--header "Authorization: Bearer {DI Token}" \
--header "Content-Type: application/json"
Replace {DI Token} with DI token.
The response will be something like this:
{
"id":"123456789",
"name":"My job",
"state":"RESUMING",
"create_time":"2024-01-30T23:38:52.475+00:00",
"start_time":"2024-01-30T23:38:52.475+00:00",
"end_time":"2024-01-30T23:41:45.087+00:00",
"progress":0,
.........
}
Documentation:
API details can be found here.
Authors:
Ratnesh Yadav
Roopa Avula