Skip to content

pipeline: with instance_count > 1 the first instance to finish marks the whole stage complete, and the budget uses a flat $0.10/hour #930

Closed

Description

@scttfrdmn

Found while fixing #912. Found by reading the code; not reproduced against AWS.

1. Per-stage, not per-instance, markers. Every instance of a stage writes the same key, <prefix>/stages/<stage-id>/COMPLETE (or FAILED), in the user data from generatePipelineUserData. The orchestrator's checkStageOutcome treats the marker's existence as the stage's result. For a stage with instance_count: 4, the first instance to finish marks the stage completed. Its dependents launch while the other three are still running, and the stage's cost and duration are computed from that moment. A sibling that fails later writes FAILED, but by then the stage is already completed and nobody reads it.

After #912 this is not a leak: each sibling terminates itself when it exits and carries a TTL. It is a correctness bug: downstream stages can start before their inputs exist (moot until #911 wires data handoff, but it will matter then).

Suggested: write per-instance markers (stages/<id>/<instance-index>/COMPLETE) and complete the stage when all instance_count have reported COMPLETE. Fail it as soon as any one reports FAILED, which #912 already does for the shared key.

2. The budget is not measured. calculateStageCost charges every instance hour at a hardcoded $0.10, whatever the instance type, spot or on-demand. max_cost_usd is compared against that figure, so on a p4d.24xlarge (~$32/h) the tracked cost is about 1/300th of the real spend: a $100 budget lets roughly $30,000 through before it fires. It also counts only completed stages, so a long-running stage costs nothing until it finishes. The notification reports this number as "Total cost".

Suggested: price from the instance type (the CLI already has pricing), count running stages' elapsed hours, or stop presenting max_cost_usd as a spend control until it is one.

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