Run job
POST/metalakes/:metalake/jobs/runs
Starts a job from a job template and returns the new job in the queued status. Values in jobConf replace the matching {{name}} placeholders in the template.
Sign in with a bearer token or a local user's password; see Authentication.
Request
Path Parameters
The name of the metalake
- application/json
Body
The name of the job template to run
jobConf
object
The job configuration for the job run
Responses
- 200
- 400
- 404
- 5xx
The new job in the queued status, with its ID, template name, queue time and the resolved template that will be submitted.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- JobRunResponse
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": "queued",
"audit": {
"createTime": "2025-08-12T02:14:28.205023Z",
"creator": "anonymous"
},
"queuedAt": "2025-08-12T02:14:28.205023Z",
"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 job executor cannot start the job, for example because a required executor setting such as the Spark home is not configured.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- JobRunIllegalArgumentException
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": 1001,
"type": "IllegalArgumentException",
"message": "Failed to operate job(s) operation [RUN] under object [my_test_metalake], reason [gravitino.jobExecutor.local.sparkHome or SPARK_HOME environment variable must be set for Spark jobs]",
"stack": [
"java.lang.IllegalArgumentException: gravitino.jobExecutor.local.sparkHome or SPARK_HOME environment variable must be set for Spark jobs",
"..."
]
}
The metalake or job template does not exist.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- NoSuchJobTemplateException
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": "NoSuchJobTemplateException",
"message": "Failed to operate job template(s) [my_job] operation [GET] under metalake [my_test_metalake], reason [NoSuchJobTemplateException]",
"stack": [
"org.apache.gravitino.exceptions.NoSuchJobTemplateException: Job template 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"
]
}