Introduce JOB_DISCONNECTED_RETRY_TIMEOUT#2627
Merged
Merged
Conversation
jvstme
approved these changes
May 14, 2025
| else: | ||
| # No job_model.termination_reason set means ssh connection failed | ||
| if job_model.disconnected_at is None: | ||
| job_model.disconnected_at = common_utils.get_current_datetime() |
Collaborator
There was a problem hiding this comment.
Note that runner_ssh_tunnel also does 3 blocking retries, and each can take 15 seconds. So this disconnected_at can be imprecise, since we only set it after the runner_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 new disconnected_at retries, but having retry logic in both places may further improve stability.
Collaborator
Author
There was a problem hiding this comment.
Thanks for pointing out. Let's keep both! :)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #2626
The PR changes process_running_jobs handling of ssh connection errors for pulling/running jobs. Previously, it failed jobs with no capacity after establishing ssh connection fails. Now, it keeps job active for at least JOB_DISCONNECTED_RETRY_TIMEOUT (2 minutes). This allows surviving temporary networking issues.
A possible regression is that dstack becomes slower to replace failed jobs/replicas. IMO, not a big problem since there are no expectations/guarantees on how quick the replacement is.
Later we can make timeout smarter depending on the job (e.g. short for spots, if retry enabled, etc). For now, keeping it as constant for simplicity.
Also introduced JobTerminationReason.INSTANCE_UNREACHABLE – not yet used because of backward compatibility.