Skip to content
Stackship documentation Svenska

JobsUsers

Job settings

The fields of a job, their defaults, the compute plans, the statuses and the API routes.

Fields

Field Default Meaning
image — (required) The container image, without its tag, for example ghcr.io/example/importer
tag latest The image tag
clusterId — The cluster to run on; it must be one the boundary is projected into. A job without it is refused
computePlan standard CPU, memory and temporary disk; see Compute plans
env none Environment variables as name–value pairs, in plain text
activeDeadlineSeconds 3600 How long the job may run, counted from when it is created, including time spent waiting for its pod and image. When it passes, the job is stopped and fails
ttlSecondsAfterFinished 3600 How long a finished job is kept. Then the job, its pod and its output are removed

The job's name is part of the path, not a field. A job shows these read-only fields as well:

Field Meaning
name, resourceGroup Where the job is
status See Statuses
createdAt When the job was created
completedAt When the job succeeded; empty for a job that failed or has not finished

When you read a job back, computePlan always shows standard and clusterId is empty, whatever the job was created with; the job still runs with the plan it was given.

The platform sets no upper limit on activeDeadlineSeconds or ttlSecondsAfterFinished. A job cannot be changed after it is created.

Compute plans

Plan CPU Memory Temporary disk
nano 0.1 128 MiB 500 MiB
small 0.25 256 MiB 1 GiB
medium 0.5 512 MiB 2 GiB
standard 1 1 GiB 3 GiB
large 2 2 GiB 5 GiB
xlarge 4 4 GiB 10 GiB
2xlarge 8 8 GiB 20 GiB

The job gets exactly its plan: the values are both what it is guaranteed and its limit. A job that needs more memory or temporary disk than its plan is stopped and fails. Any other plan name is refused with unknown compute plan.

Statuses

Status Meaning
Pending The job is created but has no pod yet. A job whose pod is never created — for example because a resource quota is used up — keeps showing Pending even after its deadline has stopped it, until it is removed
Running The job's pod exists and has not finished. This includes a pod still waiting for its image: a job whose image cannot be pulled stays Running until its deadline stops it
Succeeded The container exited with code 0
Failed The container exited with another code, used more memory or temporary disk than its plan, or was stopped at the deadline

API

All routes are under https://api.example.com/boundaries/{boundaryId}/resourcegroups/{resourceGroupName}/resources/jobs.

Method and path Does Needs
POST …/jobs/{name} Creates the job from the fields above jobs/write
GET …/jobs Lists the resource group's jobs, at most 50; there is no paging jobs/read
GET …/jobs/{name} Returns one job jobs/read
DELETE …/jobs/{name} Deletes the job, its pod and its output jobs/delete
GET …/jobs/{name}/logs Streams the job's output as plain text jobs/readLogs

A create that is refused answers 400 with one of image is required, unknown compute plan '<plan>' or failed to create job. A job that does not exist, or has been removed after its time to live, answers 404 with job '<name>' not found. A delete answers 204 also when there was no such job.