Stopping or Deleting Tasks in Batches
Function
This API is used to stop tasks in batches or delete real-time migration, real-time synchronization, and real-time DR tasks.
After a yearly/monthly task is started, unsubscribe from the order and then call this API to delete the task. For details, see Unsubscribing from a Yearly/Monthly Task.
Constraints
- Only tasks in the CREATE_FAILED, RELEASE_RESOURCE_COMPLETE, or RELEASE_CHILD_TRANSFER_COMPLETE state can be deleted. To delete a task in other states, stop the task first.
- The parent task can call the API only in the dual-active DR scenario.
URI
DELETE /v3/{project_id}/jobs/batch-jobs
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID of a tenant in a region For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
The content type. The default value is application/json. |
X-Auth-Token |
Yes |
String |
User token obtained from IAM. |
X-Language |
No |
String |
Request language type Default value: en-us Values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
jobs |
Yes |
Array of objects |
List of requests for stopping or deleting tasks in batches. For details, see Table 4. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
delete_type |
Yes |
String |
The value can be terminate, force_terminate, or delete. terminate indicates that the migration task is stopped, force_terminate indicates that the migration task is forcibly stopped, and delete indicates that the migration task is deleted. Values:
|
job_id |
Yes |
String |
Task ID. |
is_show_breakpoint_position |
No |
Boolean |
Specifies whether to display breakpoint information when a real-time migration, synchronization, or DR task with MySQL serving as the source is complete. The default value is null, indicating that the breakpoint information is not displayed. |
Response Parameters
Status code: 202
Parameter |
Type |
Description |
---|---|---|
results |
Array of objects |
Response body set for stopping or deleting tasks in batches. For details, see Table 6. |
count |
Integer |
Total number. |
Example Request
- Stopping two specified tasks
https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-jobs { "jobs" : [ { "delete_type" : "terminate", "job_id" : "4c6ac8c0-2f51-426a-97b2-cb2c668jb201" }, { "delete_type" : "terminate", "job_id" : "6211d20d-0006-41da-836e-db3301ajb20b" } ] }
- Deleting a specified task
https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-jobs { "jobs" : [ { "delete_type" : "delete", "job_id" : "140b5236-88ad-43c8-811c-1268453jb101" } ] }
- Displaying breakpoint information when a task is complete
https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-jobs { "jobs" : [{ "delete_type" : "terminate", "job_id" : "6211d20d-0006-41da-836e-db3301ajb20b", "is_show_breakpoint_position" : true } ] }
Example Response
Status code: 202
Accepted
- Example response for stopping a task
{ "count" : 2, "results" : [ { "id" : "4c6ac8c0-2f51-426a-97b2-cb2c668jb201", "status" : "success" }, { "id" : "6211d20d-0006-41da-836e-db3301ajb20b", "status" : "failed", "error_code" : "DRS.M01504", "error_msg" : "Another operation is being performed on the migration task or the migration task is abnormal. Try again later." } ] }
- Example response for deleting a task
{ "count" : 1, "results" : [ { "id" : "140b5236-88ad-43c8-811c-1268453jb101", "status" : "success" } ] }
Status Code
Status Code |
Description |
---|---|
202 |
Accepted |
400 |
Bad Request |
Error Code
For details, see Error Code.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.