-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retry instance termination in case of errors (#2190)
Retry instance termination every ~30 seconds for ~15 minutes until it is successfully terminated. Mark as terminated and log an error if all attempts failed. Bonus: fix `AsyncioCancelledErrorFilter` for the case when `exc_info` is `False`.
- Loading branch information
Showing
5 changed files
with
195 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ack/_internal/server/migrations/versions/c48df7985d57_add_instance_termination_retries.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""Add instance termination retries | ||
Revision ID: c48df7985d57 | ||
Revises: 065588ec72b8 | ||
Create Date: 2025-01-14 13:33:17.722284 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
from dstack._internal.server.models import NaiveDateTime | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "c48df7985d57" | ||
down_revision = "065588ec72b8" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table("instances", schema=None) as batch_op: | ||
batch_op.add_column( | ||
sa.Column("first_termination_retry_at", NaiveDateTime(), nullable=True) | ||
) | ||
batch_op.add_column(sa.Column("last_termination_retry_at", NaiveDateTime(), nullable=True)) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table("instances", schema=None) as batch_op: | ||
batch_op.drop_column("last_termination_retry_at") | ||
batch_op.drop_column("first_termination_retry_at") | ||
|
||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters