orangeqs.juice.task_manager._remote#
Task-manager side of remote services: the ack gate and Reverse Channel.
Module Contents#
Classes#
Outcome of the acknowledgement gate and the frame it maps to. |
|
A registered remote connection in the Task Manager. |
|
In-memory table of currently-acknowledged remotes, keyed by name. |
|
The Reverse Channel endpoint a remote connects to. |
|
Bridges a remote’s Events publishes onto the internal ZMQ bus. |
|
Streams internal ZMQ bus events out to a subscribing remote. |
Functions#
Gate a connecting remote by its declared name. |
API#
- class orangeqs.juice.task_manager._remote.AckResult#
Outcome of the acknowledgement gate and the frame it maps to.
- orangeqs.juice.task_manager._remote.acknowledge(name: str, *, declared_remotes: collections.abc.Iterable[str], managed_services: collections.abc.Iterable[str]) orangeqs.juice.task_manager._remote.AckResult#
Gate a connecting remote by its declared name.
A remote is admitted iff it’s declared in the juice config and not colliding with a a local service name.
- class orangeqs.juice.task_manager._remote.RemoteConnection(handler: orangeqs.juice.task_manager._remote.RemoteChannelHandler, name: str)#
A registered remote connection in the Task Manager.
- async request_raw(task_id: str, message: str | bytes) asyncio.Future[dict[str, Any]]#
Push a raw task frame down the channel; return a future for its result.
- class orangeqs.juice.task_manager._remote.RemoteRegistry#
In-memory table of currently-acknowledged remotes, keyed by name.
- register(connection: orangeqs.juice.task_manager._remote.RemoteConnection) None#
Register a connection, replacing (and closing) any prior one for its name.
- deregister(connection: orangeqs.juice.task_manager._remote.RemoteConnection) None#
Remove a connection if it is still the registered one for its name.
- get(name: str) orangeqs.juice.task_manager._remote.RemoteConnection | None#
Return the live connection for a name, or None.
- class orangeqs.juice.task_manager._remote.RemoteChannelHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs: Any)#
Bases:
tornado.websocket.WebSocketHandlerThe Reverse Channel endpoint a remote connects to.
- initialize(registry: orangeqs.juice.task_manager._remote.RemoteRegistry, declared_remotes: collections.abc.Callable[[], collections.abc.Iterable[str]], managed_services: collections.abc.Callable[[], collections.abc.Iterable[str]]) None#
Wire the handler to the registry and config sources.
declared_remotes/managed_servicesare callables so the gate reads current config per connection, not a boot-time snapshot. This ensures that newly added remote configs are applied instantly on new connections.
- class orangeqs.juice.task_manager._remote.RemotePubBridgeHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs: Any)#
Bases:
tornado.websocket.WebSocketHandlerBridges a remote’s Events publishes onto the internal ZMQ bus.
- initialize(publish_frame: collections.abc.Callable[[list[bytes]], collections.abc.Awaitable[None]]) None#
Wire the bus publish path (a long-lived, slow-joiner-safe publisher).
- class orangeqs.juice.task_manager._remote.RemoteSubBridgeHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs: Any)#
Bases:
tornado.websocket.WebSocketHandlerStreams internal ZMQ bus events out to a subscribing remote.
- initialize(sub_socket_factory: collections.abc.Callable[[], Any]) None#
Store the socket factory; the socket opens once the WS is established.