Updated on 2022-12-07 GMT+08:00

Querying Job Status

Function

This API is used to query the status of a submitted job.

URI

  • URI format

    GET /v1.0/{project_id}/jobs/{job_id}/status

  • Parameter description
    Table 1 URI parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.

    job_id

    Yes

    String

    Job ID.

Request

None

Response

Table 2 Response parameters

Parameter

Mandatory

Type

Description

is_success

Yes

Boolean

Whether the request is successfully executed. Value true indicates that the request is successfully executed.

message

Yes

String

System prompt. If execution succeeds, this parameter is left blank.

job_id

Yes

String

Job ID. You can get the value by calling Submitting a SQL Job (Recommended).

job_type

Yes

String

Type of a job, Includes DDL, DCL, IMPORT, EXPORT, QUERY, INSERT, DATA_MIGRATION, UPDATE, DELETE, RESTART_QUEUE and SCALE_QUEUE.

job_mode

Yes

String

Job execution mode. The options are as follows:

  • async: asynchronous
  • sync: synchronous

queue_name

Yes

String

Name of the queue where the job is submitted.

owner

Yes

String

User who submits a job.

start_time

Yes

Long

Time when a job is started. The timestamp is in milliseconds.

duration

No

Long

Job running duration (unit: millisecond).

status

Yes

String

Status of a job, including RUNNING, SCALING, LAUNCHING, FINISHED, FAILED, and CANCELLED.

input_row_count

No

Long

Number of records scanned during the Insert job execution.

bad_row_count

No

Long

Number of error records scanned during the Insert job execution.

input_size

Yes

Long

Size of scanned files during job execution (unit: byte).

result_count

Yes

Integer

Total number of records returned by the current job or total number of records inserted by the Insert job.

database_name

No

String

Name of the database where the target table resides. database_name is valid only for jobs of the IMPORT EXPORT, and QUERY types.

table_name

No

String

Name of the target table. table_name is valid only for jobs of the IMPORT EXPORT, and QUERY types.

detail

Yes

String

JSON character string for information about related columns.

statement

Yes

String

SQL statements of a job.

tags

No

Array of objects

Job tags. For details, see Table 3.

Table 3 tags parameters

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key

value

Yes

String

Tag value

Example Request

None

Example Response

{
  "is_success": true,
  "message": "",
  "job_id": "208b08d4-0dc2-4dd7-8879-ddd4c020d7aa",
  "job_type": "QUERY",
  "job_mode":"async",
  "queue_name": "default",
  "owner": "test",
  "start_time": 1509335108918,
  "duration": 2523,
  "status": "FINISHED",
  "input_size": 22,
  "result_count": 4,
  "database_name":"dbtest",
  "table_name":"tbtest",
  "detail": "{\"type\":\"struct\",\"fields\":[{\"name\":\"id\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}},{\"name\":\"name\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}}]}",
  "statement": "select * from t1"
}

Status Codes

Table 4 describes the status code.

Table 4 Status codes

Status Code

Description

200

The query is successful.

400

Request error.

500

Internal service error.

Error Codes

If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Code.