This API is used to query information about all jobs in the current project.
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 |
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
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
Default Value None |
job-status |
No |
String |
Definition Status of jobs to be queried Constraints None Range
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
Default Value The default value is start_time_desc. |
engine_type |
No |
String |
Definition Engine type Constraints None Range
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
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.
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}
None
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 Range
|
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 |
None
{
"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
}
]
}
Table 6 describes the status code.
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.