tvalentyn commented on code in PR #31363:
URL: https://github.com/apache/beam/pull/31363#discussion_r1617717649


##########
sdks/python/apache_beam/runners/worker/data_plane.py:
##########
@@ -148,14 +147,26 @@ def maybe_flush(self):
   def flush(self):
     # type: () -> None
     if self._flush_callback:
-      if self.size() > _FLUSH_MAX_SIZE:
+      size = self.size()
+      if size > _FLUSH_MAX_SIZE:
         raise ValueError(
-            f'Buffer size {self.size()} exceeds GRPC limit {_FLUSH_MAX_SIZE}. '
+            f'Buffer size {size} exceeds GRPC limit {_FLUSH_MAX_SIZE}. '
             'This is likely due to a single element that is too large. '
             'To resolve, prefer multiple small elements over single large '
             'elements in PCollections. If needed, store large blobs in '
             'external storage systems, and use PCollections to pass their '
             'metadata, or use a custom coder that reduces the element\'s 
size.')
+      if size > 536870912:
+        _LOGGER.warning(
+            f'Data output stream buffer size {size} exceeds 512 MB. '

Review Comment:
   ```suggestion
               'Data output stream buffer size %s exceeds 512 MB. '
   ```



##########
sdks/python/apache_beam/runners/worker/data_plane.py:
##########
@@ -148,14 +147,26 @@ def maybe_flush(self):
   def flush(self):
     # type: () -> None
     if self._flush_callback:
-      if self.size() > _FLUSH_MAX_SIZE:
+      size = self.size()
+      if size > _FLUSH_MAX_SIZE:
         raise ValueError(
-            f'Buffer size {self.size()} exceeds GRPC limit {_FLUSH_MAX_SIZE}. '
+            f'Buffer size {size} exceeds GRPC limit {_FLUSH_MAX_SIZE}. '
             'This is likely due to a single element that is too large. '
             'To resolve, prefer multiple small elements over single large '
             'elements in PCollections. If needed, store large blobs in '
             'external storage systems, and use PCollections to pass their '
             'metadata, or use a custom coder that reduces the element\'s 
size.')
+      if size > 536870912:
+        _LOGGER.warning(
+            f'Data output stream buffer size {size} exceeds 512 MB. '
+            'This is likely due to a large element in a PCollection. '
+            'Large elements increase pipeline RAM requirements and '
+            'can cause runtime errors. '
+            'Prefer multiple small elements over single large '
+            'elements in PCollections. If needed, store large blobs in '
+            'external storage systems, and use PCollections to pass their '
+            'metadata, or use a custom coder that reduces the element\'s 
size.')

Review Comment:
   ```suggestion
               'metadata, or use a custom coder that reduces the element\'s 
size.',
               size)
   ```



-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to