Skip to main content

SCALE FROM ZERO WORKERS

This guide shows you how to submit work to an orchestrator with no connected workers and have steps dispatch automatically when a worker connects.

Prerequisites

You need a running orchestrator (swamp serve). No workers need to be connected — that is the point.

Submit a placed workflow

Create a workflow with a placement requirement:

jobs:
  - name: work
    steps:
      - name: process
        task:
          type: model_method
          modelIdOrName: my-model
          methodName: run
        labels:
          pool: on-demand

Run it:

swamp workflow run scale-test

The workflow starts, but the step cannot dispatch because no connected worker matches pool=on-demand. The step enters the queue.

Check the queue

swamp worker queue
REQUIREMENT          STEP      MODEL       QUEUED AT                   AGE
labels pool=on-demand process   my-model    2026-07-07T12:00:00.000Z    10s

The step remains queued until a matching worker connects or the queue timeout expires.

Connect a worker

In a separate terminal, connect a worker with the matching label:

swamp worker connect wss://localhost:9090 \
  --token on-demand-worker.<secret> \
  --label pool=on-demand

The step dispatches immediately. The orchestrator evaluates queued steps on every enrollment event — there is no polling delay.

Verify the workflow completed:

swamp workflow status scale-test

Configure the queue timeout

If no worker connects within the timeout, the queued step fails. The default is 10 minutes.

To change the global default, pass --queue-timeout to swamp serve:

swamp serve --queue-timeout 30m

To override per step, set queueTimeout in the workflow:

- name: process
  task:
    type: model_method
    modelIdOrName: my-model
    methodName: run
  labels:
    pool: on-demand
  queueTimeout: 0

A queueTimeout of 0 disables the timeout entirely — the step queues indefinitely until a matching worker connects or the workflow is cancelled. Use this when an external system (an autoscaler, a CI trigger) is responsible for starting workers and is guaranteed to eventually provide one.

Refer to Workflow Placement for the full placement and queueing reference.