class labscript_utils.ls_zprocess.Context(io_threads=1, shared_secret=None)[source]

Subclass of configured with settings from labconfig, substitutable for a zmq.Context. Can be instantiated to get a unique context, or call the .instance() classmethod to possibly get an already-existing one. Only use the latter if you do not indent to terminate the context.

classmethod instance()[source]

Returns a shared instance with the same shared secret, if there is one, otherwise creates it. If an instance already exists, io_threads will be ignored, otherwise it will be used in the new instance. Takes into account subclasses such that a subclass calling this method will always get back an instance of its own class

socket(*args, **kwargs)[source]

Create a Socket associated with this Context.

  • socket_type (int) – The socket type, which can be any of the 0MQ socket types: REQ, REP, PUB, SUB, PAIR, DEALER, ROUTER, PULL, PUSH, etc.

  • kwargs – will be passed to the __init__ method of the socket class.

labscript_utils.ls_zprocess.Event(*args, **kwargs)[source]
labscript_utils.ls_zprocess.Handler(*args, **kwargs)[source]
labscript_utils.ls_zprocess.Lock(*args, **kwargs)[source]
class labscript_utils.ls_zprocess.ProcessTree(shared_secret=None, allow_insecure=False, zlock_host=None, zlock_port=7339, zlog_host=None, zlog_port=7340)[source]

A singleton zprocess.ProcessTree configured with settings from labconfig for security, zlock and zlog. Being a singleton is not enforced - the class can still be instantiated as normal - but calling the .instance() classmethod will give the singleton.

_instance = <labscript_utils.ls_zprocess.ProcessTree object>
classmethod instance()[source]
labscript_utils.ls_zprocess.RemoteProcessClient(host, port=None)[source]
class labscript_utils.ls_zprocess.ZMQClient[source]

A singleton zprocess.ZMQClient configured with settings from labconfig for security. Being a singleton is not enforced - the class can still be instantiated as normal - but calling the .instance() classmethod will give the singleton.

_instance = None
classmethod instance()[source]
class labscript_utils.ls_zprocess.ZMQServer(port=None, dtype='pyobj', pull_only=False, bind_address='tcp://', timeout_interval=None, **kwargs)[source]

A ZMQServer configured with security settings from labconfig


Ensure we are connected to a zlog server. If one is not running and we are the top-level process, start a zlog server configured according to LabConfig.


Get relevant options from LabConfig, substituting defaults where appropriate and return as a dict

labscript_utils.ls_zprocess.zmq_get(*args, **kwargs)[source]
labscript_utils.ls_zprocess.zmq_get_multipart(*args, **kwargs)[source]
labscript_utils.ls_zprocess.zmq_get_raw(*args, **kwargs)[source]
labscript_utils.ls_zprocess.zmq_get_string(*args, **kwargs)[source]
labscript_utils.ls_zprocess.zmq_push(*args, **kwargs)[source]
labscript_utils.ls_zprocess.zmq_push_multipart(*args, **kwargs)[source]
labscript_utils.ls_zprocess.zmq_push_raw(*args, **kwargs)[source]
labscript_utils.ls_zprocess.zmq_push_string(*args, **kwargs)[source]