-
Notifications
You must be signed in to change notification settings - Fork 511
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
[Core] Fix the optimization for IP fetching in sky launch
#2400
Merged
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
b843b33
wip
Michaelvll e06c3b5
wip
Michaelvll 575b327
working
Michaelvll 7d7963a
explicitly update cluster ips
Michaelvll 4edc463
optimize
Michaelvll 7411f53
Fix comment
Michaelvll d65bc3c
Add comments
Michaelvll 30d5e21
format
Michaelvll fb422cf
linter
Michaelvll 5d1e499
Fix head ip fetching in run_on_head
Michaelvll 8e68d44
fix head ip fetching
Michaelvll 6af9a6f
fix status refresh
Michaelvll 35e5823
format
Michaelvll d450f78
Use cached external ips instead
Michaelvll 2b64383
format
Michaelvll b35aec6
Update sky/backends/cloud_vm_ray_backend.py
Michaelvll c97f37d
Fix ports
Michaelvll 0efbf65
Merge branch 'optimize-head-ip' of github.com:skypilot-org/skypilot i…
Michaelvll 0e7ca13
use retry
Michaelvll 1c19a82
format
Michaelvll 5f2890e
typo
Michaelvll 037c332
minor fix
Michaelvll d69507d
Merge branch 'master' of github.com:skypilot-org/skypilot into optimi…
Michaelvll b646bf5
Merge branch 'master' of github.com:skypilot-org/skypilot into optimi…
Michaelvll d9deb2b
change the logging to logger.debug
Michaelvll 9ac5b9d
Use the previously ips to optimize the ip fetching for existing cluster
Michaelvll 50e7e7f
unbounded variable
Michaelvll 4cacb4b
format
Michaelvll 74ea57a
print output refresh failed
Michaelvll e6bcdd7
Add more logging
Michaelvll ad9d77e
more logging
Michaelvll 845bbbc
more output
Michaelvll a590c39
Ensure ray cluster started
Michaelvll 0d2cd6c
Fix tpu catched IPs
Michaelvll 10f9f8e
Fix ports for tpu pod
Michaelvll 42d4fba
format
Michaelvll 5f39b02
failover error for TPU pod
Michaelvll 95ac231
Add stderr for the failed ip refresh
Michaelvll a67e60e
Add the comment back
Michaelvll 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 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 |
---|---|---|
|
@@ -2374,29 +2374,31 @@ def _internal_ips(self) -> Optional[List[str]]: | |
return [ips[0] for ips in self.stable_internal_external_ips] | ||
return None | ||
|
||
def internal_ips( | ||
self, | ||
max_attempts: int = _FETCH_IP_MAX_ATTEMPTS) -> Optional[List[str]]: | ||
def internal_ips(self, | ||
max_attempts: int = _FETCH_IP_MAX_ATTEMPTS) -> List[str]: | ||
internal_ips = self._internal_ips | ||
if internal_ips is not None: | ||
return internal_ips | ||
self.update_cluster_ips(max_attempts=max_attempts) | ||
return self._internal_ips | ||
internal_ips = self._internal_ips | ||
assert internal_ips is not None, 'update_cluster_ips failed.' | ||
return internal_ips | ||
|
||
@property | ||
def _external_ips(self) -> Optional[List[str]]: | ||
if self.stable_internal_external_ips is not None: | ||
return [ips[1] for ips in self.stable_internal_external_ips] | ||
return None | ||
|
||
def external_ips( | ||
self, | ||
max_attempts: int = _FETCH_IP_MAX_ATTEMPTS) -> Optional[List[str]]: | ||
def external_ips(self, | ||
max_attempts: int = _FETCH_IP_MAX_ATTEMPTS) -> List[str]: | ||
external_ips = self._external_ips | ||
if external_ips is not None: | ||
return self._external_ips | ||
return external_ips | ||
self.update_cluster_ips(max_attempts=max_attempts) | ||
return self._external_ips | ||
external_ips = self._external_ips | ||
assert external_ips is not None, 'update_cluster_ips failed.' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
return external_ips | ||
|
||
def external_ssh_ports( | ||
self, | ||
|
@@ -2426,7 +2428,7 @@ def cluster_yaml(self): | |
|
||
@property | ||
def head_ip(self): | ||
external_ips = self.external_ips() | ||
external_ips = self._external_ips | ||
if external_ips is not None: | ||
return external_ips[0] | ||
return None | ||
|
@@ -3943,6 +3945,8 @@ def run_on_head( | |
) -> Union[int, Tuple[int, str, str]]: | ||
"""Runs 'cmd' on the cluster's head node. | ||
|
||
It will try to fetch the head node IP if it is not cached. | ||
|
||
Args: | ||
handle: The ResourceHandle to the cluster. | ||
cmd: The command to run. | ||
|
@@ -3967,7 +3971,8 @@ def run_on_head( | |
exceptions.FetchIPError: If the head node IP cannot be fetched. | ||
""" | ||
# This will try to fetch the head node IP if it is not cached. | ||
head_ip = handle.head_ip | ||
external_ips = handle.external_ips(max_attempts=_FETCH_IP_MAX_ATTEMPTS) | ||
head_ip = external_ips[0] | ||
head_ssh_port = backend_utils.get_head_ssh_port(handle, | ||
_FETCH_IP_MAX_ATTEMPTS) | ||
ssh_credentials = backend_utils.ssh_credential_from_yaml( | ||
|
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.
Shall we raise an error here?
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.
It should be the internal error, as the
self.cached_internal_ips
should not be None after the update. We should probably still useassert