Skip to content

Workflow ecosystem: shared task-execution protocol + adapter library #386

Closed

Description

@scttfrdmn

Problem

The five workflow-engine adapters (nf-spawn, miniwdl-spawn, cwl-spawn, snakemake-executor-plugin-spawn, spawn-airflow) each independently reimplement the same machinery: config/resource parsing, resource→instance mapping via truffle, S3 input/output staging, user-data construction, launch, polling, cancellation, .exitcode interpretation, and error translation. This is confirmed by inspection — the Java (nf-spawn) and four Python repos share no common library. That will drift: staging behavior, retry classification, and completion semantics will diverge subtly across adapters.

Raised by an external architecture review of the extension/workflow subsystem.

Proposed shape

A formal Spawn task-execution protocol + a shared adapter library defining common types, so each adapter only translates its native task object into this protocol:

  • TaskSpec (command, container, resources, inputs, outputs, lifecycle)
  • ResourceRequest (cpu, memory_gib, architecture, families, purchase, fallback, headroom)
  • InputManifest / OutputManifest (S3 ↔ local staging)
  • LaunchResult, TaskState, CompletionRecord (durable .exitcode-in-S3)
  • Cancellation, RetryClassification (app-exit vs capacity vs spot-interrupt vs staging vs TTL vs controller-lost)

Example TaskSpec (JSON) is in the review.

Related sub-proposals (may be separate issues or folded here)

  • Shared capacity broker: unify truffle sizing + quota check + Spot fallback + Lagotto waiting behind one placement policy, instead of each adapter calling spawn directly.
  • Short-task instance reuse / pooling: avoid a fresh EC2 boot per sub-minute task where a warm instance could serve several.
  • Execution manifest / provenance record: machine-readable record per task (spawn+adapter+engine versions, AMI, instance type, arch, region/AZ, container digest, plugin versions, command, env allowlist, input object versions, spot vs on-demand, start/end, exit code, termination reason) for reproducibility.

Docs note

The docs (docs/guides/workflow-engines.md) now point users here when explaining that adapters are early/experimental and share an evolving execution model. Benefits: consistent staging/logs/retries/telemetry, shared tests, easier new integrations.

Activity

  1. added
    enhancement
    on Jul 19, 2026
  2. scttfrdmn commented on Jul 19, 2026

    @scttfrdmn
    ContributorAuthor

    Sub-proposals now tracked as: #387 (plugin inspect/dry-run), #388 (plugin permissions block), #389 (first-class array reporting), #390 (sweep grid expansion), #391 (task diagnose), and spore-host/spore-plugins#8 (registry supply-chain). The execution-manifest/provenance idea lives in #391's orbit and this issue.

  3. scttfrdmn commented on Jul 19, 2026

    @scttfrdmn
    ContributorAuthor

    Design RFC drafted in PR #397 (docs/workflow-adapter-protocol-rfc.md) — proposes the TaskSpec/CompletionRecord/RetryClassification contract, a Go reference impl, and a phased migration for the five adapters, with explicit open decisions. This issue stays open to track the decision + implementation.

  4. scttfrdmn commented on Jul 19, 2026

    @scttfrdmn
    ContributorAuthor

    Reopened: PR #397 landed the design RFC (docs/workflow-adapter-protocol-rfc.md), not the implementation. This issue stays open to track the open decisions in the RFC and the actual pkg/taskproto + adapter migration.

  5. scttfrdmn commented on Jul 19, 2026

    @scttfrdmn
    ContributorAuthor

    Increment 1 landed in PR #399: pkg/taskproto (TaskSpec/ResourceRequest/Manifest/Lifecycle + offline Validate), the cheapest-instance sizer (multi-family allow-list + memory headroom over truffle), and spawn task run --spec … --dry-run (sizes + prints a plan, launches nothing; example at examples/task-spec.json). Still open for the later increments: real launch, the durable .exitcode-in-S3 CompletionRecord, RetryClassification, and adapter migration.

  6. 2 remaining items

  7. scttfrdmn commented on Jul 20, 2026

    @scttfrdmn
    ContributorAuthor

    Adapter migration complete — all 5 adapters on the shared protocol ✅

    All five workflow adapters now dispatch each task via spawn task run (build a TaskSpec → detached run / --wait → CompletionRecord), instead of each reimplementing launch/sizing/staging/completion. Each was validated end-to-end on real AWS (gated, TTL-bounded, leak-checked) before release.

    Adapter Release Smoke
    cwl-spawn v0.2.0 ✅ hello.cwl
    miniwdl-spawn v0.2.0 ✅ hello.wdl (container)
    spawn-airflow v0.2.0 ✅ SpawnRunTaskOperator
    snakemake-executor-plugin-spawn v0.2.0 ✅ snakemake --executor spawn
    nf-spawn v0.9.0 ✅ Nextflow pipeline

    Contract shipped

    Bugs the smokes caught (all fixed pre-release)

    1. cwl-spawn job dir /mnt → /var/tmp (unprivileged command user can't mkdir under root-owned /mnt).
    2. miniwdl empty-input work/ never recreated → mkdir -p before cd.
    3. snakemake S3 storage plugin needs bucket-level ListBucket → drove the s3_read_write TaskSpec field (feat(task): TaskSpec resources.s3_read_write + placement block (spawn#386) #414).
    4. nf-spawn exact-type regression (t3.medium→t3.nano) → drove the instance_type pin (Add resources.instance_type to TaskSpec for exact instance-type pinning #413).
    5. nf-spawn completion-signal race (staging script's SPAWN_COMPLETE vs the wrapper's) → signalCompletion flag.

    Every smoke instance self-terminated; zero leaks. Container execution, the shared protocol, and all five adapters are done — this can close.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions