BjornPrime commented on code in PR #25965:
URL: https://github.com/apache/beam/pull/25965#discussion_r1218555055


##########
sdks/python/apache_beam/io/gcp/gcsio.py:
##########
@@ -296,160 +234,87 @@ def delete_batch(self, paths):
     """
     if not paths:
       return []
-
-    paths = iter(paths)
+    if len(paths) > MAX_BATCH_OPERATION_SIZE:
+      raise TooManyRequests("Batch larger than %s", MAX_BATCH_OPERATION_SIZE)
     result_statuses = []
-    while True:
-      paths_chunk = list(islice(paths, MAX_BATCH_OPERATION_SIZE))

Review Comment:
   Okay, I'll change our MAX_BATCH_OPERATION_SIZE to 1000 the GCS client and 
see if I can make slicing larger groups of files in multiple batches work, 
because I do agree that would be better.
   
   Re: that link the client's code, I think that's outdated. There's a 
parameter now to record a different exception for each request. I'm in the 
process of implementing it currently to ensure that `delete_batch` is 
idempotent.



##########
sdks/python/apache_beam/io/gcp/gcsio.py:
##########
@@ -296,160 +234,87 @@ def delete_batch(self, paths):
     """
     if not paths:
       return []
-
-    paths = iter(paths)
+    if len(paths) > MAX_BATCH_OPERATION_SIZE:
+      raise TooManyRequests("Batch larger than %s", MAX_BATCH_OPERATION_SIZE)
     result_statuses = []
-    while True:
-      paths_chunk = list(islice(paths, MAX_BATCH_OPERATION_SIZE))

Review Comment:
   Okay, I'll change our MAX_BATCH_OPERATION_SIZE to 1000 the GCS client and 
see if I can make slicing larger groups of files in multiple batches work, 
because I do agree that would be better.
   
   Re: that link to the client's code, I think that's outdated. There's a 
parameter now to record a different exception for each request. I'm in the 
process of implementing it currently to ensure that `delete_batch` is 
idempotent.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to