(self, os_context=None)
| 179 | BUFFER_FACTOR = 4 |
| 180 | |
| 181 | def __init__(self, os_context=None): |
| 182 | super(DefaultExecutionPool, self).__init__() |
| 183 | self.os_context = os_context |
| 184 | self.processes = [] |
| 185 | self.terminated = False |
| 186 | |
| 187 | # Invariant: processing_count >= #work_queue + #done_queue. It is greater |
| 188 | # when a worker takes an item from the work_queue and before the result is |
| 189 | # submitted to the done_queue. It is equal when no worker is working, |
| 190 | # e.g. when all workers have finished, and when no results are processed. |
| 191 | # Count is only accessed by the parent process. Only the parent process is |
| 192 | # allowed to remove items from the done_queue and to add items to the |
| 193 | # work_queue. |
| 194 | self.processing_count = 0 |
| 195 | |
| 196 | # Disable sigint and sigterm to prevent subprocesses from capturing the |
| 197 | # signals. |
| 198 | with without_sig(): |
| 199 | self.work_queue = Queue() |
| 200 | self.done_queue = Queue() |
| 201 | |
| 202 | def init(self, num_workers=1, heartbeat_timeout=1, notify_function=None): |
| 203 | """ |
nothing calls this directly
no test coverage detected