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

gcsio: support dict as the input of delete_batch #30188

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sdks/python/apache_beam/io/gcp/gcsio.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ def delete_batch(self, paths):
"""Deletes the objects at the given GCS paths.

Args:
paths: List of GCS file path patterns in the form gs://<bucket>/<name>,
paths: List of GCS file path patterns or Dict with GCS file path patterns
as keys. The patterns are in the form gs://<bucket>/<name>, but
not to exceed MAX_BATCH_OPERATION_SIZE in length.

Returns: List of tuples of (path, exception) in the same order as the
Expand All @@ -217,6 +218,7 @@ def delete_batch(self, paths):
"""
final_results = []
s = 0
if not isinstance(paths, list): paths = list(iter(paths))
while s < len(paths):
if (s + MAX_BATCH_OPERATION_SIZE) < len(paths):
current_paths = paths[s:s + MAX_BATCH_OPERATION_SIZE]
Expand Down
Loading