Skip to content

Which execution tool? ​

Spawn is an execution substrate with several extension layers, and they solve different problems β€” they aren't ranked alternatives. Start here before diving into any individual guide; then follow the link.

The layers at a glance ​

LayerThe question it answers
Instance pluginWhat software or service should exist on an instance?
Parameter sweepHow do I run one command over varying parameters?
Job arrayHow do I run indexed copies of the same workload?
Instance queueHow do I run several dependent steps sequentially on one machine?
Spawn pipelineHow do I run a DAG of coarse stages across different machines?
MPI clusterHow do I run tightly-coupled code across many nodes at once?
Task (spawn task run)How do I run one command from a spec that stages inputs from S3, runs, and stages outputs back?
Worker pool (spawn pool)How do I run many short tasks without booting an instance per task?
Workflow adapterHow does my existing workflow engine use spawn as its executor?

By what you're trying to do ​

I want to…Use
Install RStudio, Tailscale, or Globus on an instanceInstance plugin
Run one command over several parameter valuesParameter sweep
Divide one dataset into indexed shardsJob array
Run several steps on one instance (shared local data/env)Instance queue
Use different machines for a few coarse stagesSpawn pipeline
Run tightly-coupled parallel code (one job, many nodes)MPI cluster
Run one containerized or host command with S3 inputs/outputs and a durable completion recordspawn task run
Run many short tasks (hundreds or more) through reusable workersspawn pool
Already have a Nextflow / WDL / CWL / Snakemake workflowThe matching adapter
Add one heavy compute step to a business/ETL DAGAirflow operator
Run a large, complex scientific DAGAn established workflow engine via its adapter β€” not a spawn pipeline

The two easy-to-confuse pairs ​

Sweep vs. array. A sweep runs the same command over different declared parameter values (one instance per combination). An array runs the same workload with index-based partitioning: each member gets $JOB_ARRAY_INDEX and $JOB_ARRAY_SIZE and processes its own shard.

Instance queue vs. pipeline. An instance queue runs multiple dependent steps sequentially on one machine β€” ideal when the steps share large local files, packages, or model weights and you don't want to pay to boot (and re-stage) a machine per step. A pipeline runs a DAG across separate machines, so each stage can use different (and differently-sized) compute, with data handed off through S3.

When not to use a spawn pipeline ​

spawn pipeline is a compact orchestrator for small, coarse, infrastructure-shaped DAGs β€” tens of stages, not millions of tasks. It deliberately does not do advanced caching, dynamic DAG generation, nested workflows, or a rich conditional language. For complex scientific pipelines (per-sample fan-out, scatter/gather, resume/caching semantics), use a real workflow engine through its adapter and let spawn be the executor underneath.

When per-task ephemeral instances fit β€” and when they don't ​

Most layers here launch (and pay to boot) at least one EC2 instance per unit of work; spawn pool is the exception. That's a great fit for some shapes and a poor one for others:

  • Good fit: tasks lasting tens of minutes to hours; heterogeneous resource needs per task; full-VM requirements; expensive accelerators you only want for the duration of the work.
  • Poor fit: thousands of sub-minute tasks; extremely chatty workflows; tasks needing shared POSIX state; pipelines dominated by repeated environment setup. For those, prefer a worker pool, an instance queue (batch the steps onto one machine), or a standing cluster / AWS Batch.

Tasks and worker pools ​

spawn task run runs one command described by a TaskSpec JSON file, the contract the workflow adapters use. spawn picks the cheapest instance type that fits (or the one you pin), stages inputs from S3, runs the command (inside a container if the spec names one), stages outputs back, and writes a durable completion record to S3 that spawn task status reads. The instance self-terminates when it's done.

Worker pools for many short tasks ​

At high fan-out, one instance per task is dispatch-bound: every task pays a full boot, and short tasks finish faster than new instances launch. spawn pool inverts that. spawn pool create provisions N reusable workers and a run-scoped SQS queue; spawn pool submit stages a task spec and enqueues it; workers pull tasks until the queue is empty. A worker whose queue stays empty for --idle-timeout terminates, so nothing is left billing (since spawn v0.136.0; older workers were stopped instead). spawn pool status shows the queue depth, and spawn pool drain deletes the queue, after which each worker terminates at its next poll. Ask for N workers and get M, and the tasks still drain through whatever pool came up. See Tasks and worker pools and the command reference.

See also Costs & safety guarantees for how the TTL bounds the cost of any of these.