Skip to content

Orchestration

Jobs

Declare build, clone, and janitor jobs, per-job settings, overlap, retries, and worker resources.

A job names the nodes a server builds, clones, or cleans up together. Write one .toml file per job under orchestration/jobs/, with a name ending in _job.

SQLBuild Web UI Jobs list showing declared jobs, job groups, selectors, node counts, triggers, and latest runsSQLBuild Web UI Jobs list showing declared jobs, job groups, selectors, node counts, triggers, and latest runs
Jobs and job groups in the Web UI, with selectors, node counts, and latest run status.

A build job runs its select minus exclude, using the same selector grammar as sqb build:

orchestration/jobs/nightly_orders_job.toml
name = "nightly_orders_job"
description = "Orders and their daily totals"
select = "+order_totals"
exclude = "tag:deprecated"
targets = ["production"]
owner = "Orders team"
overlap = "skip"
pools = { warehouse_heavy = 1 }
schedule = { cron = "0 2 * * *", timezone = "Europe/London" }
[retry]
attempts = 3
delay_seconds = 600
[settings]
concurrency = 4
vars = { batch_size = 500 }
[resources]
memory = "3g"
cpus = 2
Key Required Value
name Yes Globally unique name ending in _job
description Yes Shown on the job’s page
select Yes (except janitor jobs) Nodes the job builds or clones
exclude No Nodes removed from select
targets No Targets the job exists in (all targets when omitted)
owner No Shown on the job’s page and in the job list
overlap No queue (default) or skip; see Overlap and retries
pools No Pool slots the job takes, such as { warehouse_heavy = 1 }; see Pools
schedule No Cron or calendar schedule; see Schedules and calendars
[retry] No attempts (2–11) and delay_seconds (0–86400)
[clone] No Turns the job into a clone job; see Clone and janitor jobs
[janitor] No Turns the job into a janitor job; see Clone and janitor jobs
[settings] No Build jobs only. Build options (concurrency, vars, full_refresh, changed, run_tests, ignore_audit_failures, warehouse, etc.); cannot set select or exclude
[resources] No Docker worker limits (memory, cpus, pids); see Limit worker containers

Select pipelines by folder or tag rather than listing nodes individually; rule SQBRORCHESTRATION101 flags jobs naming more than three individual nodes. See Orchestration Rules.

Add [clone] to copy selected relations from another target (as sqb clone does), or [janitor] to archive and prune stale relations on the job’s target (as sqb janitor --auto-approve does):

orchestration/jobs/refresh_dev_job.toml
name = "refresh_dev_job"
description = "Copy finance models from production every morning"
select = "tag:finance"
targets = ["dev"]
schedule = { cron = "0 6 * * *", timezone = "UTC" }
[clone]
from = "prod"
orchestration/jobs/weekly_cleanup_job.toml
name = "weekly_cleanup_job"
description = "Archive and drop relations the project no longer builds"
schedule = { cron = "0 3 * * SUN", timezone = "UTC" }
[janitor]
retention_days = 14
Key Value
clone.from Source target to copy from (must be configured and differ from the job’s target)
clone.hard_copy true to copy data even where zero-copy cloning is available
janitor.retention_days Overrides project retention_days
janitor.direct_state_history_versions Overrides how many state-history versions are kept
janitor.keep_in_use true to keep relations read within in_use_window
Rule Clone job Janitor job
Allowed in a job group No No
[settings], full refresh, or backfill window No No
[retry] Yes No
select / exclude Models, seeds, sources, and functions Not allowed
Selectable by name (sqb build <job>) Yes No

When sqb build, sqb plan, or a server ad-hoc build selects a job by name (nightly_orders_job, job:nightly_orders_job, or job:nightly_*), it applies the job’s [settings] to the job’s own nodes. Selecting the same nodes by tag or path does not apply job settings. Pass --no-job-settings to ignore them.

Precedence (first set wins):

  1. CLI flag (replaces the setting across all named jobs rather than merging, settling disagreements)
  2. Named job’s [settings]
  3. Target setting
  4. Project setting

Note: SQLBUILD_CONCURRENCY acts as a configured limit rather than a CLI flag, so per-job concurrency limits still apply alongside it.

Some settings are node-scoped, so one build naming two jobs can apply different values to each job’s nodes:

Setting Scope
full_refresh Rebuilds the job’s incremental models from scratch and recreates its functions
run_tests SQL unit tests of the job’s models
ignore_audit_failures Audits of the job’s nodes (and singular audits whose referenced nodes all ignore failures)
warehouse Name of a warehouse of the build target, such as "large", for the job’s nodes; see A job’s own warehouse
concurrency Concurrent node cap for that job; the build’s overall limit is max(configured, sum(job limits))
[retry] Retry policy for the job’s nodes

Every other setting (vars, changed, fail_fast, etc.) is build-wide: all named jobs must agree on it unless a CLI flag overrides it. Two named jobs giving the same node conflicting values, or disagreeing on a build-wide setting, fail with S027.

A job’s settings apply only to the job’s own selection (+job:nightly_orders_job builds upstream nodes without the job’s settings). sqb plan --json exposes full_refresh_jobs, job_warehouses, and job_concurrency.

  • overlap = "queue" (default): a schedule tick or sensor request arriving while the job is queued or running queues another run.
  • overlap = "skip": skips the tick or sensor request and logs it in the trigger’s tick history without starting a run. Manual runs, reruns, backfills, and catch-up ticks always queue.
Sensor type Skipped request while job is running
run_event, node_event, platform_event Dropped
source_new_data, source_stale Checked again on the next poll; starts once the job is idle if still true
Polling sensor Starts once idle if the sensor returns the same run_key again

With [retry], a failed node and the nodes it skipped are retried after delay_seconds until they succeed or reach attempts total runs (counted per node). A retry can start while unrelated nodes of the same run are still building once its own upstreams are done; nodes failing while a retry is queued join it. Cancelling a run cancels its queued retries, and manually rerunning a node removes it from a queued retry.

sqb rename and sqb mv automatically update exact model names (including inside +, ,, and ~ expressions) in job and job group selectors:

sqb rename stg_orders stg_orders_clean

Folder selectors move when every model in the folder moves to the same destination; partial folder moves print a note to check manually. Selectors in multi-line TOML strings require a manual edit and block the refactor. Tags, globs, and job: selectors are left unchanged.