Skip to content

feat(launch): implement inline --params; examples use --param-file; gate every spawn launch in examples (#1540) - #1544

Merged
scttfrdmn merged 4 commits into
mainfrom
fix/1540-inline-params
Nov 6, 2026
Merged

scttfrdmn merged 4 commits into
mainfrom
fix/1540-inline-params

Conversation

@scttfrdmn

@scttfrdmn scttfrdmn commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1540

Based on main after #1542 (#1532) merged.

Examples: param files go to --param-file

Every example that gave a file to --params now uses --param-file, and each corrected command was checked against today's flags.

  • examples/README.md: the staging, hyperparameter-search and MPI commands, plus the batch-queue and collect commands.
  • The workflow examples:
    • Snakemake: Snakefile and README.md.
    • Airflow: README.md, parameter_sweep_dag.py, taskflow_dag.py, operators/spawn_operator.py.
    • Argo, CWL, WDL, Dagster, Luigi, Prefect, Step Functions, Temporal.
  • examples/genomics-wdl/gatk-germline/README.md.

What swapping the flag alone would have left broken:

  • sweeps/hyperparameter-search.yaml, staging/reference-genome.yaml and the GATK samples.yaml were not param files (top-level sweep_name:, count:, base_command:). They are now real ones: a grid: for the 48-trial search, and one row per sample with the script in defaults: command:.
  • The README's MPI command passed --mpi to a sweep, which refuses it. It is now a job array: spawn launch my-mpi-run --count 16 --mpi --efa …. mpi-simulation.yaml now says it is a description of the job, not a param file.
  • The Snakefile's wait_sweep launched a second sweep in order to wait. launch_sweep now uses --detach --wait --output-id, and wait_sweep reads spawn sweep status --output json.
  • Commands with no spore name: the batch-queue ones and two GATK launches. GATK also used --storage and --tags, which don't exist, and --iam-policy s3:FullAccess, which needs --iam-allow-full-access. Collect used --output top5.csv, which is the global output-format flag.

Inline --params

  • --params takes a JSON document in the JSON param-file schema (defaults/params/grid). It is parsed by the same code as a .json param file: parseJSON is split into decodeJSON, which is shared, and the new pkg/params.ParseParamJSON.
  • A value that isn't JSON and looks like a path fails with --params takes inline JSON; to use the file <path>, pass --param-file <path>. "Looks like a path" means it names an existing file, or ends in .yaml/.yml/.json/.csv whether or not the file exists. Only os.Stat is called, and the file is never read.
  • --params with --param-file is refused.
  • JSON syntax and type errors give their line and column, for --params and .json param files alike.
  • These checks run in runLaunch before any AWS call.
  • A --no-detach checkpoint stores the document (inline_params), so spawn resume can rebuild an inline sweep.
  • Error messages that named the param file name --params (inline JSON) instead.
  • The flag help is updated, with no backticks (launch --help: --name and --fsx-lifecycle show a backticked command as their placeholder #1520), and docs-gen is regenerated.

Example gate (extends #1542's)

cmd/example_launch_gate_test.go finds every spawn launch under examples/ (40 today):

  • Markdown fenced code and inline code spans (prose is skipped).
  • Snakefile, WDL and Argo YAML shell commands, with \ continuations.
  • Usage lines in comments.
  • Python ['spawn','launch',…] lists and string commands, including implicit string concatenation.
  • A CWL baseCommand: [spawn, launch] tool's bindings.

Each invocation must parse with launch's flags and pass the spore-name rule, sweepUnsupportedFlags and the param-source checks. A concrete param file that exists must parse and pass the key checks.

Placeholders. {SWEEP_FILE}, ~{params_file}, {{…}}, <sweep-id>, $VAR, … and a Python expression are recognised by their characters.

  • They are accepted as values and never opened. For a non-string flag, a placeholder is replaced by a typed sample.
  • Under --params a placeholder is an error, because there it can only stand for a file.
  • Inline code fragments and invocations elided with … are excused only from the name rule.

The gate parses into a copy of the flag definitions. pflag's Set on a slice flag sets an internal "changed" bit that can't be cleared, which leaked --tag "[]" into later tests.

Revert evidence

  • Examples reverted to main: the gate fails 30 invocations, 23 of them on --params.
  • Inline parsing reverted to "not yet implemented": 4 tests fail.
  • Path detection and the conflict check reverted: the path test (4 cases) and the conflict test fail.
  • withJSONPosition reverted: the position tests in cmd and pkg/params fail.

Checks

  • make check
  • hermetic go test ./... with AWS env stripped
  • make test-e2e-tier0
  • semgrep scan --config=auto --error .: 0 findings
  • make api-snapshot and make cli-iam-actions: no change (pkg/params is outside the snapshot surface)

Follow-ups filed: #1543, and spore-host/spore-host#637 for the umbrella guide, which says inline --params is not implemented. That one is an issue rather than a PR, because the change documents an unreleased flag. The workflow examples check a sweep with spawn status <sweep-id>, which looks the ID up as an instance, and dagster relaunches the sweep to wait.

@scttfrdmn

Copy link
Copy Markdown
Contributor Author

Live check at 7fb4c8c0: PASS (aws account 942542972736, us-east-1).

  • A path passed to --params: spawn launch --params examples-missing.yaml returns --params takes inline JSON; to use the file examples-missing.yaml, pass --param-file examples-missing.yaml, with no AWS call made.
  • Inline JSON sweep: spawn launch --params '{"defaults":{"instance_type":"t4g.small","region":"us-east-1","ttl":"15m"},"params":[{"run":1},{"run":2}]}' --sweep-name lc1540 --command true --no-detach --on-complete terminate --yes exits 0. It launched lc1540-0 and lc1540-1 (t4g.small).
  • Teardown: both are terminated and verified with wait instance-terminated.

@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.22727% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/launch_sweep_params.go 87.87% 4 Missing ⚠️
cmd/resume.go 60.00% 4 Missing ⚠️
pkg/params/parser.go 88.46% 3 Missing ⚠️
cmd/launch_sweep.go 71.42% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 604611b into main Nov 6, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1540-inline-params branch November 6, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

examples pass a param file to --params, which is inline-JSON only and unimplemented

1 participant