Help Center/ AI DataLake/ API Reference/ Spark APIs/ Spark Job Management/ Querying the Status of a Spark Job
Updated on 2026-11-06 GMT+08:00

Querying the Status of a Spark Job

Function

This API is used to query the status of a Spark job. It is synchronous. You can query the current execution status of a Spark job by job ID. The status includes PENDING, QUEUED, RUNNING, CANCELING, CANCELED, FAILED, SUCCEED, QUEUED_TIMEOUT, and RUNNING_TIMEOUT. The current status of the job is returned immediately after the API is called.

Calling Method

For details, see Calling APIs.

URI

GET /v2/workspaces/{workspace_id}/spark-jobs/{job_id}/state

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

workspace_id

Yes

String

Definition: Workspace ID, used for resource isolation. This can be viewed on the workspace page of the console.

Constraints: N/A

Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A

job_id

Yes

String

Definition: Spark job ID, used to uniquely identify a job. It can be obtained from the job_id in the response of the API for starting a Spark job or from the API for listing Spark jobs.

Constraints: N/A

Range: 1 to 64 characters. Only hexadecimal characters, hyphens (-), and underscores (_) are allowed.

Default Value: N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: User token. It is obtained by calling the Obtaining an IAM User Token API.

Constraints: N/A

Range: The value can contain a maximum of 65,534 characters, with no character type restrictions.

Default Value: N/A

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

job_id

String

Definition: Spark job ID, used to uniquely identify a Spark job.

Range: 1 to 64 characters. Only hexadecimal characters, hyphens (-), and underscores (_) are allowed. Example: 6c98db52-cac2-4ff1-9a91-b7793e95557d.

state

String

Definition: Spark job status.

Range

  • QUEUED: Queued.

  • PENDING: Starting.

  • RUNNING: Running.

  • CANCELING: Canceling.

  • CANCELED: Canceled.

  • FAILED: Failed.

  • QUEUED_TIMEOUT: Queue timeout.

  • RUNNING_TIMEOUT: Running timeout.

  • SUCCEED: Succeeded.

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, used to identify a specific error type.

Range: 0 to 64 characters.

error_msg

String

Definition: Error description, used to explain the cause of an error.

Range: 0 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 401

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, used to identify a specific error type.

Range: 0 to 64 characters.

error_msg

String

Definition: Error description, used to explain the cause of an error.

Range: 0 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 403

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, used to identify a specific error type.

Range: 0 to 64 characters.

error_msg

String

Definition: Error description, used to explain the cause of an error.

Range: 0 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, used to identify a specific error type.

Range: 0 to 64 characters.

error_msg

String

Definition: Error description, used to explain the cause of an error.

Range: 0 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Example Requests

Query the current execution status of a specified Spark job, used to monitor the job progress and determine whether the job is complete.

GET /v2/workspaces/{workspace_id}/spark-jobs/{job_id}/state

Example Responses

Status code: 200

{
  "job_id" : "6c98db52-cac2-4ff1-9a91-b7793e95557d",
  "state" : "RUNNING"
}

Status code: 400

{
  "error_code" : "AIDataLake.01011001",
  "error_msg" : "Invalid parameter job_id",
  "solution_msg" : "Please check the input parameters according to the documentation(job_id for spark job)."
}

Status code: 401

{
  "error_code" : "AIDataLake.01011003",
  "error_msg" : "auth token not exists in header",
  "solution_msg" : "Please check if auth token is included in the request header."
}

Status code: 403

{
  "error_code" : "AIDataLake.01011005",
  "error_msg" : "current account has no permission",
  "solution_msg" : "Please connect administrators to add permission."
}

Status code: 500

{
  "error_code" : "AIDataLake.01010001",
  "error_msg" : "Internal system error",
  "solution_msg" : "Contact operations for analysis."
}

Status Codes

Status Code

Description

200

Query succeeded.

400

Invalid request parameter.

401

Authentication failed.

403

Insufficient permissions.

500

Internal server error.