Querying a System Task
Function
This API is used to query details about asynchronous tasks.
URI
- Parameter description
Table 1 URI parameter description Parameter
Mandatory
Type
Description
project_id
Yes
String
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.
task_id
Yes
String
ID of the task.
Request Message
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| workspace | No | String | Workspace ID.
|
Response Message
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | Yes | String | ID of the task. |
| name | Yes | String | Name of the task. |
| startTime | Yes | Long | Time when the task starts to run. |
| endTime | No | Long | Time when the task stops to run. |
| lastUpdate | Yes | Long | Time when the task is updated. |
| status | Yes | String | Task status. The value can be:
|
| message | No | String | Task information. |
| subtasks | No | List<SubTask> | Subtask. For details, see Table 4. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | Yes | String | ID of the subtask. |
| name | Yes | String | Name of the subtask. |
| startTime | Yes | Long | Time when the subtask starts to run. |
| endTime | No | Long | Time when the subtask stops to run. |
| lastUpdate | Yes | Long | Time when the subtask is updated. |
| status | Yes | String | Subtask status. The value can be:
|
Example 1
After the solution is imported successfully, query the task information.
- Request
GET /v1/b384b9e9ab9b4ee8994c8633aabc9505/system-tasks/008aae2e675d3bcb01675d3c66f20000
- Response
{ { "endTime":1543457514000, "id":"008aae2e675d3bcb01675d3c66f20000", "lastUpdate":1543457514000, "name": "Import the solution from OBS path obs://aaaaa/traffic.zip.", "projectId":"b384b9e9ab9b4ee8994c8633aabc9505", "startTime":1543457499000, "status":"SUCCESSFUL", "subtasks":[ { "id":"008aae2e675d3bcb01675d3c9f5f0002", "lastUpdate":1543457513000, "name": "Import the job_batch job.", "status":"SUCCESSFUL", "taskId":"008aae2e675d3bcb01675d3c66f20000" }, { "id":"008aae2e675d3bcb01675d3c9fdc0003", "lastUpdate":1543457513000, "name": "Import the job_stream job.", "status":"SUCCESSFUL", "taskId":"008aae2e675d3bcb01675d3c66f20000" } ] }
Example 2
After the solution fails to be imported, query the task information.
- Request
GET /v1/b384b9e9ab9b4ee8994c8633aabc9505/systemTasks/008aae2e675d3bcb01675d3e6b960004
- Response
{ "endTime":1543457631000, "id":"008aae2e675d3bcb01675d3e6b960004", "lastUpdate":1543457631000, "message": "Failed to read the OBS file obs://aaaaa/traffic2.zip. " "name": "Import the solution from OBS path obs://aaaaa/traffic2.zip.", "projectId":"b384b9e9ab9b4ee8994c8633aabc9505", "startTime":1543457631000, "status":"FAILED", "subtasks":[] }
Example 3
Query the task for starting a solution.
- Request
GET /v1/b384b9e9ab9b4ee8994c8633aabc9505/systemTasks/008aae2e675d3bcb01675d40ab3f0005
- Response
{ "endTime":1543457794000, "id":"008aae2e675d3bcb01675d40ab3f0005", "lastUpdate":1543457794000, "name":"Start the traffic solution", "projectId":"b384b9e9ab9b4ee8994c8633aabc9505", "startTime":1543457778000, "status":"FAILED", "subtasks":[ { "id":"008aae2e675d3bcb01675d40e8560006", "lastUpdate":1543457794000, "name": "Start the job_batch job", "status":"FAILED", "taskId":"008aae2e675d3bcb01675d40ab3f0005" } ] }
Example 4
Query the task for exporting a job.
- Request
GET /v1/b384b9e9ab9b4ee8994c8633aabc9505/systemTasks/008aae2e675d3bcb01675d40ab3f0005
- Response
{ "endTime": 1544777083000, "id": "008aae2e67abe2ff0167abe3a28f0000", "lastUpdate": 1544777083000, "name": "Import the job from obs://aaaaa/job_batch.zip.", "projectId": "b384b9e9ab9b4ee8994c8633aabc9505", "startTime": 1544777081000, "status": "SUCCESSFUL", "subtasks": [{ "id": "008aae2e67abe2ff0167abe3a7e70002", "lastUpdate": 1544777083000, "name": "Import the job_batch job.", "status": "SUCCESSFUL", "taskId": "008aae2e67abe2ff0167abe3a28f0000" }] }
Last Article: Retry a Job Instance
Next Article: Data Structure
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.