Skip to content

Conversation

@peterschmidt85
Copy link
Contributor

Fixes #1154

@peterschmidt85 peterschmidt85 marked this pull request as ready for review December 30, 2024 22:17
idle_duration: Annotated[
Optional[Union[Literal["off"], str, int]],
Field(
description="Time to wait before terminating idle instances. Defaults to `5m` for runs and `3d` for fleets. Use `off` for unlimited duration"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if off is better than -1. For me, off is ambiguous: does it mean “no duration” (= unlim, = -1, = don't destroy) or “no idle” (= 0, = destroy immediately after use). I personally would prefer -1 for “never destroy”, 0 for “destroy immediately” and > 0 for “destroy if idle for N days (minutes, hours, …)”

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In general I agree about -1 being potentially better than off. On the other hand:
a) We already support off with max_duration
b) -1 is a bit too technical
Perhaps, we could later support t-1 too as a synonym for off. Okay?

Copy link
Collaborator

Choose a reason for hiding this comment

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

a) Ah, I see
b) Agree, but, as far as I understand, -1 is already works the same way as off, it's just not documented. We can leave it as is for now

@peterschmidt85 peterschmidt85 merged commit bb56222 into master Jan 6, 2025
24 checks passed
@peterschmidt85 peterschmidt85 deleted the 1154-replace-termination_idle_time-int|str-with-idle_duration-int|str|off branch January 6, 2025 12:52
pranitnaik43 pushed a commit to bahaal-tech/dstack that referenced this pull request Feb 9, 2025
pranitnaik43 pushed a commit to bahaal-tech/dstack that referenced this pull request Mar 4, 2025
pranitnaik43 pushed a commit to bahaal-tech/dstack that referenced this pull request Mar 5, 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.

Replace termination_policy and termination_idle_time with idle_duration: int|str|off

3 participants