-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy pathprocess.pyi
205 lines (176 loc) · 6.96 KB
/
process.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
import sys
from collections.abc import Callable, Generator, Iterable, Mapping, MutableMapping, MutableSequence
from multiprocessing.connection import Connection
from multiprocessing.context import BaseContext, Process
from multiprocessing.queues import Queue, SimpleQueue
from threading import Lock, Semaphore, Thread
from types import TracebackType
from typing import Any, Generic, TypeVar
from weakref import ref
from ._base import Executor, Future
_T = TypeVar("_T")
_threads_wakeups: MutableMapping[Any, Any]
_global_shutdown: bool
class _ThreadWakeup:
_closed: bool
_reader: Connection
_writer: Connection
def __init__(self) -> None: ...
def close(self) -> None: ...
def wakeup(self) -> None: ...
def clear(self) -> None: ...
def _python_exit() -> None: ...
EXTRA_QUEUED_CALLS: int
_MAX_WINDOWS_WORKERS: int
class _RemoteTraceback(Exception):
tb: str
def __init__(self, tb: TracebackType) -> None: ...
class _ExceptionWithTraceback:
exc: BaseException
tb: TracebackType
def __init__(self, exc: BaseException, tb: TracebackType) -> None: ...
def __reduce__(self) -> str | tuple[Any, ...]: ...
def _rebuild_exc(exc: Exception, tb: str) -> Exception: ...
class _WorkItem(Generic[_T]):
future: Future[_T]
fn: Callable[..., _T]
args: Iterable[Any]
kwargs: Mapping[str, Any]
def __init__(self, future: Future[_T], fn: Callable[..., _T], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
class _ResultItem:
work_id: int
exception: Exception
result: Any
if sys.version_info >= (3, 11):
exit_pid: int | None
def __init__(
self, work_id: int, exception: Exception | None = ..., result: Any | None = ..., exit_pid: int | None = ...
) -> None: ...
else:
def __init__(self, work_id: int, exception: Exception | None = ..., result: Any | None = ...) -> None: ...
class _CallItem:
work_id: int
fn: Callable[..., Any]
args: Iterable[Any]
kwargs: Mapping[str, Any]
def __init__(self, work_id: int, fn: Callable[..., Any], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
if sys.version_info >= (3, 7):
class _SafeQueue(Queue[Future[Any]]):
pending_work_items: dict[int, _WorkItem[Any]]
shutdown_lock: Lock
thread_wakeup: _ThreadWakeup
if sys.version_info >= (3, 9):
def __init__(
self,
max_size: int | None = ...,
*,
ctx: BaseContext,
pending_work_items: dict[int, _WorkItem[Any]],
shutdown_lock: Lock,
thread_wakeup: _ThreadWakeup,
) -> None: ...
else:
def __init__(
self, max_size: int | None = ..., *, ctx: BaseContext, pending_work_items: dict[int, _WorkItem[Any]]
) -> None: ...
def _on_queue_feeder_error(self, e: Exception, obj: _CallItem) -> None: ...
def _get_chunks(*iterables: Any, chunksize: int) -> Generator[tuple[Any, ...], None, None]: ...
def _process_chunk(fn: Callable[..., _T], chunk: Iterable[tuple[Any, ...]]) -> list[_T]: ...
if sys.version_info >= (3, 11):
def _sendback_result(
result_queue: SimpleQueue[_WorkItem[Any]],
work_id: int,
result: Any | None = ...,
exception: Exception | None = ...,
exit_pid: int | None = ...,
) -> None: ...
else:
def _sendback_result(
result_queue: SimpleQueue[_WorkItem[Any]], work_id: int, result: Any | None = ..., exception: Exception | None = ...
) -> None: ...
if sys.version_info >= (3, 11):
def _process_worker(
call_queue: Queue[_CallItem],
result_queue: SimpleQueue[_ResultItem],
initializer: Callable[..., object] | None,
initargs: tuple[Any, ...],
max_tasks: int | None = ...,
) -> None: ...
elif sys.version_info >= (3, 7):
def _process_worker(
call_queue: Queue[_CallItem],
result_queue: SimpleQueue[_ResultItem],
initializer: Callable[..., object] | None,
initargs: tuple[Any, ...],
) -> None: ...
else:
def _process_worker(call_queue: Queue[_CallItem], result_queue: SimpleQueue[_ResultItem]) -> None: ...
if sys.version_info >= (3, 9):
class _ExecutorManagerThread(Thread):
thread_wakeup: _ThreadWakeup
shutdown_lock: Lock
executor_reference: ref[Any]
processes: MutableMapping[int, Process]
call_queue: Queue[_CallItem]
result_queue: SimpleQueue[_ResultItem]
work_ids_queue: Queue[int]
pending_work_items: dict[int, _WorkItem[Any]]
def __init__(self, executor: ProcessPoolExecutor) -> None: ...
def run(self) -> None: ...
def add_call_item_to_queue(self) -> None: ...
def wait_result_broken_or_wakeup(self) -> tuple[Any, bool, str]: ...
def process_result_item(self, result_item: int | _ResultItem) -> None: ...
def is_shutting_down(self) -> bool: ...
def terminate_broken(self, cause: str) -> None: ...
def flag_executor_shutting_down(self) -> None: ...
def shutdown_workers(self) -> None: ...
def join_executor_internals(self) -> None: ...
def get_n_children_alive(self) -> int: ...
_system_limits_checked: bool
_system_limited: bool | None
def _check_system_limits() -> None: ...
def _chain_from_iterable_of_lists(iterable: Iterable[MutableSequence[Any]]) -> Any: ...
if sys.version_info >= (3, 7):
from ._base import BrokenExecutor
class BrokenProcessPool(BrokenExecutor): ...
else:
class BrokenProcessPool(RuntimeError): ...
class ProcessPoolExecutor(Executor):
_mp_context: BaseContext | None = ...
_initializer: Callable[..., None] | None = ...
_initargs: tuple[Any, ...] = ...
_executor_manager_thread: _ThreadWakeup
_processes: MutableMapping[int, Process]
_shutdown_thread: bool
_shutdown_lock: Lock
_idle_worker_semaphore: Semaphore
_broken: bool
_queue_count: int
_pending_work_items: dict[int, _WorkItem[Any]]
_cancel_pending_futures: bool
_executor_manager_thread_wakeup: _ThreadWakeup
_result_queue: SimpleQueue[Any]
_work_ids: Queue[Any]
if sys.version_info >= (3, 11):
def __init__(
self,
max_workers: int | None = ...,
mp_context: BaseContext | None = ...,
initializer: Callable[..., object] | None = ...,
initargs: tuple[Any, ...] = ...,
*,
max_tasks_per_child: int | None = ...,
) -> None: ...
elif sys.version_info >= (3, 7):
def __init__(
self,
max_workers: int | None = ...,
mp_context: BaseContext | None = ...,
initializer: Callable[..., object] | None = ...,
initargs: tuple[Any, ...] = ...,
) -> None: ...
else:
def __init__(self, max_workers: int | None = ...) -> None: ...
if sys.version_info >= (3, 9):
def _start_executor_manager_thread(self) -> None: ...
def _adjust_process_count(self) -> None: ...