Skip to main content

Jobs

A job is one run of a job template. The UI lists the metalake's jobs with the template each ran from and its status, and a job can be started from a template or cancelled from there.

Quick Start

1. Run a template. jobConf supplies values for the template's parameters.

curl -sS -X POST "https://{gravitino_host}/api/metalakes/{metalake}/jobs/runs" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"jobTemplateName": "{template}", "jobConf": {"{parameter}": "{value}"}}'

The response carries the job's id.

2. Check its status.

curl -sS "https://{gravitino_host}/api/metalakes/{metalake}/jobs/runs/{job_id}" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Authorization: Bearer $TOKEN"

3. Read its output. Add includeOutput=true to return the job's captured stdout and stderr with it, so a failure can be diagnosed without access to the server's staging directory.

curl -sS "https://{gravitino_host}/api/metalakes/{metalake}/jobs/runs/{job_id}?includeOutput=true" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Authorization: Bearer $TOKEN"

Job Status

StatusMeaning
QUEUEDWaiting to be executed
STARTEDCurrently executing
SUCCEEDEDFinished successfully
FAILEDFinished with an error
CANCELLINGCancellation requested, not yet complete
CANCELLEDCancellation complete

Status is polled from the executor rather than pushed, so it can lag the real process by up to gravitino.job.statusPullIntervalInMs. A job that reads as running for a few minutes after it finished is lagging, not stuck. See Automation.

Cancelling a Job

Cancellation is a request rather than an instant, which is why CANCELLING and CANCELLED are separate. A job that finishes before the cancellation lands stays in its finished state.

curl -sS -X POST "https://{gravitino_host}/api/metalakes/{metalake}/jobs/runs/{job_id}" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Authorization: Bearer $TOKEN"

Endpoints

Paths are relative to https://{gravitino_host}/api/metalakes/{metalake}.

OperationMethodPath
Run a templatePOST/jobs/runs
List jobsGET/jobs/runs
List jobs for one templateGET/jobs/runs?jobTemplateName={template}
Get a jobGET/jobs/runs/{job_id}
Cancel a jobPOST/jobs/runs/{job_id}

Running a job takes RUN_JOB and USE_JOB_TEMPLATE for its template. See Automation.