-
Notifications
You must be signed in to change notification settings - Fork 178
Introduce JOB_DISCONNECTED_RETRY_TIMEOUT #2627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
100 changes: 100 additions & 0 deletions
100
src/dstack/_internal/server/migrations/versions/20166748b60c_add_jobmodel_disconnected_at.py
This file contains hidden or 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,100 @@ | ||
"""Add JobModel.disconnected_at | ||
|
||
Revision ID: 20166748b60c | ||
Revises: 6c1a9d6530ee | ||
Create Date: 2025-05-13 16:24:32.496578 | ||
|
||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
from alembic_postgresql_enum import TableReference | ||
|
||
import dstack._internal.server.models | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "20166748b60c" | ||
down_revision = "6c1a9d6530ee" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table("jobs", schema=None) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"disconnected_at", dstack._internal.server.models.NaiveDateTime(), nullable=True | ||
) | ||
) | ||
|
||
op.sync_enum_values( | ||
enum_schema="public", | ||
enum_name="jobterminationreason", | ||
new_values=[ | ||
"FAILED_TO_START_DUE_TO_NO_CAPACITY", | ||
"INTERRUPTED_BY_NO_CAPACITY", | ||
"INSTANCE_UNREACHABLE", | ||
"WAITING_INSTANCE_LIMIT_EXCEEDED", | ||
"WAITING_RUNNER_LIMIT_EXCEEDED", | ||
"TERMINATED_BY_USER", | ||
"VOLUME_ERROR", | ||
"GATEWAY_ERROR", | ||
"SCALED_DOWN", | ||
"DONE_BY_RUNNER", | ||
"ABORTED_BY_USER", | ||
"TERMINATED_BY_SERVER", | ||
"INACTIVITY_DURATION_EXCEEDED", | ||
"TERMINATED_DUE_TO_UTILIZATION_POLICY", | ||
"CONTAINER_EXITED_WITH_ERROR", | ||
"PORTS_BINDING_FAILED", | ||
"CREATING_CONTAINER_ERROR", | ||
"EXECUTOR_ERROR", | ||
"MAX_DURATION_EXCEEDED", | ||
], | ||
affected_columns=[ | ||
TableReference( | ||
table_schema="public", table_name="jobs", column_name="termination_reason" | ||
) | ||
], | ||
enum_values_to_rename=[], | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.sync_enum_values( | ||
enum_schema="public", | ||
enum_name="jobterminationreason", | ||
new_values=[ | ||
"FAILED_TO_START_DUE_TO_NO_CAPACITY", | ||
"INTERRUPTED_BY_NO_CAPACITY", | ||
"WAITING_INSTANCE_LIMIT_EXCEEDED", | ||
"WAITING_RUNNER_LIMIT_EXCEEDED", | ||
"TERMINATED_BY_USER", | ||
"VOLUME_ERROR", | ||
"GATEWAY_ERROR", | ||
"SCALED_DOWN", | ||
"DONE_BY_RUNNER", | ||
"ABORTED_BY_USER", | ||
"TERMINATED_BY_SERVER", | ||
"INACTIVITY_DURATION_EXCEEDED", | ||
"TERMINATED_DUE_TO_UTILIZATION_POLICY", | ||
"CONTAINER_EXITED_WITH_ERROR", | ||
"PORTS_BINDING_FAILED", | ||
"CREATING_CONTAINER_ERROR", | ||
"EXECUTOR_ERROR", | ||
"MAX_DURATION_EXCEEDED", | ||
], | ||
affected_columns=[ | ||
TableReference( | ||
table_schema="public", table_name="jobs", column_name="termination_reason" | ||
) | ||
], | ||
enum_values_to_rename=[], | ||
) | ||
with op.batch_alter_table("jobs", schema=None) as batch_op: | ||
batch_op.drop_column("disconnected_at") | ||
|
||
# ### end Alembic commands ### |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that
runner_ssh_tunnel
also does 3 blocking retries, and each can take 15 seconds. So thisdisconnected_at
can be imprecise, since we only set it after therunner_ssh_tunnel
retries.But I'm not sure we need to do anything about it. I thought about disabling the
runner_ssh_tunnel
retries in favor of the newdisconnected_at
retries, but having retry logic in both places may further improve stability.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing out. Let's keep both! :)