Skip to content
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

[UX] Remove warning for gcp check #3647

Merged
merged 9 commits into from
Jun 8, 2024
Merged

[UX] Remove warning for gcp check #3647

merged 9 commits into from
Jun 8, 2024

Conversation

Michaelvll
Copy link
Collaborator

@Michaelvll Michaelvll commented Jun 6, 2024

Fixes #3060

This also adds the detailed error for GCP operation in the exception raised to make it easier to debug.

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below)
    • sky check gcp
  • All smoke tests: pytest tests/test_smoke.py
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
  • Backward compatibility tests: conda deactivate; bash -i tests/backward_compatibility_tests.sh

@Michaelvll Michaelvll requested a review from cblmemo June 6, 2024 23:40
Copy link
Collaborator

@cblmemo cblmemo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @Michaelvll ! Left some comments :))

sky/provision/gcp/instance_utils.py Outdated Show resolved Hide resolved
@@ -742,7 +742,8 @@ def check_credentials(cls) -> Tuple[bool, Optional[str]]:
credentials, project = google.auth.default()
crm = googleapiclient.discovery.build('cloudresourcemanager',
'v1',
credentials=credentials)
credentials=credentials,
cache_discovery=False)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we benchmark the performance degrade and make sure it is tolerable? I think it should be marginal though

Copy link
Collaborator Author

@Michaelvll Michaelvll Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, the performance is similar. Tested with:
python test.py

import time
from sky.adaptors import gcp

N = 20
durations = []

for _ in range(N):
    start = time.time()
    gcp.build('compute', 'v1', credentials=None, cache_discovery=False) # or True
    end = time.time()
    durations.append(end - start)

print(f'Average time to build GCP service: {sum(durations) / N:.6f} seconds')

with True
Average time to build GCP service: 0.431246 seconds

with False
Average time to build GCP service: 0.431241 seconds

Also, tested with lru_cache for gcp.build and it seems not affecting the time much.

error = common.ProvisionerError('Operation timed out')
setattr(error, 'detailed_reason', msg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add an attribute for the class and assign here, instead of setattr?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only used for the usage collection, which uses hasattr to check detailed_reason. Maybe we can keep it this way?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ic. LGTM!

@Michaelvll Michaelvll merged commit 30cbe06 into master Jun 8, 2024
20 checks passed
@Michaelvll Michaelvll deleted the remove-gcp-warning branch June 8, 2024 17:55
Michaelvll added a commit that referenced this pull request Aug 23, 2024
* remove warning for gcp check

* Add detailed reason in operation failure

* address comments

* format

* thread safty

* Fix thread safety for gcp build

* revert

* revert

* fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UX] sky check shows warning from GCP package
2 participants