Updating a User-Defined Job

Function

This API is used to update user-defined jobs, which currently support the JAR format and run in exclusive clusters. Table 1 lists the supported parameters. Parameters must be in the "form-data" format.

Table 1 Parameter description

Parameter

Mandatory

Type

Description

job_id

Yes

Integer

Job ID.

name

No

String

Job name.

desc

No

String

Job description.

cluster_id

No

Integer

Resource ID of an exclusive cluster. Ensure that the current user has the permission of using resources of the exclusive cluster.

spu_number

No

Integer

Number of SPUs selected by a user for a job. You need to set this parameter when submitting a user-defined Flink job, but not when submitting a user-defined Spark job.

manager_spu

Yes

Integer

Number of management node SPUs selected by a user for a job. For user-defined Flink jobs, the parameter value is the number of Flink job managers. For user-defined Spark jobs, the parameter value is the number of Spark drivers.

parallel_number

No

Integer

Number of parallel tasks selected by a user for a job. You need to set this parameter when submitting a user-defined Flink job, but not when submitting a user-defined Spark job.

executor_number

No

Integer

Number of executors selected by a user for a Spark job. You need to set this parameter when submitting a user-defined Spark job, but not when submitting a user-defined Flink job.

executor_spu

No

Integer

Number of SPUs used by an executor in a job. You need to set this parameter when submitting a user-defined Spark job, but not when submitting a user-defined Flink job.

log_enabled

No

Boolean

Whether to enable the job log function.

  • true: indicates to enable the job log function.
  • false: indicates to disable the job log function.
  • Default value: false

obs_bucket

No

String

OBS path where users are authorized to save logs when log_enabled is set to true.

smn_topic

No

String

If a job fails to work, CS pushes alarm information to the SMN topic.

jar

No

File

JAR file uploaded by the user. This parameter has a higher priority than the jar_url parameter.

jar_url

No

String

OBS path of the JAR package uploaded by the user.

config

No

File

Configuration file uploaded by the user. This parameter has a higher priority than the config_url parameter.

config_url

No

String

OBS path of the configuration file uploaded by the user.

main_class

No

String

Job entry class.

args

No

String

Job entry parameter.

restart_when_exception

No

Boolean

Whether to enable restart upon exception. The default value is false.

tags

No

String

Job tag.

sys_enterprise_project_id

No

String

ID of the enterprise project to which a job belongs.

URI

  • URI format

    PATCH /v1.0/{project_id}/jar_job

  • Parameter description
    Table 2 URI parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Request

The request format is form-data, and the job ID is mandatory. For details about the parameter configuration, see Table 1.

Response

  • Example response
    {
    "message_id": "CS.10001",
      "message": "The job is updated successfully.",
      "current_time": 1533686888000,
      "payload": {
        "update_time": 1516952770835
      }
    }
  • Parameter description
    Table 3 Response parameters

    Parameter

    Mandatory

    Type

    Description

    message_id

    No

    String

    Message type ID.

    message

    No

    String

    Message content.

    current_time

    No

    Int

    Current time, expressed by milliseconds.

    payload

    No

    None

    Information about the job to be created.

    update_time

    No

    Int

    Job update time, expressed by milliseconds.

Status Code

Table 4 describes the status code.

Table 4 Status code

Status Code

Description

200

The user-defined job is updated successfully.

400

The input parameters are invalid.

Error Code

For details, see Error Codes.