|
9 | 9 | from dataclasses import dataclass, field |
10 | 10 | from enum import Enum |
11 | 11 | from io import StringIO |
12 | | -from multiprocessing import Process, Queue, SimpleQueue, cpu_count, get_context |
| 12 | +from multiprocessing import Process, Queue, cpu_count, get_context |
13 | 13 | from multiprocessing.context import SpawnContext, SpawnProcess |
14 | 14 | from multiprocessing.managers import SyncManager |
15 | 15 | from queue import Empty, Full |
@@ -92,9 +92,7 @@ class GiskardResult: |
92 | 92 | exception: Any = None |
93 | 93 |
|
94 | 94 |
|
95 | | -def _process_worker( |
96 | | - tasks_queue: Queue[Optional[GiskardTask]], tasks_results: Queue[GiskardResult], running_process: Dict[str, str] |
97 | | -): |
| 95 | +def _process_worker(tasks_queue: Queue, tasks_results: Queue, running_process: Dict[str, str]): |
98 | 96 | pid = os.getpid() |
99 | 97 | LOGGER.info("Process %s started", pid) |
100 | 98 |
|
@@ -159,12 +157,12 @@ def __init__(self, nb_workers: Optional[int] = None, name: Optional[str] = None) |
159 | 157 | # Mapping of the running tasks and worker pids |
160 | 158 | self.with_timeout_tasks: List[TimeoutData] = [] |
161 | 159 | # Queue with tasks to run |
162 | | - self.pending_tasks_queue: Queue[GiskardTask] = self._mp_context.Queue() |
| 160 | + self.pending_tasks_queue: Queue = self._mp_context.Queue() |
163 | 161 | # Queue with tasks to be consumed asap |
164 | 162 | # As in ProcessPool, add one more to avoid idling process |
165 | | - self.running_tasks_queue: Queue[Optional[GiskardTask]] = self._mp_context.Queue(maxsize=self._nb_workers + 1) |
| 163 | + self.running_tasks_queue: Queue = self._mp_context.Queue(maxsize=self._nb_workers + 1) |
166 | 164 | # Queue with results to notify |
167 | | - self.tasks_results: Queue[GiskardResult] = self._mp_context.Queue() |
| 165 | + self.tasks_results: Queue = self._mp_context.Queue() |
168 | 166 | # Mapping task_id with future |
169 | 167 | self.futures_mapping: Dict[str, Future] = dict() |
170 | 168 | LOGGER.debug("Starting threads for the WorkerPoolExecutor") |
|
0 commit comments