Adding and Executing a Job

Function

This API is used to add and submit a job in an MRS cluster.

  • If Kerberos authentication is enabled for a cluster, on the Dashboard tab page of the cluster details page, click Click to synchronize on the right side of IAM User Sync to synchronize IAM users, and then submit a job through this API.

URI

Request

Table 2 Request parameter description

Parameter

Mandatory

Type

Description

job_type

Yes

String

Type of a job.

  • MapReduce
  • SparkSubmit
  • HiveScript
  • HiveSql
  • DistCp, importing and exporting data
  • SparkScript
  • SparkSql
  • Flink
NOTE:

Spark, Hive, and Flink jobs can be added to only clusters that include Spark, Hive, and Flink components.

job_name

Yes

String

Job name. It contains 1 to 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

NOTE:

Identical job names are allowed but not recommended.

arguments

No

Array

Key parameter for program execution. The parameter is specified by the function of the user's program. MRS is only responsible for loading the parameter.

The parameter contains a maximum of 4,096 characters, excluding special characters such as ;|&>'<$, and can be left blank.

NOTE:
  • If you enter a parameter with sensitive information (such as the login password), the parameter may be exposed in the job details display and log printing. Exercise caution when performing this operation.
  • For MRS 1.9.2 or later, a file path on OBS can start with obs://. To use this format to submit HiveScript or HiveSQL jobs, choose Components > Hive > Service Configuration on the cluster details page, set Type to All, and search for core.site.customized.configs. Add the endpoint configuration item (fs.obs.endpoint) of OBS and enter the endpoint corresponding to OBS in Value. Obtain the value from Regions and Endpoints.

properties

No

Object

Program system parameter.

The parameter contains a maximum of 2,048 characters, excluding special characters such as ><|'`&!\, and can be left blank.

Response

Table 3 Response parameter description

Parameter

Type

Description

job_submit_result

Object

Job execution result

job_id

String

Job ID

state

String

Job submission status.

  • COMPLETE: The job is submitted.
  • JOBSTAT_SUBMIT_FAILED: Failed to submit the job.

error_msg

String

Error message

error_code

String

Error code

Example

Status Code

For details about status codes, see Status Codes.