Skip to content

TaskSpec is silently narrower than spawn launch: unknown fields ignored, no root disk, no cost cap, arm64 sizes to a1 #556

Closed

Description

@scttfrdmn

Summary

TaskSpec is a narrower interface than spawn launch, which is reasonable — but
in four places it's narrower silently, and each one produces a plausible-looking
plan instead of an error. They're filed together because they share one root
cause: the spec path has no way to say "you asked for something I can't express."

Found while writing a genomics recipe against spawn task run; every item below
cost real debugging time that a message would have saved.

1. Unknown fields in a TaskSpec are silently discarded

pkg/taskproto/taskspec.go:131 parses with a plain unmarshal:

if err := json.Unmarshal(data, &spec); err != nil {

Validate() then checks only the fields that did parse, so a spec with
misremembered names validates clean. This is what I actually wrote first, having
guessed the schema from the spawn task run --help prose:

"resources": { "cpus": 8, "memory_mb": 16384, "disk_gb": 20 }

Every key is wrong (cpu, memory_gib, and no disk field exists). Result: no
error, and

Instance:     t4g.nano  (2 vCPU, 0 GiB, $0.0042/hr on-demand)
              chosen as cheapest of 1371 matching type(s)

A t4g.nano for a job that asked for 8 vCPU and 16 GiB. Had I not read the
number, this launches and dies on OOM with nothing pointing at the spec. Fix is
one line — dec := json.NewDecoder(...); dec.DisallowUnknownFields() — and it's
the kind of interface where strictness is clearly right: a spec file is authored
once and machine-consumed forever.

2. There is no way to ask for root disk, and the default is 8 GiB

cmd/task.go:626 taskLaunchConfig sets InstanceType, TTL, OnComplete,
AMI, AvailabilityZone, AttachVolumes — but never VolumeSize. And
ResourceRequest/Placement have no field for it. So every task gets the AMI
default, which docs-gen/launch.md:142 describes as --volume-size "0 = use AMI
default", and for AL2023 arm64 that is:

$ aws ec2 describe-images --image-ids ami-07987a01dcdb011ef \
    --query 'Images[0].BlockDeviceMappings[0].Ebs.VolumeSize'
8

8 GiB, of which ~1.9 GiB is the OS. Placement can attach a snapshot volume or
mount FSx/EFS, which covers shared reference data — but not "this task stages 12
GiB of inputs", which is an ordinary case and the common one in bioinformatics.
The obvious shape is ResourceRequest.DiskGiB, mapping to --volume-size,
which the launch path already supports.

Related and cheap: --dry-run prints CPU/memory/TTL/cost but not the root volume
size, so there's nothing in the preview that would make an author notice.

3. No cost cap on the task path

spawn launch has --cost-limit; taskLaunchConfig sets no equivalent and
TaskSpec has no field. So on the task path the TTL is the only spend bound.
That's workable — it's what I used — but it means a cost ceiling can only be
expressed by shortening the deadline, which conflates two different intents.

4. architecture: arm64 with no families sizes to a1

Not a bug, but a sharp edge. Given only:

"resources": { "cpu": 8, "memory_gib": 16, "architecture": "arm64" }

the sizer returns:

Instance:     a1.2xlarge  (8 vCPU, 16 GiB, $0.2040/hr on-demand)
              chosen as cheapest of 295 matching type(s)

a1 is Graviton 1, launched 2018 — cheapest per hour, and materially slower per
vCPU than c8g, so quite possibly more expensive per job. "Cheapest that fits"
is the documented contract and families: ["c8g"] fixes it, so this may just
want a line in the docs — but an author writing arm64 almost certainly means
"modern Graviton", and a --dry-run line noting the family generation would make
the surprise visible before launch rather than after.

Also: the schema is only discoverable from source

spawn task run --help describes the behaviour well but names no fields, and
examples/task-spec.json shows a subset. I converged on the real contract by
reading pkg/taskproto/taskspec.go — which worked precisely because the repo is
public, but it means the required fields (task_id, command, lifecycle.ttl),
the argv-not-string convention, and the source/destination manifest keys are
undocumented. A generated field reference from the struct tags would fix this and
item 1 together: with DisallowUnknownFields the error message becomes the
documentation.

Activity

  1. scttfrdmn commented on Sep 2, 2026

    @scttfrdmn
    ContributorAuthor

    5. Stage-in/stage-out floods command.log with aws s3 cp progress lines

    The wrapper's staging calls run aws s3 cp with default progress output. In a
    non-interactive context that is not a redrawn status line — every refresh is
    appended, so the durable log fills with carriage-return-separated fragments:

    Completed 370 Bytes/370 Bytes (6.8 KiB/s) with 1 file(s) remainingupload: ../../tmp/smoke-check.txt to s3://...
    

    On the align task of a genomics recipe this produced roughly 200 KB of progress
    noise
    around a 227 MiB upload, which is most of the log by volume. The practical
    cost is that command.log is the one durable record of what the task did after
    the instance is gone, and reading it means filtering first — I ended up piping it
    through grep -v to find a six-line smoke-check result.

    Fix is a flag on the staging calls in pkg/taskproto/wrapper.go:
    --only-show-errors (quietest, keeps failures) or --no-progress (keeps the
    per-file upload:/download: lines, which are the useful part). Either leaves
    the log readable without losing anything diagnostic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions