Updated on 2022-12-14 GMT+08:00

Querying Information About a Job

Function

This API is used to query information about a specified job in an MRS cluster.

URI

  • Format

    GET /v2/{project_id}/clusters/{cluster_id}/job-executions/{job_execution_id}

  • Parameter description
    Table 1 URI parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

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

    cluster_id

    Yes

    String

    The cluster ID. For details on how to obtain the cluster ID, see Obtaining a Cluster ID.

    job_execution_id

    Yes

    String

    The job ID. For details about how to obtain the job ID, see Obtaining a Job ID.

Request Parameters

Request parameters

None

Response Parameters

Status code: 202

Table 2 Response parameter

Parameter

Type

Description

job_detail

JobQueryBean object

Job details. For details about the parameter, see Table 3.

Table 3 Job parameters

Parameter

Type

Description

job_id

String

The job ID.

user

String

The name of the user who submits a job.

job_name

String

The job name.

job_result

String

The final result of a job. Possible values:

  • FAILED: indicates that the job fails to be executed.
  • KILLED: indicates that the job is manually terminated during execution.
  • UNDEFINED: indicates that the job is being executed.
  • SUCCEEDED: indicates that the job has been successfully executed.

job_state

String

The job execution status. Possible values:

  • FAILED: indicates that the job failed.
  • KILLED: indicates that the job is terminated.
  • New: indicates that the job is created.
  • NEW_SAVING: indicates that the job has been created and is being saved.
  • SUBMITTED: indicates that the job is submitted.
  • ACCEPTED: indicates that the job is accepted.
  • RUNNING: indicates that the job is running.
  • FINISHED: indicates that the job is completed.

job_progress

Float

The job execution progress.

job_type

String

The job type. Possible values:

  • MapReduce
  • SparkSubmit: Select this value when you call an API to query SparkPython jobs.
  • HiveScript
  • HiveSql
  • DistCp: imports and exports data.
  • SparkScript
  • SparkSql
  • Flink

started_time

Long

The time when a job starts to execute, in milliseconds.

submitted_time

Long

The time when a job is submitted, in milliseconds.

finished_time

Long

The time when a job execution is completed, in milliseconds.

elapsed_time

Long

The job execution duration, in milliseconds.

arguments

String

Run parameters.

properties

String

The configuration parameter, which is used to configure -d parameters. The value can contain a maximum of 2,048 characters. Special characters (;|&>'<$!\\) are not allowed. This parameter can be left blank.

launcher_id

String

The launcher job ID.

app_id

String

The actual job ID.

tracking_url

String

The URL for accessing logs. Currently, only SparkSubmit jobs support this parameter. This parameter accesses the Yarn Web UI via the EIP bound to the cluster. If the EIP is unbound from the cluster on the VPC console, the MRS service data is not updated in a timely manner and the access fails. In this case, you can bind the EIP to the cluster again to rectify the fault.

queue

String

The type of the resource queue used by a job.

Status code: 500

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

The error code.

error_msg

String

The error message.

Example

  • Example request

    Querying information about a job

    GET https://{endpoint}/v2/{project_id}/clusters/{cluster_id}/job-executions/{job_execution_id}
  • Example response
    • Example of a successful response
      {
          "job_detail": {
              "job_id": "431b135e-c090-489f-b1db-0abe3822b855",
              "user": "xxxx",
              "job_name": "pyspark1",
              "job_result": "SUCCEEDED",
              "job_state": "FINISHED",
              "job_progress": "100",
              "job_type": "SparkSubmit",
              "started_time": "1564626578817",
              "submitted_time": 1564626561541,
              "finished_time": 1564626664930,
              "elapsed_time": 86113,
              "queue": "default",
              "arguments": "[--class, org.apache.spark.examples.SparkPi, --driver-memory, 512MB, --num-executors, 1, --executor-cores, 1, --master, yarn-cluster, obs://obs-test/jobs/spark/spark-examples_2.11-2.1.0.jar, 10000]",
              "launcher_id": "application_1564622673393_0006",
              "app_id": "application_1564622673393_0007",
              "properties": "{}"
          }
      }
    • Example of a failed response
      {
      "error_msg": "Failed to query the job."
         "error_code":"0162"
      }

Status Codes

See Status Codes.

Error Codes

See Error Codes.