acryl-datahub 1.0.0.1rc6__py3-none-any.whl → 1.0.0.1rc7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of acryl-datahub might be problematic. Click here for more details.

@@ -1,7 +1,15 @@
1
1
  import concurrent.futures
2
2
  import contextlib
3
3
  import queue
4
- from typing import Any, Callable, Generator, Iterable, Tuple, TypeVar
4
+ from typing import (
5
+ Any,
6
+ Callable,
7
+ Iterable,
8
+ Iterator,
9
+ Optional,
10
+ Tuple,
11
+ TypeVar,
12
+ )
5
13
 
6
14
  T = TypeVar("T")
7
15
 
@@ -18,8 +26,13 @@ class ThreadedIteratorExecutor:
18
26
  worker_func: Callable[..., Iterable[T]],
19
27
  args_list: Iterable[Tuple[Any, ...]],
20
28
  max_workers: int,
21
- ) -> Generator[T, None, None]:
22
- out_q: queue.Queue[T] = queue.Queue()
29
+ max_backpressure: Optional[int] = None,
30
+ ) -> Iterator[T]:
31
+ if max_backpressure is None:
32
+ max_backpressure = 10 * max_workers
33
+ assert max_backpressure >= max_workers
34
+
35
+ out_q: queue.Queue[T] = queue.Queue(maxsize=max_backpressure)
23
36
 
24
37
  def _worker_wrapper(
25
38
  worker_func: Callable[..., Iterable[T]], *args: Any