wool 0.1rc9__py3-none-any.whl → 0.1rc10__py3-none-any.whl

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 (44) hide show
  1. wool/__init__.py +71 -50
  2. wool/_protobuf/__init__.py +12 -5
  3. wool/_protobuf/exception.py +3 -0
  4. wool/_protobuf/task.py +11 -0
  5. wool/_protobuf/task_pb2.py +42 -0
  6. wool/_protobuf/task_pb2.pyi +43 -0
  7. wool/_protobuf/{mempool/metadata_pb2_grpc.py → task_pb2_grpc.py} +2 -2
  8. wool/_protobuf/worker.py +24 -0
  9. wool/_protobuf/worker_pb2.py +47 -0
  10. wool/_protobuf/worker_pb2.pyi +39 -0
  11. wool/_protobuf/worker_pb2_grpc.py +141 -0
  12. wool/_resource_pool.py +376 -0
  13. wool/_typing.py +0 -10
  14. wool/_work.py +553 -0
  15. wool/_worker.py +843 -169
  16. wool/_worker_discovery.py +1223 -0
  17. wool/_worker_pool.py +331 -0
  18. wool/_worker_proxy.py +515 -0
  19. {wool-0.1rc9.dist-info → wool-0.1rc10.dist-info}/METADATA +7 -7
  20. wool-0.1rc10.dist-info/RECORD +22 -0
  21. wool-0.1rc10.dist-info/entry_points.txt +2 -0
  22. wool/_cli.py +0 -262
  23. wool/_event.py +0 -109
  24. wool/_future.py +0 -171
  25. wool/_logging.py +0 -44
  26. wool/_manager.py +0 -181
  27. wool/_mempool/__init__.py +0 -4
  28. wool/_mempool/_client.py +0 -167
  29. wool/_mempool/_mempool.py +0 -311
  30. wool/_mempool/_metadata.py +0 -35
  31. wool/_mempool/_service.py +0 -227
  32. wool/_pool.py +0 -524
  33. wool/_protobuf/mempool/metadata_pb2.py +0 -36
  34. wool/_protobuf/mempool/metadata_pb2.pyi +0 -17
  35. wool/_protobuf/mempool/service_pb2.py +0 -66
  36. wool/_protobuf/mempool/service_pb2.pyi +0 -108
  37. wool/_protobuf/mempool/service_pb2_grpc.py +0 -355
  38. wool/_queue.py +0 -32
  39. wool/_session.py +0 -429
  40. wool/_task.py +0 -366
  41. wool/_utils.py +0 -63
  42. wool-0.1rc9.dist-info/RECORD +0 -29
  43. wool-0.1rc9.dist-info/entry_points.txt +0 -2
  44. {wool-0.1rc9.dist-info → wool-0.1rc10.dist-info}/WHEEL +0 -0
wool/__init__.py CHANGED
@@ -1,61 +1,82 @@
1
- import logging
2
1
  from contextvars import ContextVar
3
- from importlib.metadata import entry_points
2
+ from importlib.metadata import PackageNotFoundError
3
+ from importlib.metadata import version
4
4
  from typing import Final
5
+ from typing import Generic
6
+ from typing import TypeVar
7
+ from typing import cast
5
8
 
6
9
  from tblib import pickling_support
7
10
 
8
- from wool._cli import WorkerPoolCommand
9
- from wool._cli import cli
10
- from wool._future import Future
11
- from wool._logging import __log_format__
12
- from wool._pool import WorkerPool
13
- from wool._pool import pool
14
- from wool._session import LocalSession
15
- from wool._session import WorkerPoolSession
16
- from wool._session import session
17
- from wool._task import Task
18
- from wool._task import TaskEvent
19
- from wool._task import TaskEventCallback
20
- from wool._task import TaskException
21
- from wool._task import current_task
22
- from wool._task import task
23
- from wool._worker import Scheduler
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
24
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
25
28
 
26
29
  pickling_support.install()
27
30
 
28
- # PUBLIC
29
- __log_format__: str = __log_format__
30
31
 
31
- # PUBLIC
32
- __log_level__: int = logging.INFO
32
+ SENTINEL = object()
33
33
 
34
- # PUBLIC
35
- __wool_session__: Final[ContextVar[WorkerPoolSession]] = ContextVar(
36
- "__wool_session__", default=LocalSession()
37
- )
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
38
50
 
39
- __wool_worker__: Worker | None = None
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
+ )
40
62
 
41
63
  __all__ = [
42
- "TaskException",
43
- "Future",
44
- "Task",
45
- "TaskEvent",
46
- "TaskEventCallback",
64
+ "LanDiscoveryService",
65
+ "LanRegistryService",
66
+ "Worker",
67
+ "DiscoveryService",
47
68
  "WorkerPool",
48
- "WorkerPoolSession",
49
- "WorkerPoolCommand",
50
- "Scheduler",
51
- "__log_format__",
52
- "__log_level__",
53
- "__wool_session__",
54
- "cli",
55
- "current_task",
56
- "pool",
57
- "session",
58
- "task",
69
+ "WorkerProxy",
70
+ "RegistryService",
71
+ "WorkerService",
72
+ "WoolTask",
73
+ "WoolTaskEvent",
74
+ "WoolTaskEventCallback",
75
+ "WoolTaskEventType",
76
+ "WoolTaskException",
77
+ "routine",
78
+ "work",
79
+ "wool_current_task",
59
80
  ]
60
81
 
61
82
  for symbol in __all__:
@@ -67,10 +88,10 @@ for symbol in __all__:
67
88
  except AttributeError:
68
89
  continue
69
90
 
70
- for plugin in entry_points(group="wool_cli_plugins"):
71
- try:
72
- plugin.load()
73
- logging.info(f"Loaded CLI plugin {plugin.name}")
74
- except Exception as e:
75
- logging.error(f"Failed to load CLI plugin {plugin.name}: {e}")
76
- raise
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
@@ -1,11 +1,18 @@
1
1
  import os
2
2
  import sys
3
+ from typing import Protocol
3
4
 
4
5
  sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
5
6
 
7
+ from . import task as task
8
+ from . import worker as worker
6
9
 
7
- class ProtobufImportError(ImportError):
8
- def __init__(self, exception: ImportError):
9
- super().__init__(
10
- f"{str(exception)} - ensure protocol buffers are compiled."
11
- )
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.")
wool/_protobuf/task.py ADDED
@@ -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_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)