MacroServer API reference¶
The MacroServer is one of the most important elements in sardana.
This chapter explains the generic macroserver API in the context of sardana. In sardana there are, in fact, two MacroServer APIs. To better explain why, let’s consider the case were sardana server is running as a Sardana Tango device server:
Every macroserver in sardana is represented in the sardana kernel as a
MacroServer API is not directly
accessible from outside the sardana server. This is a low level API
that is only accessible to someone writing a server extension to sardana. At
the time of writing, the only available sardana server extension is Tango.
The second macroserver interface consists on the one provided by the server
extension, which is in this case the one provided by the Tango macroserver
MacroServer. The Tango
macroserver interface tries to mimic the as closely as possible the
Each macroserver has the following attributes:
MacroServer may connect to none, one or many Device Pools. The advantage of connecting to device pools is the native access to the pool elements e.g. motors, experimental channels, etc. and their possible use in the macros. Most of the standard macros, for example scans, wants to interface with them. MacroServer listens to the device pool elements events so it is aware of new, modified and deleted elements.
Macro environment is stored in an external database. Currently it is implemented using the Python shelve module. The shelve file is stored on the file system and by default it points to the OS temporary directory e.g.
/tmpin case of Linux which may be transitory. It is highly recommended to change this location.
MacroServer may load user macros and this are discoverable by scanning the file system directories configured in macro path.
MacroServer may load user recorders and this are discoverable by scanning the file system directories configured in recorder path.
Macros may need to access to third party Python modules. When these are not available to the Python interpreter i.e. exported to the
PYTHONPATH, one can configure the file system directories where the MacroServer should look for these modules.
max parallel macros¶
Multiple macros can run concurrently in the MacroServer on different Doors. The maximum number of these threads is configurable.
Default value: 5
log report file name¶
Macros may report information to a file and its location is configurable.