Skip to content

SageMaker: simulate CapacityError in DescribeTrainingJob (FailureReason) for capacity-retry testing #299

Closed

Description

@scttfrdmn

Summary

The SageMaker plugin (added in #238) emulates CreateTrainingJob / DescribeTrainingJob / StopTrainingJob / ListTrainingJobs, and DescribeTrainingJob currently reports a training job as Completed. There's no way to make a job come back Failed with a CapacityError, which is the exact signal a "retry until capacity is available" tool needs to test.

Why it matters

lagotto's SageMaker watch (spore-host/lagotto#14) follows the "the launch is the capacity test" model: it submits the user's training job and retries on CapacityError until SageMaker provisions it. Unlike EC2 (synchronous InsufficientInstanceCapacity), SageMaker reports capacity failure asynchronously:

  • CreateTrainingJob returns 200 with an ARN
  • a later DescribeTrainingJob returns TrainingJobStatus = Failed with FailureReason containing the literal string:

    CapacityError: Unable to provision requested ML compute capacity. Please retry using a different ML instance type.

Against substrate today, a submitted job always reports Completed, so we can test the submit → success path but not the submit → CapacityError → retry path (the whole point of the feature). That branch is currently covered only by a pure unit test of the classifier; an end-to-end poller test isn't possible.

Requested

A way to make DescribeTrainingJob return a Failed status with a configurable FailureReason. Options, roughly in order of preference:

  1. Trigger by instance type / job name convention — e.g. a job requesting a designated "exhausted" instance type, or a job name containing a sentinel (e.g. *-capacityfail-*), returns Failed + a CapacityError FailureReason. Zero new API surface; easy for tests to opt into.
  2. A control/seed endpoint — let tests pre-seed "type X in region Y has no capacity," so DescribeTrainingJob for a job on that type transitions to Failed with the CapacityError reason (mirrors how EC2 capacity is seeded, if applicable).
  3. Configurable job outcome — a substrate-specific field/tag on CreateTrainingJob that sets the eventual terminal status + FailureReason.

Also useful (secondary): expose the SecondaryStatus field (Starting/Pending/Downloading/Training) so the "Pending = waiting on capacity" intermediate signal can be tested, though the terminal Failed+CapacityError case above is the priority.

Context

Activity

  1. scttfrdmn commented on Jun 2, 2026

    @scttfrdmn
    OwnerAuthor

    Implemented in #300 (branch feat/issues-297-298-299). Will close on merge via the PR's Closes #299 keyword.

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