import time
from typing import Callable, List, TypeVar
+# This module is commonly used by others in here and should avoid
+# taking any unnecessary dependencies back on them.
from deferred_operand import DeferredOperand
import id_generator
return
+def wait_all(futures: List[SmartFuture]) -> None:
+ done_set = set()
+ while len(done_set) < len(futures):
+ for future in futures:
+ i = future.get_id()
+ if i not in done_set and future.wrapped_future.done():
+ done_set.add(i)
+ time.sleep(0.1)
+
+
class SmartFuture(DeferredOperand):
"""This is a SmartFuture, a class that wraps a normal Future and can
then be used, mostly, like a normal (non-Future) identifier.