Updated on 2024-05-22 GMT+08:00

Listing Jobs

Function

This API is used to list the current user's jobs. You can set the job ID as the ID and query jobs whose IDs are greater than or less than the ID. You can also query jobs in specific status, for example, in running status or other. By default, all jobs are queried.

URI

  • URI format

    GET /v1.0/{project_id}/streaming/jobs

  • Parameter description
    Table 1 URI parameter

    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.

    Table 2 query parameter description

    Parameter

    Mandatory

    Type

    Description

    job_type

    No

    String

    Job type.

    • flink_sql_job: Flink SQL job
    • flink_opensource_sql_job: Flink OpenSource SQL job
    • flink_jar_job: User-defined Flink job

    status

    No

    String

    Job status code.

    Available job statuses are as follows:

    • job_init: The job is in the draft status.
    • job_submitting: The job is being submitted.
    • job_submit_fail: The job fails to be submitted.
    • job_running: The job is running. (The billing starts. After the job is submitted, a normal result is returned.)
    • job_running_exception (The billing stops. The job stops running due to an exception.)
    • job_downloading: The job is being downloaded.
    • job_idle: The job is idle.
    • job_canceling: The job is being stopped.
    • job_cancel_success: The job has been stopped.
    • job_cancel_fail: The job fails to be stopped.
    • job_savepointing: The savepoint is being created.
    • job_arrearage_stopped: The job is stopped because the account is in arrears. (The billing ends. The job is stopped because the user account is in arrears.)
    • job_arrearage_recovering: The recharged job is being restored. (The account in arrears is recharged, and the job is being restored).
    • job_finish: The job is completed.

    queue_name

    No

    String

    Name of a queue.

    order

    No

    String

    Sorting style of the query results.

    • asc: by time in ascending order
    • desc: by time in descending order

    The default value is desc.

    limit

    No

    Integer

    Number of returned data records. The default value is 10 and the maximum value is 100.

    name

    No

    String

    Name of the job. Length range: 0 to 57 characters.

    offset

    No

    Integer

    Job offset.

    show_detail

    No

    Boolean

    Whether to return job details. The default value is false. If this parameter is set to true, the job details are returned. For details, see Querying Job Details.

    user_name

    No

    String

    Username, which can be used as a filter.

    tags

    No

    String

    Specifies a label for filtering.

Request

None

Response

Table 3 Response parameters

Parameter

Mandatory

Type

Description

is_success

No

String

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

message

No

String

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

job_list

No

Object

Information about a job list. For details, see Table 4.

Table 4 job_list parameters

Parameter

Mandatory

Type

Description

total_count

No

Integer

Number of records in the query result.

jobs

No

Array of objects

Information about a job. For details, see Table 5.

Table 5 Jobs parameters

Parameter

Mandatory

Type

Description

job_id

No

Long

Job ID.

name

No

String

Name of the job. Length range: 0 to 57 characters.

desc

No

String

Job description. Length range: 0 to 512 characters.

user_name

No

String

Username. This parameter is valid only when show_detail is set to false.

job_type

No

String

Job type.

  • flink_sql_job: Flink SQL job
  • flink_opensource_sql_job: Flink open-source SQL job
  • flink_jar_job: User-defined Flink job

status

No

String

Job status.

status_desc

No

String

Description of job status.

create_time

No

Long

Time when a job is created.

start_time

No

Long

Time when a job is started. The value 0 indicates that the process is not started.

duration

No

Long

Running duration of a job. Unit: ms. This parameter is valid only when show_detail is set to false.

root_id

No

Long

Parent job ID. This parameter is valid only when show_detail is set to false.

graph_editor_enabled

No

Boolean

Whether the flow diagram can be edited. Value true indicates that the flow diagram can be edited, and false indicates that the flow diagram cannot be edited.

has_savepoint

No

Boolean

Whether a job has a savepoint. Value true indicates that the job has a savepoint, and false indicates that the job does not have a savepoint.

user_id

No

String

ID of the user who creates the job. This parameter is valid only when show_detail is set to true.

project_id

No

String

ID of the project to which a job belongs. This parameter is valid only when show_detail is set to true.

sql_body

No

String

Stream SQL statement. This parameter is valid only when show_detail is set to false.

run_mode

No

String

Job running mode. The options are as follows: The value can be shared_cluster, exclusive_cluster, or edge_node. This parameter is valid only when show_detail is set to true.

  • shared_cluster: indicates that the job is running on a shared cluster.
  • exclusive_cluster: indicates that the job is running on an exclusive cluster.
  • edge_node: indicates that the job is running on an edge node.

job_config

No

Object

Job configuration. This parameter is valid only when show_detail is set to false. For details, see Table 6.

main_class

No

String

Main class of a JAR package. This parameter is valid only when show_detail is set to false.

entrypoint_args

No

String

Job running parameter of the JAR file. Multiple parameters are separated by spaces. This parameter is valid only when show_detail is set to true.

execution_graph

No

String

Job execution plan. This parameter is valid only when show_detail is set to false.

update_time

No

Long

Time when a job is updated. This parameter is valid only when show_detail is set to false.

queue_name

No

String

Queue name

edge_group_ids

No

Array of Strings

List of edge computing group IDs. Use commas (,) to separate multiple IDs.

restart_times

No

Integer

Number of restart times

savepoint_path

No

String

Path for storing manually generated checkpoints

Table 6 job_config parameters

Parameter

Mandatory

Type

Description

checkpoint_enabled

No

Boolean

Whether to enable the automatic job snapshot function.

  • true: The automatic job snapshot function is enabled.
  • false: The automatic job snapshot function is disabled.

The default value is false.

checkpoint_mode

No

String

Snapshot mode. There are two options:

  • exactly_once: indicates that data is processed only once.
  • at_least_once: indicates that data is processed at least once.

The default value is exactly_once.

checkpoint_interval

No

Integer

Snapshot interval. The unit is second. The default value is 10.

log_enabled

No

Boolean

Whether to enable the log storage function. The default value is false.

obs_bucket

No

String

Name of an OBS bucket.

smn_topic

No

String

SMN topic name. If a job fails, the system will send a message to users subscribed to the SMN topic.

root_id

No

Integer

Parent job ID.

edge_group_ids

No

Array of Strings

List of edge computing group IDs. Use commas (,) to separate multiple IDs.

manager_cu_number

No

Integer

Number of CUs of the management unit. The default value is 1.

cu_number

No

Integer

Number of CUs selected for a job. This parameter is valid only when show_detail is set to true.

  • Minimum value: 2
  • Maximum value: 400

The default value is 2.

parallel_number

No

Integer

Number of concurrent jobs set by a user. This parameter is valid only when show_detail is set to true.

  • Minimum value: 1
  • Maximum value: 2000

The default value is 1.

restart_when_exception

No

Boolean

Whether to enable the function of restart upon exceptions.

idle_state_retention

No

Integer

Expiration time.

udf_jar_url

No

String

Name of the package that has been uploaded to the DLI resource management system. The UDF Jar file of the SQL job is uploaded through this parameter.

dirty_data_strategy

No

String

Dirty data policy of a job.

  • 2:obsDir: Save. obsDir specifies the path for storing dirty data.
  • 1: Trigger a job exception
  • 0: Ignore

entrypoint

No

String

Name of the package that has been uploaded to the DLI resource management system. This parameter is used to customize the JAR file where the job main class is located.

dependency_jars

No

Array of Strings

Name of the package that has been uploaded to the DLI resource management system. This parameter is used to customize other dependency packages.

dependency_files

No

Array of Strings

Name of the resource package that has been uploaded to the DLI resource management system. This parameter is used to customize dependency files.

executor_number

No

Integer

Number of compute nodes in a job.

executor_cu_number

No

Integer

Number of CUs in a compute node.

resume_checkpoint

No

Boolean

Whether to restore data from the latest checkpoint when the system automatically restarts upon an exception. The default value is false.

runtime_config

No

String

Customizes optimization parameters when a Flink job is running.

graph_editor_enabled

No

Boolean

Whether to enable flow diagram editing. The default value is false.

graph_editor_data

No

String

Edited stream graph data. The default value is null.

resume_max_num

No

Integer

Maximum retry attempts. –1 indicates there is no upper limit.

checkpoint_path

No

String

Path for saving the checkpoint.

config_url

No

String

OBS path of the config package uploaded by the user.

tm_cus

No

int

Number of CUs per TaskManager node.

tm_slot_num

No

int

Number of slots per TaskManager node.

image

No

String

Custom image. The format is Organization name/Image name:Image version.

This parameter is valid only when feature is set to custom. You can use this parameter with the feature parameter to specify a user-defined Flink image for job running. For details about how to use custom images, see Data Lake Insight User Guide.

feature

No

String

User-defined job feature. Type of the Flink image used by a job.

  • basic: indicates that the basic Flink image provided by DLI is used.
  • custom: indicates that the user-defined Flink image is used.

flink_version

No

String

Flink version. This parameter is valid only when feature is set to basic. You can use this parameter with the feature parameter to specify the version of the DLI basic Flink image used for job running.

operator_config

No

String

Operator's parallelism degree. The operator ID and degree of parallelism are displayed in JSON format.

static_estimator_config

No

String

Estimation of static flow diagram resources.

real_cu_number

No

Integer

Number of actually used CUs. The default value is 0, indicating that the value of cu_number is used.

Example Request

None

Example Response

{
    "is_success": "true",
    "message": "Querying of the job list succeeds.",
    "job_list": {
        "total_count": 26,
        "jobs": [
            {
                "job_id": 146,
                "name": "aaaaa",
                "desc": "",
                "user_name": "",
                "job_type": "flink_sql_job",
                "status": "job_init",
                "status_desc": "",
                "create_time": 1578892414688,
                "duration": 0,
                "root_id": -1,
                "graph_editor_enabled": false,
                "has_savepoint": false
            }
        ]
    }
}

Status Codes

Table 7 describes the status code.

Table 7 Status codes

Status Code

Description

200

Job list query succeeds.

400

The input parameter is invalid.

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.