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 Instrument config is defined under the instrument dictionary 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 leading mahos.inst. can be omitted if a submodule in mahos.inst package is used.

  • class: The Instrument class name. The class must be an attribute of the module.

  • conf: The configuration dictionary for the Instrument (this is optional, but usually necessary).

An InstrumentOverlay config is defined under the instrument_overlay dictionary 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 leading mahos.inst.overlay. can be omitted if a submodule in mahos.inst.overlay package is used.

  • class: The InstrumentOverlay class name. The class must be an attribute of the module.

  • 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