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

Add total size counting for object-storage clean command #104

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

aalexfvk
Copy link
Contributor

Add counting of total size of all orphaned objects for object-storage clean command.
Support standard output formats: table, yaml, json.

@aalexfvk aalexfvk changed the title Add total size counting for object-storage clean Add total size counting for object-storage clean command Feb 21, 2024
f"{'Would delete' if dry_run else 'Deleted'} {deleted} objects from bucket [{disk_conf.bucket_name}] with prefix {prefix}"
# Generator producing keys from temporary file with counting of statistics
def keys():
nonlocal deleted, total_size
Copy link
Contributor

Choose a reason for hiding this comment

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

As for me it is non trivial logic.
Can we count total size and the number of deleted objects inside cleanup_s3_object_storage and use return value for some statistic that we have collected? Also we already have logic to count the number of deleted objects:

for chunk in chunked(keys, BULK_DELETE_CHUNK_SIZE):
if not dry_run:
_bulk_delete(bucket, chunk)
deleted += len(chunk)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, partially. I thought to do that, but then decided not to count size statistics in cleanup function. But now I'll do that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@MikhailBurdukov MikhailBurdukov merged commit 4c7c9d9 into main Feb 21, 2024
16 checks passed
@MikhailBurdukov MikhailBurdukov deleted the add_total_size_for_object_storage_clean branch February 21, 2024 12:45
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.

2 participants