Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/21383#discussion_r189864634
--- Diff: python/pyspark/shuffle.py ---
@@ -67,6 +67,19 @@ def get_used_memory():
return 0
+def safe_iter(f):
+ """ wraps f to make it safe (= does not lead to data loss) to use
inside a for loop
+ make StopIteration's raised inside f explicit
+ """
+ def wrapper(*args, **kwargs):
+ try:
+ return f(*args, **kwargs)
+ except StopIteration as exc:
+ raise RuntimeError('StopIteration in client code', exc)
--- End diff --
why is it only a problem for client mode?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]