Querying All Jobs

Function

This API is used to query information about all jobs in the current project.

URI

Request Parameters

None

Response Parameters

Table 3 Response parameters

Parameter

Mandatory

Type

Description

is_success

Yes

Boolean

Indicates whether the request is successfully executed. Value true indicates that the request is successfully executed.

message

Yes

String

System prompt. If execution succeeds, the parameter setting may be left blank.

job_count

Yes

Integer

Indicates the total number of jobs.

jobs

Yes

Array of objects

Indicates the information about a job. For details, see Table 4.

Table 4 jobs parameters

Parameter

Mandatory

Type

Description

job_id

Yes

String

Definition

Job ID. For details about how to obtain a job ID, see Submitting a SQL Job (Recommended).

job_type

Yes

String

Definition

Type of jobs to be queried

Range

  • DDL: data definition jobs (such as CREATE, ALTER, and DROP)
  • DCL: data control jobs (such as GRANT and REVOKE)
  • IMPORT: data import jobs (loading data from external sources)
  • EXPORT: data export jobs (outputting data to external systems)
  • QUERY: query jobs (such as SELECT statements)
  • INSERT: data insertion jobs (such as INSERT statements)
  • DATA_MIGRATION: data migration jobs (cross-database/cross-cluster data migration)
  • UPDATE: data update jobs (such as UPDATE statements)
  • DELETE: data deletion jobs (such as DELETE statements)
  • RESTART_QUEUE: queue restart jobs (resuming suspended or failed queue jobs)
  • SCALE_QUEUE: queue scaling jobs (dynamically adjusting queue resources)
  • ALL: All types of jobs are queried.

queue_name

Yes

String

Definition

Queue to which a job is submitted

Range

None

owner

Yes

String

Definition

User who submits a job

Range

None

start_time

Yes

Long

Definition

Job start time. The value is a timestamp in milliseconds.

Range

None

duration

Yes

Long

Definition

Job running duration (unit: millisecond).

Range

None

status

Yes

String

Definition

Status of a job

Range

  • RUNNING: The job is running.
  • SCALING: The job is modifying specifications.
  • LAUNCHING: The job is being submitted.
  • FINISHED: The job is completed.
  • FAILED: The job has failed.
  • CANCELLED: The job has been canceled.

input_row_count

No

Long

Definition

Number of records scanned during the Insert job execution

Range

None

bad_row_count

No

Long

Definition

Number of error records scanned during the Insert job execution.

Range

None

input_size

Yes

Long

Definition

Size of scanned files during job execution.

Range

None

result_count

Yes

Integer

Definition

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

Range

None

database_name

No

String

Definition

Name of the database where the target table resides. database_name is valid only for jobs of the Import and Export types.

Range

None

table_name

No

String

Definition

Name of the target table. table_name is valid only for jobs of the Import and Export types.

Range

None

with_column_header

No

Boolean

Definition

Import jobs, which record whether the imported data contains column names.

Range

None

detail

Yes

String

Definition

JSON string of related columns queried using SQL statements.

Range

None

engine_type

No

String

Definition

Engine type

Range

  • spark: Spark engine

statement

Yes

String

Definition

SQL statements of a job

Range

None

message

No

String

Definition

System prompt.

Range

None

end_time

No

Long

Definition

Job end time. The timestamp is in milliseconds.

Range

None

tags

No

Array of objects

Definition

Job tags. For details, see Table 5.

Range

None

result_format

No

String

Definition

Storage format of job results. Currently, only CSV is supported.

Range

None

result_path

No

String

Definition

OBS path of job results

Range

None

execution_details_path

No

String

Definition

Path used to store the job execution plan.

Example: obs://bucketName/jobs/execution_details/xxx/2023/11/10/xxx

Range

None

Table 5 tags parameters

Parameter

Mandatory

Type

Description

key

Yes

String

Definition

Tag key

Range

None

value

Yes

String

Definition

Tag value

Range

None

Example Request

None

Example Response

{
 "is_success": true,
  "message": "",
  "job_count": 1,
  "jobs": [
    {

      "detail": "{\"type\":\"struct\",\"fields\":[{\"name\":\"name\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"age\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}}]}",
      "duration": 17731,

      "end_time": 1502349821460,
      "input_size": 0,
      "job_id": "37286cc7-0508-4ffd-b636-951c8a5c75de",
      "job_type": "QUERY",
      "message": "",
      "owner": "tenant1",
      "queue_name": "queue1",
      "result_count": 3,
      "start_time": 1502349803729,
      "statement": "select * from t_json_002",
      "status": "FINISHED",
      "with_column_header": false
    }
  ]
}

Status Codes

Table 6 describes the status code.

Table 6 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 Codes.