-
Notifications
You must be signed in to change notification settings - Fork 547
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
Conversation
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 the fix @Michaelvll ! Left some comments :))
sky/clouds/gcp.py
Outdated
@@ -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) |
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.
Should we benchmark the performance degrade and make sure it is tolerable? I think it should be marginal though
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.
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) |
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.
Should we add an attribute for the class and assign here, instead of setattr
?
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.
This is only used for the usage collection, which uses hasattr
to check detailed_reason
. Maybe we can keep it this way?
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.
Oh ic. LGTM!
* 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
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):
bash format.sh
sky check gcp
pytest tests/test_smoke.py
pytest tests/test_smoke.py::test_fill_in_the_name
conda deactivate; bash -i tests/backward_compatibility_tests.sh