Skip to content

pipeline: re-launching a definition overwrites the in-flight record, and stale markers under the same s3_prefix decide the new run #943

Closed

Description

@scttfrdmn

Found while fixing #910/#911 (PR #942). Found by reading the code; not reproduced against AWS.

pipeline_id comes from the definition file (examples/pipelines/ml-training.json uses ml-training-20260129), so running the same file twice reuses it. Two things then go wrong:

1. The second launch overwrites the first pipeline's record. spawn pipeline launch → pipeline.Store.Put is an unconditional PutItem keyed on pipeline_id. If the first run is still in flight, its record is replaced with a fresh INITIALIZING record with no stages. The first run's orchestrator chain reloads state on every poll (loadStateFn), and its instances are no longer in any record. Only their own self-termination and the TTL reaper reclaim them (#912 made that possible). The two orchestrator chains then run against one record.

2. Stale markers decide the new run. Markers and outputs are keyed by <s3_prefix>/stages/<stage-id>/… (pipeline.StageMarkerKey), not by pipeline id or run. A second run under the same prefix finds the first run's COMPLETE, and the orchestrator marks the stage completed as soon as it reaches running, before its instance has done anything. Its dependents launch and download the first run's outputs. A stale FAILED fails a fresh run instead. This applies to any two runs sharing an s3_prefix, whether or not the ids match.

Suggested: make Put conditional (attribute_not_exists(pipeline_id)) and refuse a duplicate id, or generate a run id. Key markers and outputs by run (e.g. <prefix>/runs/<run-id>/stages/…), or have the orchestrator delete the stage keys before it launches the stage.

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