Skip to content

Conversation

@peterschmidt85
Copy link
Contributor

Fixes #3182

Comment on lines 617 to 618
# TODO: Migrate to EnumAsString(InstanceTerminationReason, 100) after enough releases to ensure backward compatibility
termination_reason: Mapped[Optional[str]] = mapped_column(String(4000))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens after enough releases? Old instances continue to have non-enum values forever.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed by using InstanceTerminationReason straight away and converting old non-enum values to InstanceTerminationReason on reads

@github-actions
Copy link

This PR is stale because it has been open for 14 days with no activity.

@github-actions
Copy link

This PR is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale label Nov 29, 2025
@github-actions
Copy link

github-actions bot commented Dec 7, 2025

This PR was closed because it has been inactive for 7 days since being marked as stale. Please reopen the PR if it is still relevant.

Use the `InstanceTerminationReason` enum as the
type of `InstanceModel.termination_reason`. To
handle old instances, automatically convert their
legacy termination reason strings to relevant
`InstanceTerminationReason` enum members on reads.
- Drop `starting_timeout`, use
  `provisioning_timeout` instead. These two
  termination reasons had similar semantics. The
  difference was that `starting_timeout` was used
  for cloud instances and `provisioning_timeout`
  for SSH.
- Rename `termination_deadline` -> `unreachable`.
  The old name was based on implementation details
  rather than semantics, so it was not very
  informative to the user.
- For `no_offers`, add a termination reason
  message to highlight the difference between
  failing to find offers and failing to provision
  offers.
To avoid extra testing and changes, limit the
scope of the PR to instance termination reasons,
as per the PR name.

The introduction of
`JobTerminationReason.NO_BALANCE` can be done in a
separate PR. Its implementation may need to be
updated to also use
`JobTerminationReason.NO_BALANCE` on jobs with
statuses other than `running`.
@jvstme
Copy link
Collaborator

jvstme commented Dec 18, 2025

Updated the PR, addressed the pending review comment, and added small changes to termination reason naming. Also slightly reduced the scope of the PR. See commit messages for details and motivation

@jvstme jvstme requested review from r4victor and removed request for jvstme December 18, 2025 23:40
@github-actions github-actions bot removed the stale label Dec 19, 2025
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.

[Internal]: Replace Instance.termination_reason values with codes

4 participants