Cancel job
POST/metalakes/:metalake/jobs/runs/:jobId
Requests cancellation of a job and returns the job, normally in the cancelling status. A job that has already finished or is already being cancelled is returned unchanged.
Sign in with a bearer token or a local user's password; see Authentication.
Request
Path Parameters
The name of the metalake
The unique identifier of the job
Responses
- 200
- 404
- 5xx
The job, normally in the cancelling status, or unchanged when it had already finished or was already being cancelled.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- JobResponse
Schema
- ShellJobTemplate
- SparkJobTemplate
Possible values: [0]
Status code of the response
job
object
A job object
The unique identifier of the job
The name of the job template used to create the job
Possible values: [queued, started, failed, succeeded, cancelling, cancelled]
The status of the job
audit
object
required
Audit information for a Gravitino resource.
The user who created the resource
The time the resource was created
The user who last modified the resource
The time the resource was last modified
The time when the job was queued for execution, same as the job's creation time
The time when the job started execution, or null if the job has not started execution yet
The time when the job finished execution, or null if the job has not finished execution yet
runtimeJobTemplate
object
nullable
oneOf
A job template object for shell jobs
The name of the job template
Possible values: [shell]
The type of the job template
A comment about the job template
The executable command of the job template
The arguments of the job template
environments
object
Configured string to string map of environment variables for the job template
customFields
object
Configured string to string map of custom fields for the job template
The scripts of the job template
audit
object
Audit information for a Gravitino resource.
The user who created the resource
The time the resource was created
The user who last modified the resource
The time the resource was last modified
A job template object for Spark jobs
The name of the job template
Possible values: [spark]
The type of the job template
A comment about the job template
The executable command of the job template
The arguments of the job template
environments
object
Configured string to string map of environment variables for the job template
customFields
object
Configured string to string map of custom fields for the job template
The main class of the Spark job template. Required for Java/Scala Spark applications, optional for PySpark applications
The JAR files of the Spark job template
The files of the Spark job template
The archives of the Spark job template
configs
object
Configured string to string map of Spark configurations for the job template
audit
object
Audit information for a Gravitino resource.
The user who created the resource
The time the resource was created
The user who last modified the resource
The time the resource was last modified
{
"code": 0,
"job": {
"jobId": "string",
"jobTemplateName": "string",
"status": "queued",
"audit": {
"creator": "string",
"createTime": "2024-07-29T15:51:28.071Z",
"lastModifier": "string",
"lastModifiedTime": "2024-07-29T15:51:28.071Z"
},
"queuedAt": "2024-07-29T15:51:28.071Z",
"startedAt": "2024-07-29T15:51:28.071Z",
"finishedAt": "2024-07-29T15:51:28.071Z",
"runtimeJobTemplate": {
"name": "string",
"jobType": "shell",
"comment": "string",
"executable": "string",
"arguments": [
"string"
],
"environments": {},
"customFields": {},
"scripts": [
"string"
],
"audit": {
"creator": "string",
"createTime": "2024-07-29T15:51:28.071Z",
"lastModifier": "string",
"lastModifiedTime": "2024-07-29T15:51:28.071Z"
}
}
}
}
{
"code": 0,
"job": {
"jobId": "job-12345",
"jobTemplateName": "test_run_get",
"status": "succeeded",
"audit": {
"createTime": "2025-08-12T02:14:28.205023Z",
"creator": "anonymous"
},
"queuedAt": "2025-08-12T02:14:28.205023Z",
"startedAt": "2025-08-12T02:14:31.098231Z",
"finishedAt": "2025-08-12T02:15:03.512847Z",
"runtimeJobTemplate": {
"name": "test_run_get",
"jobType": "shell",
"comment": "Test shell job template",
"executable": "/tmp/gravitino-job-staging/job-12345/test-job.sh",
"arguments": [
"value1",
"value2"
],
"environments": {},
"customFields": {},
"scripts": [
"/tmp/gravitino-job-staging/job-12345/common.sh"
],
"audit": {
"createTime": "2025-08-12T02:00:00.000000Z",
"creator": "anonymous"
}
}
}
}
The metalake or job does not exist.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- NoSuchMetalakeException
- NoSuchJobException
Schema
Possible values: >= 1000 and <= 1100
HTTP response code
Internal type definition of the error
A human-readable message
Deprecated diagnostic stack trace. Enterprise omits it by default because it can expose internal implementation details. Operators can opt in for controlled diagnostics with gravitino.server.webserver.includeErrorStackTrace=true. See OWASP REST Security: Error handling and CWE-209.
{
"code": 1002,
"type": "string",
"message": "string"
}
{
"code": 1003,
"type": "NoSuchMetalakeException",
"message": "Failed to operate metalake(s) [test] operation [LOAD], reason [NoSuchMetalakeException]",
"stack": [
"org.apache.gravitino.exceptions.NoSuchMetalakeException: Metalake test does not exist",
"..."
]
}
{
"code": 1003,
"type": "NoSuchJobException",
"message": "Failed to operate job(s) [my_job] operation [GET] under metalake [my_test_metalake], reason [NoSuchJobException]",
"stack": [
"org.apache.gravitino.exceptions.NoSuchJobException: Job xxx does not exist",
"..."
]
}
The server hit an internal error that the client usually cannot fix by changing the request.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- Example
Schema
Possible values: >= 1000 and <= 1100
HTTP response code
Internal type definition of the error
A human-readable message
Deprecated diagnostic stack trace. Enterprise omits it by default because it can expose internal implementation details. Operators can opt in for controlled diagnostics with gravitino.server.webserver.includeErrorStackTrace=true. See OWASP REST Security: Error handling and CWE-209.
{
"code": 1002,
"type": "string",
"message": "string"
}
{
"code": 1002,
"type": "RuntimeException",
"message": "Internal Server Error",
"stack": [
"java.lang.RuntimeException: Internal Server Error"
]
}