取消 Spark 任务 (V2)
This operation submits a cancellation request for a Spark job in a specified project.
POST/v2/projects/{projectId}/jobs/{jobId}/cancel
该 API 的 Base URL 格式如下:
https://api.cloud.zilliz.com
📘说明
控制面接口速率限制为单用户单接口每秒最多 20 个请求。
shell
export BASE_URL="https://api.cloud.zilliz.com"
参数
Authorizationstringheader必填项
认证令牌,应为具备适当权限的 API 密钥。
示例值:Bearer {{TOKEN}}
projectIdstringpath必填项
项目 ID。
示例值:proj-xxxxxxxxxxxxxxxxxxx
jobIdstringpath必填项
Spark 任务 ID。
示例值:job-xxxxxxxxxxxxxxxxxx
bash
export TOKEN="YOUR_API_KEY"
export projectId="proj-xxxxxxxxxxxxxxxxxxx"
export jobId="job-xxxxxxxxxxxxxxxxxx"
curl --request POST \
--url "${BASE_URL}/v2/projects/${projectId}/jobs/${jobId}/cancel" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Request-Timeout: 5" \
--header "Content-Type: application/json"
响应202 Accepted - application/json
返回取消请求后的 Spark 任务。
codeinteger
响应码。
dataobject
响应载荷,包含取消请求后的 Spark 任务。
jobIdstring必填项
任务 ID。
projectIdstring必填项
任务所属的项目 ID。
typestring必填项
任务类型。
descriptionstring
任务描述。
statusstring必填项
任务状态。
regionIdstring必填项
云地域 ID。
clusterIdstring
集群 ID。
artifactobject
任务产生的输出产物。
volumeNamestring必填项
存储产物的存储卷名称。
pathstring必填项
产物在存储卷内的路径。
detailsobject
回填任务的详细信息。
dbNamestring
数据库名称。
collectionNamestring
集合名称。
inputobject
任务输入或输出数据的引用。
typestring
数据引用类型。
volumeNamestring
存储卷名称。
pathstring
数据在存储卷内的路径。
formatstring
数据格式。
fieldsarray
目标字段。
[]fieldsstring
(待补充)
columnMappingobject
源到目标的列映射。
modestring
回填模式。
resourceSizestring
资源规格。
failureReasonobject
任务失败的原因。
codestring
错误码。
messagestring
错误消息。
retryableboolean
任务是否可重试。
precheckReportobject
回填任务的预检报告。
passedboolean
预检是否通过。
dbNamestring
数据库名称。
collectionNamestring
集合名称。
inputstring
输入描述。
fieldsarray
目标字段。
[]fieldsstring
(待补充)
columnMappingobject
源到目标的列映射。
requiredSourceColumnsarray
必需的源列。
[]requiredSourceColumnsstring
(待补充)
errorsarray
预检错误。
[]errorsobject
单条预检错误。
codestring
错误码。
sourceColumnstring
源列。
targetFieldstring
目标字段。
expectedTypestring
期望类型。
actualTypestring
实际类型。
messagestring
错误消息。
checkedRowsinteger<int64>
已检查的行数。
createdAtstring
创建时间(ISO 8601)。
submittedAtstring
提交时间(ISO 8601)。
startedAtstring
开始时间(ISO 8601)。
finishedAtstring
结束时间(ISO 8601)。
durationSecondsinteger<int64>
持续时间(秒)。
返回错误消息。
codeinteger
响应码。
messagestring
错误描述。
Successjson
{
"code": 0,
"data": {
"jobId": "job-xxxxxxxxxxxxxxxxxx",
"sparkInstanceId": "sp-xxxxxxxxxxxxxxxxxx",
"type": "SPARK",
"jobName": "daily-vector-etl",
"status": "CANCELED",
"regionId": "ali-cn-hangzhou",
"clusterId": "in01-xxxxxxxxxxxxxxx",
"mainClass": "com.zilliz.example.Main",
"createdAt": "2026-05-20T10:00:00Z",
"startedAt": "2026-05-20T10:01:00Z",
"finishedAt": "2026-05-20T10:06:00Z",
"durationSeconds": 300,
"sparkApplicationName": "spark-batch-sp-xxxxxxxxxxxxxxxxxx",
"sparkNamespace": "spark-sp-xxxxxxxxxxxxxxxxxx",
"sparkHistoryUrl": "https://spark-history.example.com",
"sparkApplicationId": "spark-batch-sp-xxxxxxxxxxxxxxxxxx-0",
"sparkHistoryAppUrl": "https://spark-history.example.com/history/spark-batch-sp-xxxxxxxxxxxxxxxxxx-0/jobs/",
"artifact": {
"volumeId": "stg-xxxxxxxxxxxxxxxxxxx",
"path": "/jars/example-job.jar",
"artifactUri": "volume://my-volume/jars/example-job.jar"
},
"applicationType": "Java",
"arguments": [
"--collection",
"medium_articles"
],
"resource": {
"driverCores": 2,
"driverMemory": "8g",
"executorCores": 2,
"executorMemory": "8g",
"minExecutors": 1,
"maxExecutors": 10
},
"sparkConf": {
"spark.sql.shuffle.partitions": "200"
},
"error": null,
"submittedAt": "2026-05-20T10:00:30Z"
}
}