-
Notifications
You must be signed in to change notification settings - Fork 539
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
[User identity] Fix identity check #1550
Conversation
sky/backends/backend_utils.py
Outdated
@@ -1809,7 +1809,8 @@ def _update_cluster_status_no_lock( | |||
|
|||
def _update_cluster_status( |
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.
I do not clearly remember the differences between _update_cluster_status()
and refresh_cluster_status_handle()
. After reading the docstrings, still having some troubles telling the differences.
The status -r
code path calls the former:
skypilot/sky/backends/backend_utils.py
Lines 2046 to 2054 in c86b69d
def _refresh_cluster(cluster_name): | |
try: | |
record = _update_cluster_status( | |
cluster_name, acquire_per_cluster_status_lock=True) | |
except (exceptions.ClusterStatusFetchingError, | |
exceptions.ClusterOwnerIdentityMismatchError) as e: | |
record = {'status': 'UNKNOWN', 'error': e} | |
progress.update(task, advance=1) | |
return record |
Would this change be needed if it calls the latter? Which already had identity checks.
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.
The main difference is the former returns the entire record but the latter returns the (status, handle) tuple. If we let the status -r
call the later, we may have to add a argument to the latter function to return the record. I would prefer the current implementation, since the refresh_cluster_status_handle
is public and used a lot in other modules.
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.
I refactored it a bit, by adding a new function refresh_cluster_record
, and all the callers will go through this function now. Does that look better @concretevitamin? : )
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.
LGTM. Mainly to clarify the two functions (I feel they do the same thing and differ on in return values).
sky/backends/backend_utils.py
Outdated
force_refresh: bool = False, | ||
acquire_per_cluster_status_lock: bool = True | ||
) -> Optional[Dict[str, Any]]: | ||
"""Refresh the cluster record. |
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.
"""Refresh the cluster record. | |
"""Refresh the cluster, and return the possibly updated record. |
Conceptually I feel the difference between the two functions is only what is returned?
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.
Yes, the only difference is the return value.
Describe the changes in this PR:
(related to #1513) This PR fixes the identity check for the
sky status -r
as it does not go throughrefresh_cluster_status_handle
.Tested (run the relevant ones):
sky launch -c test -t t3.micro
;AWS_PROFILE=admin-user sky status -r