Obtains the status of a specified code block.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes GetSparkStatement

The operation that you want to perform. Set the value to GetSparkStatement.

JobId String Yes j202106071620hangzhou00000000001

The unique ID of the Spark job.

StatementId Integer Yes 1

The unique ID of the code block in the Spark job.

Response parameters

Parameter Type Example Description
Data Struct

The status of the code block.

Code String print(2+2)

The code block submitted.

CompletedTime Long 1623033200754

The timestamp when the execution of the code block is completed.

Id Integer 1

The unique ID of the code block in the Spark job. The IDs increment sequentially.

Output String The execution result of the code block. It is a JSON string in the following format: - status The execution status of the code block. - execution_count The number of rows in the code blocks that are executed. - data The execution result of the code block.

The execution result of the code block. It is a JSON string in the following format:

  • status: the execution status.
  • execution_count: the number of rows in the code blocks that are executed.
  • data: the execution result of the code block.
Process Float 0.5

The current execution progress. It is a floating-point number, which represents the progress percentage. The value 1 indicates 100%. The value 0.5 indicates 50%.

StartedTime Long 1623033200750

The timestamp when the code block started to execute, in milliseconds.

State String running

The status of the code block. Valid values:

  • waiting: The code block is to be executed.
  • running: The code block is being executed.
  • available: The execution of the code block is completed.
  • error: The code block fails to be executed.
  • cancelling: The execution of the code block attempts to be terminated.
  • cancelled: The execution of the code block is terminated.
RequestId String C5DB60E0-6EB3-493C-8956-DA0D3A2EE656

The unique ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=GetSparkStatement
&JobId=j202106071620hangzhou00000000001
&StatementId=1
&<Common request parameters>

Sample success responses

XML format

<RequestId>C5DB60E0-6EB3-493C-8956-DA0D3A2EE656</RequestId>
<Data>
    <CompletedTime>1623033200754</CompletedTime>
    <State>available</State>
    <Output>{"status":"ok","execution_count":1,"data":{"text/plain":"4"}}</Output>
    <StartedTime>1623033200753</StartedTime>
    <Process>1</Process>
    <Id>1</Id>
    <Code>print(2 + 2)
</Code>
</Data>

JSON format

{
  "RequestId": "C5DB60E0-6EB3-493C-8956-DA0D3A2EE656",
  "Data": {
    "CompletedTime": 1623033200754,
    "State": "available",
    "Output": "{\"status\":\"ok\",\"execution_count\":1,\"data\":{\"text/plain\":\"4\"}}",
    "StartedTime": 1623033200753,
    "Process": 1,
    "Id": 1,
    "Code": "print(2 + 2)\n"
  }
}

Error codes

For a list of error codes, visit the API Error Center.