alxmrs commented on code in PR #33805:
URL: https://github.com/apache/beam/pull/33805#discussion_r1936417868
##########
sdks/python/apache_beam/runners/dask/transform_evaluator.py:
##########
@@ -153,10 +157,23 @@ def apply(self, input_bag: OpInput, side_inputs: OpSide =
None) -> db.Bag:
assert input_bag is None, 'Create expects no input!'
original_transform = t.cast(_Create, self.transform)
items = original_transform.values
+
+ npartitions = self.bag_kwargs.get('npartitions')
+ partition_size = self.bag_kwargs.get('partition_size')
+ if npartitions and partition_size:
+ raise ValueError(
+ f'Please specify either `dask_npartitions` or '
+ f'`dask_parition_size` but not both: '
+ f'{npartitions=}, {partition_size=}.')
+ if not npartitions and not partition_size:
+ # partition_size is inversely related to `npartitions`.
+ # Ideal "chunk sizes" in dask are around 10-100 MBs.
+ # Let's hope ~128 items per partition is around this
+ # memory overhead.
+ partition_size = max(128, math.ceil(math.sqrt(len(items)) / 10))
Review Comment:
Good shout. Added a logger.warning.
--
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]