microscope.deviceserver module

A class for serving microscope components.

This module provides a server to make microscope control objects available over Pyro. When called from the command line, this module will serve devices defined in a specified config file.

class microscope.deviceserver.DeviceServer(device_def, id_to_host, id_to_port, exit_event=None)[source]

Bases: multiprocessing.context.Process

clone()[source]

Create new instance with same settings.

This is useful to restart a device server.

run()[source]

Method to be run in sub-process; can be overridden in sub-class

class microscope.deviceserver.Filter[source]

Bases: logging.Filter

filter(record)[source]

Pass, aggregate or suppress consecutive repetitions of a log message.

microscope.deviceserver.__console__()[source]

Serve devices from a console process.

microscope.deviceserver.__main__()[source]

Serve devices via Pyro.

To run in the terminal, use:

deviceserver CONFIG

To configure and run as a Windows service use:

deviceserver [install,remove,update,start,stop,restart,status] CONFIG

CONFIG is a .py file that exports DEVICES = [device(...), ...]

microscope.deviceserver.__winservice__()[source]

Configure and control a Windows service to serve devices.

microscope.deviceserver._create_log_formatter(name: str)[source]

Create a logging.Formatter for the device server.

Each device is served on its own process and each device has its own log file. But the logs from all device servers also appear on stderr where it will be difficult to figure out from which device server a log message comes. This creates a logging.Formatter which includes the device server name.

Parameters:name (str) – device name to be used on the log output.
microscope.deviceserver.serve_devices(devices, exit_event=None)[source]
microscope.deviceserver.validate_devices(configfile)[source]