-
Notifications
You must be signed in to change notification settings - Fork 404
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
[Storage] Fix sky storage delete
for externally deleted buckets
#1875
Conversation
Thanks for the quick review @landscapepainter! Ready for another look. |
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.
tested more complicated scenarios and confirmed the log as expected:
- create 3 of s3 buckets and 2 of gcs buckets. Remove them all externally and remove them with sky.
- create 3 of r2 buckets, remove two of them externally, and remove them all with sky.
|
||
# Delete bucket externally | ||
cmd = self.cli_delete_cmd(store_type, tmp_scratch_storage_obj.name) | ||
subprocess.check_output(cmd) |
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.
Checking if the bucket was externally removed successfully with assert
should be more complete. Perhaps something like,
subprocess.check_output(cmd) | |
out = subprocess.check_output(cmd) | |
if isinstance(store_type, storage_lib.StoreType.S3) or isinstance(store_type, storage_lib.StoreType.R2): | |
assert 'remove_bucket' not in out.decode('utf-8').lower() | |
elif isinstance(store_type, storage_lib.StoreType.GCS): | |
assert 'removing' not in out.decode('utf-8').lower() |
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.
If the removal fails, the awscli and gsutil return a non-zero error code (In which case we'd get a CalledProcessError, which would catch it).
f'Failed to delete S3 bucket {bucket_name}.') | ||
if 'NoSuchBucket' in e.output.decode('utf-8'): | ||
logger.debug( | ||
_BUCKET_EXTERNALLY_DELETED_DEBUG_MESSAGE.format( |
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.
Perhaps leaving the same comment as L1635
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.
Answered in the other comment
f'Failed to delete R2 bucket {bucket_name}.') | ||
if 'NoSuchBucket' in e.output.decode('utf-8'): | ||
logger.debug( | ||
_BUCKET_EXTERNALLY_DELETED_DEBUG_MESSAGE.format( |
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.
Adding Same comment as L1635
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.
Answered in the other comment
raise exceptions.StorageBucketDeleteError( | ||
f'Failed to delete S3 bucket {bucket_name}.') | ||
if 'NoSuchBucket' in e.output.decode('utf-8'): | ||
logger.debug( |
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.
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.
Ah, this was intentionally left in as logger.debug
(which is not shown to user, unlike logger.info
). It should be fine to have verbose logging in debug.
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.
Ready to go!
Closes #1322.
If a bucket is deleted externally, then store.delete() now does a no-op (instead of creating and deleting like before). The logging has been updated.
Now:
Tested (run the relevant ones):
sky storage delete
#1322pytest tests/test_smoke.py::TestStorageWithCredentials
and with--cloudflare
.