mahos.inst.server.InstrumentServer#
- class mahos.inst.server.InstrumentServer(gconf: dict, name, context=None, include=None, exclude=None)#
Instrument RPC Server.
Provides RPC services for instruments. Communication is done with the REQ/REP pattern. Multiple clients can use the resource. Each client can lock some instruments for exclusive procedure execution.
An
Instrumentconfig is defined under theinstrumentdictionary in this node’s config. The key is the instrument name, and the value (dict) is the instrument configuration. The following three keys are used in each value dict.module: The module name holding the Instrument class. It must be an importable Python module, but leadingmahos.inst.can be omitted if a submodule inmahos.instpackage is used.class: The Instrument class name. The class must be an attribute of themodule.conf: The configuration dictionary for the Instrument (this is optional, but usually necessary).
An
InstrumentOverlayconfig is defined under theinstrument_overlaydictionary in the config. The key is the overlay name, and the value (dict) is the overlay configuration. The following three keys are used in each value dict.module: The module name holding the InstrumentOverlay class. It must be an importable Python module, but leadingmahos.inst.overlay.can be omitted if a submodule inmahos.inst.overlaypackage is used.class: The InstrumentOverlay class name. The class must be an attribute of themodule.conf: The configuration dictionary for the InstrumentOverlay. If a value in this dictionary is a string starting with$, it is considered a reference to an Instrument/InstrumentOverlay in this server. The overlay receives the resolved value, i.e., an Instrument/InstrumentOverlay instance instead of a string.
- Parameters:
instrument (dict[str, dict[str, str | dict]]) – Instrument class configuration mapping.
instrument_overlay (dict[str, dict[str, str | dict]]) – Optional overlay class configuration mapping.
- __init__(gconf: dict, name, context=None, include=None, exclude=None)#
Methods
__init__(gconf, name[, context, include, ...])close_resources()Close custom resources.
handle_req(msg)Handle an incoming Request and return a Reply.
main()Main procedure that will be looped.
Attributes