Obtains the status of all the code blocks for a Spark session.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ListSparkStatements |
The operation that you want to perform. Set the value to ListSparkStatements. |
JobId | String | Yes | j202106071620hangzhou00000000001 |
The ID of the Spark job. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | C2AB7692-B9EF-4A50-BCFF-0DC5B6F080E8 |
The unique ID of the request. |
Statements | Array of Statements |
The execution results of the code block. |
|
Code | String | print(2 + 2) |
The code block that is executed. |
CompletedTime | Long | 1623033200754 |
The timestamp when the execution of the code block was completed, in milliseconds. |
Id | Integer | 2 |
The unique ID of the code block. |
Output | String | {\"status\":\"ok\",\"execution_count\":1,\"data\":{\"text/plain\":\"4\"}} |
The execution result of the code block, which is a JSON string. It contains the following information:
|
Progress | Float | 1 |
The current execution progress. It is a floating-point number, which represents the
progress percentage. The value |
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:
|
Examples
Sample requests
http(s)://[Endpoint]/?Action=ListSparkStatements
&JobId=j202106071620hangzhou00000000001
&<Common request parameters>
Sample success responses
XML
format
<RequestId>C2AB7692-B9EF-4A50-BCFF-0DC5B6F080E8</RequestId>
<Statements>
<Progress>1</Progress>
<CompletedTime>1623033200078</CompletedTime>
<State>available</State>
<Output>{"status":"ok","execution_count":0,"data":{"text/plain":"<pyspark.sql.session.SparkSession object at 0x7f5e4a550390>"}}</Output>
<StartedTime>1623033200077</StartedTime>
<Id>0</Id>
<Code>spark</Code>
</Statements>
<Statements>
<Progress>1</Progress>
<CompletedTime>1623033200754</CompletedTime>
<State>available</State>
<Output>{"status":"ok","execution_count":1,"data":{"text/plain":"4"}}</Output>
<StartedTime>1623033200753</StartedTime>
<Id>1</Id>
<Code>print(2 + 2)
</Code>
</Statements>
JSON
format
{
"RequestId": "C2AB7692-B9EF-4A50-BCFF-0DC5B6F080E8",
"Statements": [
{
"Progress": 1,
"CompletedTime": 1623033200078,
"State": "available",
"Output": "{\"status\":\"ok\",\"execution_count\":0,\"data\":{\"text/plain\":\"<pyspark.sql.session.SparkSession object at 0x7f5e4a550390>\"}}",
"StartedTime": 1623033200077,
"Id": 0,
"Code": "spark"
},
{
"Progress": 1,
"CompletedTime": 1623033200754,
"State": "available",
"Output": "{\"status\":\"ok\",\"execution_count\":1,\"data\":{\"text/plain\":\"4\"}}",
"StartedTime": 1623033200753,
"Id": 1,
"Code": "print(2 + 2)\n"
}
]
}
Error codes
For a list of error codes, visit the API Error Center.