Creating a User-Defined Job
Function
This API is used to create 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.
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Job name. |
| desc | Yes | String | Job description. |
| job_type | Yes | String | Job type. The options are as follows:
|
| cluster_id | Yes | 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.
|
| 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
POST /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. For details about the parameter configuration, see Table 1.
Response
- Example response
{ "message_id": "CS.10001", "message": "A job is created successfully.", "current_time": 1533686888000, "payload": { "job_id": 50320, "status_name": "running", "status_desc": "Status description" } } - 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 status.
job_id
Yes
Long
Job ID.
status_name
No
String
Name of job status.
status_desc
No
String
Status description.
Status Code
Table 4 describes the status code.
Error Code
For details, see Error Codes.
Last Article: Updating a SQL Job
Next Article: Updating a User-Defined Job
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.