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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wool
3
- Version: 0.1rc10
3
+ Version: 0.1rc11
4
4
  Summary: A Python framework for distributed multiprocessing.
5
5
  Author-email: Conrad Bzura <conrad@wool.io>
6
6
  Maintainer-email: maintainers@wool.io
@@ -4,7 +4,7 @@ import grpc
4
4
  import warnings
5
5
 
6
6
 
7
- GRPC_GENERATED_VERSION = '1.75.0'
7
+ GRPC_GENERATED_VERSION = '1.75.1'
8
8
  GRPC_VERSION = grpc.__version__
9
9
  _version_not_supported = False
10
10
 
@@ -6,7 +6,7 @@ import warnings
6
6
  from . import task_pb2 as task__pb2
7
7
  from . import worker_pb2 as worker__pb2
8
8
 
9
- GRPC_GENERATED_VERSION = '1.75.0'
9
+ GRPC_GENERATED_VERSION = '1.75.1'
10
10
  GRPC_VERSION = grpc.__version__
11
11
  _version_not_supported = False
12
12
 
@@ -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._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()
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 = partial(LocalWorker, registry_service=LocalRegistryService(uri))
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