wool 0.1rc8__tar.gz → 0.1rc10__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.

Files changed (45) hide show
  1. {wool-0.1rc8 → wool-0.1rc10}/.gitignore +8 -0
  2. {wool-0.1rc8 → wool-0.1rc10}/PKG-INFO +8 -7
  3. {wool-0.1rc8 → wool-0.1rc10}/pyproject.toml +28 -9
  4. wool-0.1rc10/wool/__init__.py +97 -0
  5. wool-0.1rc10/wool/_protobuf/__init__.py +18 -0
  6. wool-0.1rc10/wool/_protobuf/exception.py +3 -0
  7. wool-0.1rc10/wool/_protobuf/task.py +11 -0
  8. wool-0.1rc10/wool/_protobuf/task_pb2.py +42 -0
  9. wool-0.1rc10/wool/_protobuf/task_pb2.pyi +43 -0
  10. wool-0.1rc8/wool/_protobuf/mempool/metadata/metadata_pb2_grpc.py → wool-0.1rc10/wool/_protobuf/task_pb2_grpc.py +2 -2
  11. wool-0.1rc10/wool/_protobuf/worker.py +24 -0
  12. wool-0.1rc10/wool/_protobuf/worker_pb2.py +47 -0
  13. wool-0.1rc10/wool/_protobuf/worker_pb2.pyi +39 -0
  14. wool-0.1rc10/wool/_protobuf/worker_pb2_grpc.py +141 -0
  15. wool-0.1rc10/wool/_resource_pool.py +376 -0
  16. wool-0.1rc10/wool/_typing.py +7 -0
  17. wool-0.1rc10/wool/_work.py +553 -0
  18. wool-0.1rc10/wool/_worker.py +875 -0
  19. wool-0.1rc10/wool/_worker_discovery.py +1223 -0
  20. wool-0.1rc10/wool/_worker_pool.py +331 -0
  21. wool-0.1rc10/wool/_worker_proxy.py +515 -0
  22. wool-0.1rc8/wool/__init__.py +0 -76
  23. wool-0.1rc8/wool/_cli.py +0 -262
  24. wool-0.1rc8/wool/_event.py +0 -109
  25. wool-0.1rc8/wool/_future.py +0 -171
  26. wool-0.1rc8/wool/_logging.py +0 -44
  27. wool-0.1rc8/wool/_manager.py +0 -181
  28. wool-0.1rc8/wool/_mempool/__init__.py +0 -4
  29. wool-0.1rc8/wool/_mempool/_mempool.py +0 -311
  30. wool-0.1rc8/wool/_mempool/_metadata.py +0 -39
  31. wool-0.1rc8/wool/_mempool/_service.py +0 -225
  32. wool-0.1rc8/wool/_pool.py +0 -524
  33. wool-0.1rc8/wool/_protobuf/__init__.py +0 -4
  34. wool-0.1rc8/wool/_protobuf/mempool/mempool_pb2.py +0 -66
  35. wool-0.1rc8/wool/_protobuf/mempool/mempool_pb2.pyi +0 -108
  36. wool-0.1rc8/wool/_protobuf/mempool/mempool_pb2_grpc.py +0 -312
  37. wool-0.1rc8/wool/_protobuf/mempool/metadata/metadata_pb2.py +0 -36
  38. wool-0.1rc8/wool/_protobuf/mempool/metadata/metadata_pb2.pyi +0 -17
  39. wool-0.1rc8/wool/_queue.py +0 -32
  40. wool-0.1rc8/wool/_session.py +0 -429
  41. wool-0.1rc8/wool/_task.py +0 -366
  42. wool-0.1rc8/wool/_typing.py +0 -17
  43. wool-0.1rc8/wool/_utils.py +0 -63
  44. wool-0.1rc8/wool/_worker.py +0 -201
  45. {wool-0.1rc8 → wool-0.1rc10}/README.md +0 -0
@@ -4,6 +4,7 @@
4
4
  !/.github
5
5
  !/.gitignore
6
6
  !.gitkeep
7
+ !.coveragerc
7
8
 
8
9
  *.code-workspace
9
10
  *.egg-info
@@ -20,3 +21,10 @@ wool/src/wool/locking
20
21
  # Generated by protoc
21
22
  *_pb2.py*
22
23
  *_pb2_grpc.py
24
+
25
+ # Claude context
26
+ CLAUDE.md
27
+ ROADMAP.md
28
+ STYLEGUIDE.md
29
+
30
+ wool/src/wool/cli.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wool
3
- Version: 0.1rc8
3
+ Version: 0.1rc10
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
@@ -208,22 +208,23 @@ License: Apache License
208
208
  Classifier: Intended Audience :: Developers
209
209
  Classifier: Operating System :: MacOS :: MacOS X
210
210
  Classifier: Operating System :: POSIX :: Linux
211
- Requires-Python: >=3.10
212
- Requires-Dist: annotated-types
213
- Requires-Dist: click
214
- Requires-Dist: debugpy
211
+ Requires-Python: >=3.11
212
+ Requires-Dist: cloudpickle
215
213
  Requires-Dist: grpcio
216
214
  Requires-Dist: protobuf
217
215
  Requires-Dist: shortuuid
218
216
  Requires-Dist: tblib
219
217
  Requires-Dist: typing-extensions
218
+ Requires-Dist: zeroconf
220
219
  Provides-Extra: dev
220
+ Requires-Dist: debugpy; extra == 'dev'
221
+ Requires-Dist: hypothesis; extra == 'dev'
221
222
  Requires-Dist: pytest; extra == 'dev'
222
223
  Requires-Dist: pytest-asyncio; extra == 'dev'
224
+ Requires-Dist: pytest-cov; extra == 'dev'
223
225
  Requires-Dist: pytest-grpc-aio~=0.2.0; extra == 'dev'
226
+ Requires-Dist: pytest-mock; extra == 'dev'
224
227
  Requires-Dist: ruff; extra == 'dev'
225
- Provides-Extra: locking
226
- Requires-Dist: wool-locking==0.1rc8; extra == 'locking'
227
228
  Description-Content-Type: text/markdown
228
229
 
229
230
  # Wool
@@ -1,7 +1,14 @@
1
1
  [build-system]
2
2
 
3
3
  build-backend = "hatchling.build"
4
- requires = ["debugpy", "hatchling", "packaging", "GitPython", "toml"]
4
+ requires = [
5
+ "debugpy",
6
+ "hatchling",
7
+ "packaging",
8
+ "GitPython",
9
+ "toml",
10
+ "typing-extensions",
11
+ ]
5
12
 
6
13
  [project]
7
14
  authors = [{ name = "Conrad Bzura", email = "conrad@wool.io" }]
@@ -11,14 +18,13 @@ classifiers = [
11
18
  "Operating System :: POSIX :: Linux",
12
19
  ]
13
20
  dependencies = [
14
- "annotated-types",
15
- "click",
16
- "debugpy",
21
+ "cloudpickle",
17
22
  "grpcio",
18
23
  "protobuf",
19
24
  "shortuuid",
20
25
  "tblib",
21
26
  "typing-extensions",
27
+ "zeroconf",
22
28
  ]
23
29
  description = "A Python framework for distributed multiprocessing."
24
30
  dynamic = ["version"]
@@ -26,14 +32,22 @@ license = { file = "../LICENSE" }
26
32
  maintainers = [{ email = "maintainers@wool.io" }]
27
33
  name = "wool"
28
34
  readme = "README.md"
29
- requires-python = ">=3.10"
35
+ requires-python = ">=3.11"
30
36
 
31
37
  [project.optional-dependencies]
32
- dev = ["pytest", "pytest-asyncio", "pytest-grpc-aio~=0.2.0", "ruff"]
33
- locking = ["wool-locking"]
38
+ dev = [
39
+ "debugpy",
40
+ "hypothesis",
41
+ "pytest",
42
+ "pytest-asyncio",
43
+ "pytest-cov",
44
+ "pytest-grpc-aio~=0.2.0",
45
+ "pytest-mock",
46
+ "ruff",
47
+ ]
34
48
 
35
49
  [project.scripts]
36
- wool = "wool._cli:cli"
50
+ wool = "wool.cli:cli"
37
51
 
38
52
  [tool.hatch.build.hooks.protobuf]
39
53
  dependencies = ["hatch-protobuf"]
@@ -59,8 +73,13 @@ path = "../build-hooks/build.py"
59
73
  [tool.hatch.metadata.hooks.custom]
60
74
  path = "../build-hooks/metadata.py"
61
75
 
76
+ [tool.pytest.ini_options]
77
+ asyncio_mode = "strict"
78
+ asyncio_default_fixture_loop_scope = "function"
79
+ addopts = "--cov --cov-config=.coveragerc"
80
+
62
81
  [tool.ruff]
63
- line-length = 79
82
+ line-length = 89
64
83
 
65
84
  [tool.ruff.lint]
66
85
  select = ["E", "F", "I"]
@@ -0,0 +1,97 @@
1
+ from contextvars import ContextVar
2
+ from importlib.metadata import PackageNotFoundError
3
+ from importlib.metadata import version
4
+ from typing import Final
5
+ from typing import Generic
6
+ from typing import TypeVar
7
+ from typing import cast
8
+
9
+ from tblib import pickling_support
10
+
11
+ from wool._resource_pool import ResourcePool
12
+ from wool._work import WoolTask
13
+ from wool._work import WoolTaskEvent
14
+ from wool._work import WoolTaskEventCallback
15
+ from wool._work import WoolTaskEventType
16
+ from wool._work import WoolTaskException
17
+ from wool._work import current_task as wool_current_task
18
+ from wool._work import routine
19
+ from wool._work import work
20
+ from wool._worker import Worker
21
+ from wool._worker import WorkerService
22
+ from wool._worker_discovery import DiscoveryService
23
+ from wool._worker_discovery import LanDiscoveryService
24
+ from wool._worker_discovery import LanRegistryService
25
+ from wool._worker_discovery import RegistryService
26
+ from wool._worker_pool import WorkerPool
27
+ from wool._worker_proxy import WorkerProxy
28
+
29
+ pickling_support.install()
30
+
31
+
32
+ SENTINEL = object()
33
+
34
+ T = TypeVar("T")
35
+
36
+
37
+ class GlobalVar(Generic[T]):
38
+ def __init__(self, default: T | None = None) -> None:
39
+ self._default = default
40
+ self._value = SENTINEL
41
+
42
+ def get(self) -> T | None:
43
+ if self._value is SENTINEL:
44
+ return self._default
45
+ else:
46
+ return cast(T, self._value)
47
+
48
+ def set(self, value: T):
49
+ self._value = value
50
+
51
+
52
+ try:
53
+ __version__ = version("wool")
54
+ except PackageNotFoundError:
55
+ __version__ = "unknown"
56
+
57
+ __proxy__: Final[ContextVar[WorkerProxy | None]] = ContextVar("__proxy__", default=None)
58
+
59
+ __proxy_pool__: Final[ContextVar[ResourcePool[WorkerProxy] | None]] = ContextVar(
60
+ "__proxy_pool__", default=None
61
+ )
62
+
63
+ __all__ = [
64
+ "LanDiscoveryService",
65
+ "LanRegistryService",
66
+ "Worker",
67
+ "DiscoveryService",
68
+ "WorkerPool",
69
+ "WorkerProxy",
70
+ "RegistryService",
71
+ "WorkerService",
72
+ "WoolTask",
73
+ "WoolTaskEvent",
74
+ "WoolTaskEventCallback",
75
+ "WoolTaskEventType",
76
+ "WoolTaskException",
77
+ "routine",
78
+ "work",
79
+ "wool_current_task",
80
+ ]
81
+
82
+ for symbol in __all__:
83
+ attribute = globals().get(symbol)
84
+ try:
85
+ if attribute and "wool" in attribute.__module__.split("."):
86
+ # Set the module to reflect imports of the symbol
87
+ attribute.__module__ = __name__
88
+ except AttributeError:
89
+ continue
90
+
91
+ # for plugin in entry_points(group="wool_cli_plugins"):
92
+ # try:
93
+ # plugin.load()
94
+ # logging.info(f"Loaded CLI plugin {plugin.name}")
95
+ # except Exception as e:
96
+ # logging.error(f"Failed to load CLI plugin {plugin.name}: {e}")
97
+ # raise
@@ -0,0 +1,18 @@
1
+ import os
2
+ import sys
3
+ from typing import Protocol
4
+
5
+ sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
6
+
7
+ from . import task as task
8
+ from . import worker as worker
9
+
10
+
11
+ class AddServicerToServerProtocol(Protocol):
12
+ @staticmethod
13
+ def __call__(servicer, server) -> None: ...
14
+
15
+
16
+ add_to_server: dict[type[worker.WorkerServicer], AddServicerToServerProtocol] = {
17
+ worker.WorkerServicer: worker.add_WorkerServicer_to_server,
18
+ }
@@ -0,0 +1,3 @@
1
+ class ProtobufImportError(ImportError):
2
+ def __init__(self, exception: ImportError):
3
+ super().__init__(f"{str(exception)} - ensure protocol buffers are compiled.")
@@ -0,0 +1,11 @@
1
+ try:
2
+ from wool._protobuf.task_pb2 import Exception
3
+ from wool._protobuf.task_pb2 import Result
4
+ from wool._protobuf.task_pb2 import Task
5
+ from wool._protobuf.task_pb2 import Worker as Worker
6
+ except ImportError as e:
7
+ from wool._protobuf.exception import ProtobufImportError
8
+
9
+ raise ProtobufImportError(e) from e
10
+
11
+ __all__ = ["Exception", "Result", "Task", "Worker"]
@@ -0,0 +1,42 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: task.proto
5
+ # Protobuf Python Version: 6.31.1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 31,
16
+ 1,
17
+ '',
18
+ 'task.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+
26
+
27
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\ntask.proto\x12\x13wool._protobuf.task\"s\n\x04Task\x12\n\n\x02id\x18\x01 \x01(\t\x12\x10\n\x08\x63\x61llable\x18\x02 \x01(\x0c\x12\x0c\n\x04\x61rgs\x18\x03 \x01(\x0c\x12\x0e\n\x06kwargs\x18\x04 \x01(\x0c\x12\x0e\n\x06\x63\x61ller\x18\x05 \x01(\t\x12\r\n\x05proxy\x18\x07 \x01(\x0c\x12\x10\n\x08proxy_id\x18\x08 \x01(\t\"\x16\n\x06Result\x12\x0c\n\x04\x64ump\x18\x01 \x01(\x0c\"\x19\n\tException\x12\x0c\n\x04\x64ump\x18\x01 \x01(\x0c\"%\n\x06Worker\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\tb\x06proto3')
28
+
29
+ _globals = globals()
30
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
31
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'task_pb2', _globals)
32
+ if not _descriptor._USE_C_DESCRIPTORS:
33
+ DESCRIPTOR._loaded_options = None
34
+ _globals['_TASK']._serialized_start=35
35
+ _globals['_TASK']._serialized_end=150
36
+ _globals['_RESULT']._serialized_start=152
37
+ _globals['_RESULT']._serialized_end=174
38
+ _globals['_EXCEPTION']._serialized_start=176
39
+ _globals['_EXCEPTION']._serialized_end=201
40
+ _globals['_WORKER']._serialized_start=203
41
+ _globals['_WORKER']._serialized_end=240
42
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,43 @@
1
+ from google.protobuf import descriptor as _descriptor
2
+ from google.protobuf import message as _message
3
+ from typing import ClassVar as _ClassVar, Optional as _Optional
4
+
5
+ DESCRIPTOR: _descriptor.FileDescriptor
6
+
7
+ class Task(_message.Message):
8
+ __slots__ = ("id", "callable", "args", "kwargs", "caller", "proxy", "proxy_id")
9
+ ID_FIELD_NUMBER: _ClassVar[int]
10
+ CALLABLE_FIELD_NUMBER: _ClassVar[int]
11
+ ARGS_FIELD_NUMBER: _ClassVar[int]
12
+ KWARGS_FIELD_NUMBER: _ClassVar[int]
13
+ CALLER_FIELD_NUMBER: _ClassVar[int]
14
+ PROXY_FIELD_NUMBER: _ClassVar[int]
15
+ PROXY_ID_FIELD_NUMBER: _ClassVar[int]
16
+ id: str
17
+ callable: bytes
18
+ args: bytes
19
+ kwargs: bytes
20
+ caller: str
21
+ proxy: bytes
22
+ proxy_id: str
23
+ def __init__(self, id: _Optional[str] = ..., callable: _Optional[bytes] = ..., args: _Optional[bytes] = ..., kwargs: _Optional[bytes] = ..., caller: _Optional[str] = ..., proxy: _Optional[bytes] = ..., proxy_id: _Optional[str] = ...) -> None: ...
24
+
25
+ class Result(_message.Message):
26
+ __slots__ = ("dump",)
27
+ DUMP_FIELD_NUMBER: _ClassVar[int]
28
+ dump: bytes
29
+ def __init__(self, dump: _Optional[bytes] = ...) -> None: ...
30
+
31
+ class Exception(_message.Message):
32
+ __slots__ = ("dump",)
33
+ DUMP_FIELD_NUMBER: _ClassVar[int]
34
+ dump: bytes
35
+ def __init__(self, dump: _Optional[bytes] = ...) -> None: ...
36
+
37
+ class Worker(_message.Message):
38
+ __slots__ = ("id", "address")
39
+ ID_FIELD_NUMBER: _ClassVar[int]
40
+ ADDRESS_FIELD_NUMBER: _ClassVar[int]
41
+ id: str
42
+ address: str
43
+ def __init__(self, id: _Optional[str] = ..., address: _Optional[str] = ...) -> None: ...
@@ -4,7 +4,7 @@ import grpc
4
4
  import warnings
5
5
 
6
6
 
7
- GRPC_GENERATED_VERSION = '1.73.1'
7
+ GRPC_GENERATED_VERSION = '1.75.0'
8
8
  GRPC_VERSION = grpc.__version__
9
9
  _version_not_supported = False
10
10
 
@@ -17,7 +17,7 @@ except ImportError:
17
17
  if _version_not_supported:
18
18
  raise RuntimeError(
19
19
  f'The grpc package installed is at version {GRPC_VERSION},'
20
- + f' but the generated code in mempool/metadata/metadata_pb2_grpc.py depends on'
20
+ + f' but the generated code in task_pb2_grpc.py depends on'
21
21
  + f' grpcio>={GRPC_GENERATED_VERSION}.'
22
22
  + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
23
23
  + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
@@ -0,0 +1,24 @@
1
+ try:
2
+ from wool._protobuf.worker_pb2 import Ack
3
+ from wool._protobuf.worker_pb2 import Nack
4
+ from wool._protobuf.worker_pb2 import Response
5
+ from wool._protobuf.worker_pb2 import StopRequest
6
+ from wool._protobuf.worker_pb2 import Void
7
+ from wool._protobuf.worker_pb2_grpc import WorkerServicer
8
+ from wool._protobuf.worker_pb2_grpc import WorkerStub
9
+ from wool._protobuf.worker_pb2_grpc import add_WorkerServicer_to_server
10
+ except ImportError as e:
11
+ from wool._protobuf.exception import ProtobufImportError
12
+
13
+ raise ProtobufImportError(e) from e
14
+
15
+ __all__ = [
16
+ "Ack",
17
+ "Nack",
18
+ "Response",
19
+ "StopRequest",
20
+ "Void",
21
+ "WorkerServicer",
22
+ "WorkerStub",
23
+ "add_WorkerServicer_to_server",
24
+ ]
@@ -0,0 +1,47 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: worker.proto
5
+ # Protobuf Python Version: 6.31.1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 31,
16
+ 1,
17
+ '',
18
+ 'worker.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+ import task_pb2 as task__pb2
26
+
27
+
28
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cworker.proto\x12\x15wool._protobuf.worker\x1a\ntask.proto\"\xd1\x01\n\x08Response\x12)\n\x03\x61\x63k\x18\x01 \x01(\x0b\x32\x1a.wool._protobuf.worker.AckH\x00\x12+\n\x04nack\x18\x02 \x01(\x0b\x32\x1b.wool._protobuf.worker.NackH\x00\x12-\n\x06result\x18\x03 \x01(\x0b\x32\x1b.wool._protobuf.task.ResultH\x00\x12\x33\n\texception\x18\x04 \x01(\x0b\x32\x1e.wool._protobuf.task.ExceptionH\x00\x42\t\n\x07payload\"\x05\n\x03\x41\x63k\"\x16\n\x04Nack\x12\x0e\n\x06reason\x18\x01 \x01(\t\"\x1b\n\x0bStopRequest\x12\x0c\n\x04wait\x18\x01 \x01(\x05\"\x06\n\x04Void2\x9b\x01\n\x06Worker\x12H\n\x08\x64ispatch\x12\x19.wool._protobuf.task.Task\x1a\x1f.wool._protobuf.worker.Response0\x01\x12G\n\x04stop\x12\".wool._protobuf.worker.StopRequest\x1a\x1b.wool._protobuf.worker.Voidb\x06proto3')
29
+
30
+ _globals = globals()
31
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
32
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'worker_pb2', _globals)
33
+ if not _descriptor._USE_C_DESCRIPTORS:
34
+ DESCRIPTOR._loaded_options = None
35
+ _globals['_RESPONSE']._serialized_start=52
36
+ _globals['_RESPONSE']._serialized_end=261
37
+ _globals['_ACK']._serialized_start=263
38
+ _globals['_ACK']._serialized_end=268
39
+ _globals['_NACK']._serialized_start=270
40
+ _globals['_NACK']._serialized_end=292
41
+ _globals['_STOPREQUEST']._serialized_start=294
42
+ _globals['_STOPREQUEST']._serialized_end=321
43
+ _globals['_VOID']._serialized_start=323
44
+ _globals['_VOID']._serialized_end=329
45
+ _globals['_WORKER']._serialized_start=332
46
+ _globals['_WORKER']._serialized_end=487
47
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,39 @@
1
+ import task_pb2 as _task_pb2
2
+ from google.protobuf import descriptor as _descriptor
3
+ from google.protobuf import message as _message
4
+ from collections.abc import Mapping as _Mapping
5
+ from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
6
+
7
+ DESCRIPTOR: _descriptor.FileDescriptor
8
+
9
+ class Response(_message.Message):
10
+ __slots__ = ("ack", "nack", "result", "exception")
11
+ ACK_FIELD_NUMBER: _ClassVar[int]
12
+ NACK_FIELD_NUMBER: _ClassVar[int]
13
+ RESULT_FIELD_NUMBER: _ClassVar[int]
14
+ EXCEPTION_FIELD_NUMBER: _ClassVar[int]
15
+ ack: Ack
16
+ nack: Nack
17
+ result: _task_pb2.Result
18
+ exception: _task_pb2.Exception
19
+ def __init__(self, ack: _Optional[_Union[Ack, _Mapping]] = ..., nack: _Optional[_Union[Nack, _Mapping]] = ..., result: _Optional[_Union[_task_pb2.Result, _Mapping]] = ..., exception: _Optional[_Union[_task_pb2.Exception, _Mapping]] = ...) -> None: ...
20
+
21
+ class Ack(_message.Message):
22
+ __slots__ = ()
23
+ def __init__(self) -> None: ...
24
+
25
+ class Nack(_message.Message):
26
+ __slots__ = ("reason",)
27
+ REASON_FIELD_NUMBER: _ClassVar[int]
28
+ reason: str
29
+ def __init__(self, reason: _Optional[str] = ...) -> None: ...
30
+
31
+ class StopRequest(_message.Message):
32
+ __slots__ = ("wait",)
33
+ WAIT_FIELD_NUMBER: _ClassVar[int]
34
+ wait: int
35
+ def __init__(self, wait: _Optional[int] = ...) -> None: ...
36
+
37
+ class Void(_message.Message):
38
+ __slots__ = ()
39
+ def __init__(self) -> None: ...
@@ -0,0 +1,141 @@
1
+ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2
+ """Client and server classes corresponding to protobuf-defined services."""
3
+ import grpc
4
+ import warnings
5
+
6
+ from . import task_pb2 as task__pb2
7
+ from . import worker_pb2 as worker__pb2
8
+
9
+ GRPC_GENERATED_VERSION = '1.75.0'
10
+ GRPC_VERSION = grpc.__version__
11
+ _version_not_supported = False
12
+
13
+ try:
14
+ from grpc._utilities import first_version_is_lower
15
+ _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
16
+ except ImportError:
17
+ _version_not_supported = True
18
+
19
+ if _version_not_supported:
20
+ raise RuntimeError(
21
+ f'The grpc package installed is at version {GRPC_VERSION},'
22
+ + f' but the generated code in worker_pb2_grpc.py depends on'
23
+ + f' grpcio>={GRPC_GENERATED_VERSION}.'
24
+ + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
25
+ + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
26
+ )
27
+
28
+
29
+ class WorkerStub(object):
30
+ """Missing associated documentation comment in .proto file."""
31
+
32
+ def __init__(self, channel):
33
+ """Constructor.
34
+
35
+ Args:
36
+ channel: A grpc.Channel.
37
+ """
38
+ self.dispatch = channel.unary_stream(
39
+ '/wool._protobuf.worker.Worker/dispatch',
40
+ request_serializer=task__pb2.Task.SerializeToString,
41
+ response_deserializer=worker__pb2.Response.FromString,
42
+ _registered_method=True)
43
+ self.stop = channel.unary_unary(
44
+ '/wool._protobuf.worker.Worker/stop',
45
+ request_serializer=worker__pb2.StopRequest.SerializeToString,
46
+ response_deserializer=worker__pb2.Void.FromString,
47
+ _registered_method=True)
48
+
49
+
50
+ class WorkerServicer(object):
51
+ """Missing associated documentation comment in .proto file."""
52
+
53
+ def dispatch(self, request, context):
54
+ """Missing associated documentation comment in .proto file."""
55
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
56
+ context.set_details('Method not implemented!')
57
+ raise NotImplementedError('Method not implemented!')
58
+
59
+ def stop(self, request, context):
60
+ """Missing associated documentation comment in .proto file."""
61
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
62
+ context.set_details('Method not implemented!')
63
+ raise NotImplementedError('Method not implemented!')
64
+
65
+
66
+ def add_WorkerServicer_to_server(servicer, server):
67
+ rpc_method_handlers = {
68
+ 'dispatch': grpc.unary_stream_rpc_method_handler(
69
+ servicer.dispatch,
70
+ request_deserializer=task__pb2.Task.FromString,
71
+ response_serializer=worker__pb2.Response.SerializeToString,
72
+ ),
73
+ 'stop': grpc.unary_unary_rpc_method_handler(
74
+ servicer.stop,
75
+ request_deserializer=worker__pb2.StopRequest.FromString,
76
+ response_serializer=worker__pb2.Void.SerializeToString,
77
+ ),
78
+ }
79
+ generic_handler = grpc.method_handlers_generic_handler(
80
+ 'wool._protobuf.worker.Worker', rpc_method_handlers)
81
+ server.add_generic_rpc_handlers((generic_handler,))
82
+ server.add_registered_method_handlers('wool._protobuf.worker.Worker', rpc_method_handlers)
83
+
84
+
85
+ # This class is part of an EXPERIMENTAL API.
86
+ class Worker(object):
87
+ """Missing associated documentation comment in .proto file."""
88
+
89
+ @staticmethod
90
+ def dispatch(request,
91
+ target,
92
+ options=(),
93
+ channel_credentials=None,
94
+ call_credentials=None,
95
+ insecure=False,
96
+ compression=None,
97
+ wait_for_ready=None,
98
+ timeout=None,
99
+ metadata=None):
100
+ return grpc.experimental.unary_stream(
101
+ request,
102
+ target,
103
+ '/wool._protobuf.worker.Worker/dispatch',
104
+ task__pb2.Task.SerializeToString,
105
+ worker__pb2.Response.FromString,
106
+ options,
107
+ channel_credentials,
108
+ insecure,
109
+ call_credentials,
110
+ compression,
111
+ wait_for_ready,
112
+ timeout,
113
+ metadata,
114
+ _registered_method=True)
115
+
116
+ @staticmethod
117
+ def stop(request,
118
+ target,
119
+ options=(),
120
+ channel_credentials=None,
121
+ call_credentials=None,
122
+ insecure=False,
123
+ compression=None,
124
+ wait_for_ready=None,
125
+ timeout=None,
126
+ metadata=None):
127
+ return grpc.experimental.unary_unary(
128
+ request,
129
+ target,
130
+ '/wool._protobuf.worker.Worker/stop',
131
+ worker__pb2.StopRequest.SerializeToString,
132
+ worker__pb2.Void.FromString,
133
+ options,
134
+ channel_credentials,
135
+ insecure,
136
+ call_credentials,
137
+ compression,
138
+ wait_for_ready,
139
+ timeout,
140
+ metadata,
141
+ _registered_method=True)