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


##########
sdks/python/apache_beam/runners/dask/transform_evaluator.py:
##########
@@ -87,13 +87,24 @@ class DaskBagWindowedIterator:
 
   bag: db.Bag
   window_fn: WindowFn
+  lazy_side_inputs: bool = False
 
   def __iter__(self):
-    # FIXME(cisaacstern): list() is likely inefficient, since it presumably
-    # materializes the full result before iterating over it. doing this for
-    # now as a proof-of-concept. can we can generate results incrementally?
-    for result in list(self.bag):
-      yield get_windowed_value(result, self.window_fn)
+    if not self.lazy_side_inputs:
+      for result in list(self.bag):
+        yield get_windowed_value(result, self.window_fn)
+    else:
+      try:
+        from dask.distributed import worker_client
+        with worker_client() as client:
+          for partition in self.bag.to_delayed():
+            # explicitly submit and wait to avoid deadlock
+            for result in client.compute(partition).result():
+              yield get_windowed_value(result, self.window_fn)
+      except (ImportError, ValueError):
+        for partition in self.bag.to_delayed():

Review Comment:
   for transient errors , runners should retry. for non-transient errors, a 
user can remove the flag.



-- 
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