Querying All Jobs
Function
This API is used to query information about all jobs in the current project.
URI
- URI format
- Parameter description
Table 1 URI parameter Parameter
Mandatory
Type
Description
project_id
Yes
String
Definition
Project ID, which is used for resource isolation. For how to obtain a project ID, see Obtaining a Project ID.
Example: 48cc2c48765f481480c7db940d6409d1
Constraints
None
Range
The value can contain up to 64 characters. Only letters and digits are allowed.
Default Value
None
Table 2 query parameter description Parameter
Mandatory
Type
Description
page-size
No
Integer
Definition
Maximum number of jobs displayed on each page, for example, 5
Constraints
None
Range
[1, 100]
Default Value
50
current-page
No
Integer
Definition
Current page number. The default value is 1.
Constraints
None
Range
[1, 100]
Default Value
1
start
No
Long
Definition
Queries jobs with a start time later than the time specified by this parameter.
Constraints
The value is a UNIX timestamp, in milliseconds.
Range
None
Default Value
None
end
No
Long
Definition
Queries jobs with a start time earlier than the time specified by this parameter.
Constraints
The value is a UNIX timestamp, in milliseconds.
Range
None
Default Value
None
job-type
No
String
Definition
Type of jobs to be queried. The options are DDL, DCL, IMPORT, EXPORT, QUERY, INSERT, DATA_MIGRATION, UPDATE, DELETE, RESTART_QUEUE, and SCALE_QUEUE. To query all types of jobs, enter ALL.
job-type is used to query a single type of jobs, or set to ALL to query all types of jobs.
If job-type and job_types are both set, the value of job-type takes the intersection of the two.
Constraints
None
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)
Default Value
None
job_types
No
Array[string]
Definition
List of job types to be queried. The options are DDL, DCL, IMPORT, EXPORT, QUERY, INSERT, UPDATE, and DELETE.
job_types is used to query multiple types of jobs. If job_types and job-type are both set, the value of job_types takes the intersection of the two.
Constraints
None
Range
- DDL: data definition jobs (such as CREATE, ALTER, and DROP)
- DCL: data control jobs (such as GRANT and REVOKE)
- IMPORT: data import jobs (for example, importing data from files or external sources)
- EXPORT: data export jobs (exporting data to files or external systems)
- QUERY: query jobs (such as SELECT statements)
- INSERT: data insertion jobs (such as INSERT statements)
- UPDATE: data update jobs (such as UPDATE statements)
- DELETE: data deletion jobs (such as DELETE statements)
Default Value
None
job-status
No
String
Definition
Status of jobs to be queried
Constraints
None
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.
Default Value
None
job-id
No
String
Definition
ID of the job to be queried. You can get the value by calling Submitting a SQL Job (Recommended).
Constraints
None
Range
The value can contain up to 64 characters. Only letters and digits are allowed.
Default Value
None
queue_name
No
String
Definition
Name of the queue where desired jobs are running
Constraints
None
Range
None
Default Value
None
sql_pattern
No
String
Definition
Specifies the SQL segment as the filter. It is case insensitive.
Constraints
None
Range
None
Default Value
None
order
No
String
Definition
Job sorting mode
Constraints
None
Range
- duration_desc: Jobs are sorted by running duration in descending order.
- duration_asc: Jobs are sorted by running duration in ascending order.
- start_time_desc: Jobs are sorted by submission time in descending order.
- start_time_asc: Jobs are sorted by submission time in ascending order.
Default Value
The default value is start_time_desc.
engine_type
No
String
Definition
Engine type
The options are spark and hetuEngine.
Constraints
None
Range
- spark: Spark engine
- hetuEngine: HetuEngine engine
For details about the engine types and descriptions, see DLI Overview.
Default Value
None
owner
No
String
Definition
User who submits a job
Constraints
None
Range
None
Default Value
None
tags
No
String
Queue tags for the search. You can specify multiple tags in key=value format.
Definition
Job tags for filtering. You can specify multiple tags in key=value format.
Constraints
Currently, only fuzzy query across all tags is supported. Exact query is not supported.
Range
- Request with one specified tag
For example, GET /v1.0/{project_id}/jobs? tags=k1%3Dv1
In this example, = needs to be escaped to %3D, k1 indicates the tag key, and v1 indicates the tag value.
- Request with more than one tag
Separate tags with commas (,) and convert the commas (,) to %2C, for example, GET /v1.0/{project_id}/jobs?. tags=k1%3Dv1%2Ck2%3Dv2.
The equal sign (=) is escaped to %3D. k1 indicates a tag key, and v1 indicates the tag value. k2 indicates another tag key, and v2 indicates the tag value.
Default Value
None
The following is an example of the URL containing the query parameter:
GET /v1.0/{project_id}/jobs?page-size={size}¤t-page={page_number}&start={start_time}&end={end_time}&job-type={QUERY}&queue_name={test}&order={duration_desc}
Request Parameters
None
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. |
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
|
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
|
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 Spark or HetuEngine configured for the queue Range
For details about the engine types and descriptions, see DLI Overview. |
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 |
output_byte |
No |
String |
Definition Number of output bytes of a job. Range None |
cpu_cost |
No |
String |
Definition Total CPU used by jobs 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 |
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.
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.