Querying Task Statuses
Function
This interface is used to query the execution status of a task, such as ECS creation, ECS deletion, ECS batch operation, and NIC operation.
After a task, such as creating a BMS or attaching disks, is delivered, job_id is returned, based on which you can query the execution status of the task.
URI
GET /v1/{project_id}/jobs/{job_id}
Table 1 lists the parameters.
Parameter |
Mandatory |
Description |
---|---|---|
project_id |
Yes |
Specifies the project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
job_id |
Yes |
Specifies the task ID. |
Request
Response
- Response parameters
Parameter
Type
Description
status
String
Specifies the task status.
- SUCCESS: The task is successful.
- RUNNING: The task is running.
- FAIL: The task failed.
- INIT: The task is being initialized.
entities
Object
Specifies the task object. For details, see Table 2.
The displayed information varies depending on the task type. For operations related to BMSs, server_id is displayed. For operations related to NICs, nic_id is displayed. If subtasks exist, details about the subtasks are also displayed.
job_id
String
Specifies the task ID.
job_type
String
Specifies the task type. The value can be:
- baremetalBatchCreate: creating BMSs in a batch
- baremetalBatchOperate: changing the power status of BMSs in a batch.
- baremetalAttachVolume: attaching a disk
- baremetalDetachVolume: detaching a disk
begin_time
String
Specifies the time when the job started.
The timestamp format is ISO 8601, for example, 2019-04-25T20:04:47.591Z.
end_time
String
Specifies the time when the job ended.
The timestamp format is ISO 8601, for example, 2019-04-26T20:04:47.591Z.
error_code
String
Specifies the error code returned upon a task execution failure.
fail_reason
String
Specifies the cause of a task execution failure.
message
String
Specifies the message returned when an error occurs.
code
String
Specifies the error code returned when an error occurs.
For details about error codes, see section Status Codes.
Table 2 entities field data structure description Parameter
Type
Description
sub_jobs_total
Integer
Specifies the number of subtasks. If the task has no subtasks, the value of this parameter is 0.
sub_jobs
Array of objects
Specifies the execution information about a subtask. If the task has no subtasks, the value of this parameter is left blank. For details, see Table 3.
Table 3 sub_jobs field data structure description Parameter
Type
Description
status
String
Specifies the task status.
- SUCCESS: The task is successful.
- RUNNING: The task is running.
- FAIL: The task failed.
- INIT: The task is being initialized.
entities
Array of objects
Specifies the task object. The displayed information varies depending on the task type. For operations related to BMSs, server_id is displayed. For operations related to NICs, nic_id is displayed.
For details, see Table 4.
job_id
String
Specifies the task ID.
job_type
String
Specifies the task type. The value can be:
- baremetalSingleCreate: creating a single BMS
- baremetalSingleOperate: changing the power status of a single BMS
begin_time
String
Specifies the time when the job started.
The timestamp format is ISO 8601, for example, 2019-04-25T20:04:47.591Z.
end_time
String
Specifies the time when the job ended.
The timestamp format is ISO 8601, for example, 2019-04-26T20:04:47.591Z.
error_code
String
Specifies the error code returned upon a task execution failure.
fail_reason
String
Specifies the cause of a task execution failure.
message
String
Specifies the message returned when an error occurs.
code
String
Specifies the error code returned when an error occurs.
For details about error codes, see section Status Codes.
- Example response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
{ "status": "SUCCESS", "entities": { "sub_jobs_total": 1, "sub_jobs": [ { "status": "SUCCESS", "entities": { "server_id": "bae51750-0089-41a1-9b18-5c777978ff6d" }, "job_id": "2c9eb2c5544cbf6101544f0635672b60", "job_type": "baremetalSingleCreate", "begin_time": "2019-04-25T20:04:47.591Z", "end_time": "2019-04-25T20:08:21.328Z", "error_code": null, "fail_reason": null } ] }, "job_id": "2c9eb2c5544cbf6101544f0602af2b4f", "job_type": "baremetalBatchCreate", "begin_time": "2019-04-25T20:04:34.604Z", "end_time": "2019-04-25T20:08:41.593Z", "error_code": null, "fail_reason": null }
Returned Values
Returned Values |
Description |
---|---|
200 |
The server has successfully processed the request. |
For details about other returned values, see Status Codes.
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot