Canceling a Job Run
Function
This API is used to cancel the running of a job. It is mainly used to cancel the running of a Ray job. This is an asynchronous API that returns a job ID after a request is submitted successfully. The cancellation does not complete immediately. You need to call the Viewing Ray Job Details API to check the job status. When the job status is CANCELED, the job has been canceled successfully.
Calling Method
For details, see Calling APIs.
URI
POST /v2/workspaces/{workspace_id}/ray-jobs/{job_id}/cancel
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| workspace_id | Yes | String | Definition: Workspace ID. For details about how to obtain the workspace ID, see Obtaining a Workspace ID. Constraints: N/A Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A |
| job_id | Yes | String | Definition: Job ID. It can be obtained by calling the Listing Ray Jobs API. Constraints: N/A Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A |
Request 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: Up to 65,534 characters. Default Value: N/A |
Response Parameters
Status code: 202
| Parameter | Type | Description |
|---|---|---|
| job_id | String | Definition: Job ID. It can be obtained by calling the Listing Ray Jobs API. Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution description. Range: 0 to 4,096 characters. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution description. Range: 0 to 4,096 characters. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution description. Range: 0 to 4,096 characters. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution description. Range: 0 to 4,096 characters. |
Status code: 408
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution description. Range: 0 to 4,096 characters. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution description. Range: 0 to 4,096 characters. |
Example Requests
Cancel a running job.
POST /v2/workspaces/{workspace_id}/ray-jobs/{job_id}/cancel Example Responses
Status code: 202
{
"job_id" : "ac8111bf-3601-4905-8ddd-b41d3e636a4e"
} Status code: 400
{
"error_code" : "common.01000001",
"error_msg" : "failed to read http request, please check your input, code: 400, reason: Type mismatch., cause: TypeMismatchException",
"solution_msg" : "Check whether the request parameters comply with the API definition and try again."
} Status code: 401
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed",
"solution_msg" : "Please check if auth token is included in the request header."
} Status code: 403
{
"error_code" : "APIG.1003",
"error_msg" : "X-Auth-Token is invalid in the request",
"solution_msg" : "Check whether the token in the request is valid and try again."
} Status code: 404
{
"error_code" : "common.01000001",
"error_msg" : "response status exception, code: 404",
"solution_msg" : "Please try to use correct info."
} Status code: 408
{
"error_code" : "common.00000408",
"error_msg" : "timeout exception occurred",
"solution_msg" : "The backend request timed out — check service health and network connectivity, then retry."
} Status code: 500
{
"error_code" : "common.00000500",
"error_msg" : "internal error",
"solution_msg" : "Contact operations for analysis."
} Status Codes
| Status Code | Description |
|---|---|
| 202 | Request submitted. |
| 400 | Invalid request. |
| 401 | Unauthorized. |
| 403 | Request denied. |
| 404 | The requested resource could not be found. |
| 408 | Request timeout. |
| 500 | Internal server error. |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot