Updated on 2022-08-17 GMT+08:00

Querying a System Task

Function

This API is used to query details about asynchronous tasks.

URI

  • URI format

    GET /v1/{project_id}/system-tasks/{task_id}

  • Parameter description
    Table 1 URI parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID. For details about how to obtain a project ID, see Project ID and Account ID.

    task_id

    Yes

    String

    Task ID.

Request

Table 2 Request header parameter

Parameter

Mandatory

Type

Description

workspace

No

String

Workspace ID.

  • If this parameter is not set, data in the default workspace is queried by default.
  • To query data in other workspaces, this header must be carried.

Response

Table 3 Response parameters

Parameter

Mandatory

Type

Description

id

Yes

String

Task ID.

name

Yes

String

Name of the task.

startTime

Yes

Long

Start time.

endTime

No

Long

End time.

lastUpdate

Yes

Long

Time when the task was last updated.

status

Yes

String

Task status.

  • RUNNING
  • SUCCESSFUL
  • FAILED

message

No

String

Task information.

subtasks

No

List<SubTask>

Subtask. For details, see Table 4.

Table 4 subtasks parameters

Parameter

Mandatory

Type

Description

id

Yes

String

Subtask ID.

name

Yes

String

Name of the subtask.

startTime

Yes

Long

Start time.

endTime

No

Long

End time.

lastUpdate

Yes

Long

Time when the task was last updated.

status

Yes

String

Task status.

  • RUNNING
  • SUCCESSFUL
  • FAILED

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"
    }]
    }
  • Failure response

    HTTP status code 400

    {
        "error_code":"DLF.0810",
        "error_msg":"Task does not exist"
    }