CLI examples — Queues and jobs
Part of the CLI examples cookbook. Auth setup lives on Auth + setup.
Queues
A queue is the unified scheduling primitive: a named pipe of
pending Invocations that daemons subscribe to by name. Workers register
themselves into queues via Worker.queues: string[]; the empty array
means the default queue (there is no sentinel name). See
Queues and /dev/queues for the
concept and design pages.
It is lakeshore queues ls and lakeshore queues rm — not list
and remove. Every other group in the CLI uses list / remove; this
one doesn't.
The full verb set is add, ls, show, patch, archive,
unarchive, drain, rm, events, stats.
queues add — create a queue
The bare minimum is a name (matching ^[a-z0-9][a-z0-9-]*$).
--kind is one of fifo (default), priority, boltzmann, filo.
queues add — with an elasticity declaration
--elasticity accepts fixed, fully-elastic, pool-with-threshold,
or max-count, with --min, --max, and --threshold (0.0–1.0)
supplying its parameters. --instance-type, --image-id, and
--runner seed the daemon template used when the queue scales up.
--max-depth plus --on-full (reject or block) bound the backlog.
The --elasticity flag takes hyphenated values
(fully-elastic, pool-with-threshold, max-count), while the
elasticity.kind field in lakeshore.yaml accepts only the
underscored spellings (fully_elastic, pool_with_threshold,
max_count). They are not interchangeable.
queues ls — list queues
--state filters on active, draining, paused, or archived.
The table shows NAME / KIND / STATE / MEMBERS / PROVIDER / ELASTICITY / DESCRIPTION. MEMBERS is the count of workers whose
queues array contains this queue's name.
queues show — one queue and its members
queues patch — mutate a queue in place
Accepts --description, --provider, --min, --max,
--threshold, --max-depth, --on-full, and --json. Note it does
not accept --kind or --elasticity.
queues drain / archive / unarchive
drain stops admitting new work but lets in-flight invocations finish.
archive soft-deletes — the row survives but stops accepting work.
unarchive re-activates a drained or archived queue. All three take a
name and --json.
queues rm — delete
Errors if any worker is still bound to the queue. --force cascades —
it scrubs the queue name out of every Worker.queues array first.
queues events — the elasticity audit trail
One row per controller decision. tick_noop rows are hidden unless you
pass --verbose, which is the quickest way to check whether the
controller is running at all. --limit defaults to 50, capped at 200.
queues stats — current signals
A point-in-time view of what the controller is looking at: daemon count, utilization, pending invocations, and the last few non-noop scale actions.
Jobs
Invocations tracked by the control plane — the things @dls.udf calls
queue up.
jobs list — recent invocations
--limit is 1–200 (default 50) and --offset defaults to 0.
jobs list — filters
--state is repeatable and accepts queued, running, succeeded,
failed, killed, timeout. --worker and --queue take ids.
jobs show — one invocation
jobs kill — cancel one invocation
Queued jobs are marked killed immediately. Running jobs return
409 — to stop in-flight work, kill the process on the daemon
(lakeshore daemon exec) or drop the daemon itself.
jobs bulk-cancel — cancel everything queued
Only touches rows in state queued; running work is untouched.
Read next
- Queues — the concept.
- Elasticity · Scaling rules
- Daemons + exec/run — binding workers to queues.