wool 0.1rc10__tar.gz → 0.1rc11__tar.gz
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 wool might be problematic. Click here for more details.
- {wool-0.1rc10 → wool-0.1rc11}/PKG-INFO +1 -1
- {wool-0.1rc10 → wool-0.1rc11}/wool/_protobuf/task_pb2_grpc.py +1 -1
- {wool-0.1rc10 → wool-0.1rc11}/wool/_protobuf/worker_pb2_grpc.py +1 -1
- {wool-0.1rc10 → wool-0.1rc11}/wool/_worker.py +13 -13
- {wool-0.1rc10 → wool-0.1rc11}/wool/_worker_pool.py +7 -1
- {wool-0.1rc10 → wool-0.1rc11}/.gitignore +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/README.md +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/pyproject.toml +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/__init__.py +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/_protobuf/__init__.py +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/_protobuf/exception.py +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/_protobuf/task.py +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/_protobuf/task_pb2.py +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/_protobuf/task_pb2.pyi +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/_protobuf/worker.py +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/_protobuf/worker_pb2.py +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/_protobuf/worker_pb2.pyi +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/_resource_pool.py +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/_typing.py +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/_work.py +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/_worker_discovery.py +0 -0
- {wool-0.1rc10 → wool-0.1rc11}/wool/_worker_proxy.py +0 -0
|
@@ -334,20 +334,20 @@ class LocalWorker(Worker[_T_RegistryService]):
|
|
|
334
334
|
the registry service. If graceful shutdown fails, the process
|
|
335
335
|
is forcefully terminated.
|
|
336
336
|
"""
|
|
337
|
-
if not self._info:
|
|
338
|
-
raise RuntimeError("Cannot unregister - worker has no info")
|
|
339
|
-
|
|
340
|
-
await self._registry_service.unregister(self._info)
|
|
341
|
-
|
|
342
|
-
if not self._worker_process.is_alive():
|
|
343
|
-
return
|
|
344
337
|
try:
|
|
345
|
-
if self.
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
if self._worker_process.is_alive():
|
|
350
|
-
|
|
338
|
+
if not self._info:
|
|
339
|
+
raise RuntimeError("Cannot unregister - worker has no info")
|
|
340
|
+
await self._registry_service.unregister(self._info)
|
|
341
|
+
finally:
|
|
342
|
+
if not self._worker_process.is_alive():
|
|
343
|
+
return
|
|
344
|
+
try:
|
|
345
|
+
if self._worker_process.pid:
|
|
346
|
+
os.kill(self._worker_process.pid, signal.SIGINT)
|
|
347
|
+
self._worker_process.join()
|
|
348
|
+
except OSError:
|
|
349
|
+
if self._worker_process.is_alive():
|
|
350
|
+
self._worker_process.kill()
|
|
351
351
|
|
|
352
352
|
|
|
353
353
|
class WorkerProcess(Process):
|
|
@@ -312,7 +312,7 @@ class WorkerPool:
|
|
|
312
312
|
self, uri, *tags: str, size: int, factory: WorkerFactory | None
|
|
313
313
|
):
|
|
314
314
|
if factory is None:
|
|
315
|
-
factory =
|
|
315
|
+
factory = self._default_worker_factory(uri)
|
|
316
316
|
|
|
317
317
|
tasks = []
|
|
318
318
|
for _ in range(size):
|
|
@@ -329,3 +329,9 @@ class WorkerPool:
|
|
|
329
329
|
"""Sends a stop command to all workers and unregisters them."""
|
|
330
330
|
tasks = [asyncio.create_task(worker.stop()) for worker in self._workers]
|
|
331
331
|
await asyncio.gather(*tasks, return_exceptions=True)
|
|
332
|
+
|
|
333
|
+
def _default_worker_factory(self, uri):
|
|
334
|
+
def factory(*tags, **_):
|
|
335
|
+
return LocalWorker(*tags, registry_service=LocalRegistryService(uri))
|
|
336
|
+
|
|
337
|
+
return factory
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|