mstar.communication.communicator#
Module Attributes
The |
|
the one every deployment has exactly one of. |
Functions
|
Construct the process's communicator, selecting the transport. |
|
Classes
|
|
|
A communicator whose sends never block: a send the peer can't take now (at its high-water mark) is queued, in order behind any earlier one to the same peer, and retried by |
|
- class mstar.communication.communicator.BaseCommunicator[source]#
Bases:
ABC- abstractmethod poll_for_messages(timeout_ms=20)[source]#
Block until a message is readable, the registered event fires, or
timeout_mselapses, whichever comes first. True when a message is waiting forget_all_new_messages; a fired event is drained.
- abstractmethod register_event_for_poll(event)[source]#
Have
poll_for_messages(andwait_for_work) also end wheneventis signalled.- Parameters:
event (EventWakeup)
- Return type:
None
- abstractmethod send(entity_id, msg)[source]#
entity_id: worker_xyz, conductor, or api_server
- Parameters:
entity_id (str)
- class mstar.communication.communicator.CommProtocol(*values)[source]#
Bases:
Enum- IPC = 'IPC'#
- RDMA = 'RDMA'#
- SHM = 'SHM'#
- TCP = 'TCP'#
- mstar.communication.communicator.DEPLOYMENT_ANCHOR_ENTITY = 'conductor'#
the one every deployment has exactly one of. Two deployments that agree on this endpoint ARE the same deployment as far as anything keyed off it is concerned – notably the tensor-file namespace in
mstar.communication.tensors.- Type:
The entity whose endpoint stands for the whole deployment
- mstar.communication.communicator.EXPECTED_MSTAR_RUST_VERSION = '0.1.1'#
The
mstar_rustextension version this tree expects (the vendoredrust/crate’s version). UnderMSTAR_RUST_ZMQ=AUTOa mismatching install - e.g. a stale wheel after an upgrade - takes over the mesh silently, so the factory warns when the imported version differs.
- class mstar.communication.communicator.OutboxCommunicator(inner)[source]#
Bases:
objectA communicator whose sends never block: a send the peer can’t take now (at its high-water mark) is queued, in order behind any earlier one to the same peer, and retried by
flush.For a loop that peers block on while it sends to them (the API server’s preprocess thread, against the conductor and the workers): if it blocked on a full peer it would stop reading the input that peer waits to deliver, and the two would wait on each other for good. Everything else is the wrapped communicator’s.
- Parameters:
inner (BaseCommunicator)
- class mstar.communication.communicator.ZMQCommunicator(my_id, push_ids, protocol=CommProtocol.IPC, ipc_socket_path_prefix='/tmp/mstar/', codec=None)[source]#
Bases:
BaseCommunicator- Parameters:
- poll_for_messages(timeout_ms=20)[source]#
Block until a message is readable, a registered wakeup event fires, or
timeout_mselapses — whichever comes first. True when a message is available (left queued forget_all_new_messages); a wakeup ends the poll early with False (the event is drained, exactly as inwait_for_work). Mirrors the Rust communicator’s method so call sites work against either transport.
- register_event_for_poll(event)[source]#
Have
poll_for_messages(andwait_for_work) also end wheneventis signalled.- Parameters:
event (EventWakeup)
- send(entity_id, msg)[source]#
entity_id: worker_xyz, conductor, or api_server
- Parameters:
entity_id (str)
- mstar.communication.communicator.make_communicator(*args, nonblocking_send=False, **kwargs)[source]#
Construct the process’s communicator, selecting the transport.
MSTAR_RUST_ZMQselects it (seedocs/environment_variables.rst):AUTO(default) — the Rust-backedRustZMQCommunicator(vendoredrust/extension; seecommunication/rust_communicator.py) when the extension imports successfully, pyzmq otherwise.1— the Rust communicator; raises if the extension is missing.0— always the pyzmqZMQCommunicator.
The two are wire-compatible (same endpoints, same codec), so the flag can be set per-process — one entity at a time — while the rest of the mesh stays on pyzmq.
nonblocking_sendis for a communicatorOutboxCommunicatorwraps, which needstry_send_bytes: an extension built beforeZmqCommunicator.try_sendfalls back to pyzmq underAUTOand raises under1. Every other caller keeps such a build.- Parameters:
nonblocking_send (bool)
- Return type: