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

Querying the Status of a Spark Asynchronous Operation

Function

This API is used to query the execution status of a Spark asynchronous operation and obtain the current status and execution result of an asynchronous operation (such as restarting a cluster). It is synchronous.

Constraints

Poll the status at appropriate intervals as needed.

Calling Method

For details, see Calling APIs.

URI

POST /v2/workspaces/{workspace_id}/spark-operators/{operation_id}/show-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

operation_id

Yes

String

Definition: Unique ID of an asynchronous operation, which is used to identify an asynchronous operation (such as restarting a cluster). It can be obtained from the response of the API for creating an asynchronous operation (for example, restarting a SparkSql cluster).

Constraints: N/A

Range: 1 to 64 characters. Only letters, digits, and hyphens (-) 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

status

String

Definition: Operation status, used to identify the current execution status of the asynchronous operation.

Range

  • RUNNING

  • FAILED

  • SUCCESS

operator_info

One of:

Definition: Detailed operation description.

message

String

Definition: Operation description information, containing the operation status description or error information in case of failure.

Range: 0 to 1,024 characters.

create_time

Long

Definition: Operation creation time, used to record when the operation was submitted.

Range: 0 to 9223372036854775807. Unix timestamp in milliseconds.

end_time

Long

Definition: Operation end time, which is used to record the time when the operation is complete.

Range: 0 to 9223372036854775807. Unix timestamp in milliseconds.

Table 4 SqlRestartCluster

Parameter

Type

Description

endpoint_name

String

Definition: Spark SQL endpoint name.

Range: 1 to 63 characters. Only lowercase letters, digits, and hyphens (-) are allowed. It must start with a lowercase letter and end with a lowercase letter or digit.

restart_strategy

String

Definition: Cluster restart policy, used to specify the restart method.

Range

  • FORCE: Forcible restart without waiting for running jobs to complete.

  • GRACEFUL: Graceful restart, which waits for all running jobs to complete before restarting.

Status code: 400

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: 401

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: 403

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.

Status code: 500

Table 8 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 execution status of an asynchronous operation by operation_id.

POST /v2/workspaces/{workspace_id}/spark-operators/{operation_id}/show-state

Example Responses

Status code: 200

{
  "status" : "SUCCESS",
  "message" : "Operation completed successfully",
  "create_time" : 1781494373844,
  "end_time" : 1781494381804,
  "operator_info" : {
    "type" : "RESTART_CLUSTER",
    "endpoint_name" : "spark-sql-cwk",
    "restart_strategy" : "FORCE"
  }
}

Status code: 400

{
  "error_code" : "AIDataLake.01011001",
  "error_msg" : "Invalid parameter operation_id",
  "solution_msg" : "Please check the input parameters according to the documentation(operation_id for show operator state)."
}

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

The query is successful. The current status of the asynchronous operation is returned.

400

Invalid request parameters.

401

Authentication failed.

403

Insufficient permissions.

500

Internal server error.