MacroServer

The MacroServer tango module

Classes

MacroServer

Inheritance diagram of MacroServer
class MacroServer(cl, name)[source]

Bases: SardanaDevice

The MacroServer tango class

ElementsCache = None
EnvironmentCache = None
init(name)[source]

initialize the device once in the object lifetime. Override when necessary but always call the method from your super class

:param str name: device name

property macro_server
delete_device()[source]

Clean the device. Called during shutdown and every time the tango Init command is executed. Override when necessary but always call the method from your super class

init_device()[source]

Initialize the device. Called during startup after init() and every time the tango Init command is executed. Override when necessary but always call the method from your super class

sardana_init_hook()[source]

Hook that is called before the server event loop.

The idea behind this hook is to be equivalent to server_init_hook from Tango. Similar behaviour can be archived using post_init_callback.

on_macro_server_changed(evt_src, evt_type, evt_value)[source]
always_executed_hook(self)[source]

Hook method.

Default method to implement an action necessary on a device before any command is executed. This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs

Raises:

DevFailed – This method does not throw exception but a redefined method can.

read_DoorList(attr)[source]
read_MacroList(*args, **kwargs)[source]
read_MacroLibList(attr)[source]
read_TypeList(attr)[source]
getElements(cache=True)[source]
read_Elements(attr)[source]
is_Elements_allowed(req_type)[source]
is_DoorList_allowed(req_type)
is_MacroList_allowed(req_type)
is_MacroLibList_allowed(req_type)
is_TypeList_allowed(req_type)
GetMacroInfo(macro_names)[source]

Get macro information

Returns a list of strings containing macro information. Each string is a JSON encoded.

Parameters:

macro_names (list(str)) – macro(s) name(s)

Returns:

macro(s) information

Return type:

list(str)

ReloadMacro(macro_names)[source]

ReloadMacro(list<string> macro_names):

ReloadMacroLib(lib_names)[source]

ReloadMacroLib(sequence<string> lib_names):

GetMacroCode(<module name>[, <macro name>]) full filename, code, line_nb[source]
SetMacroCode(argin)[source]
getEnvironment(cache=True)[source]
read_Environment(attr)[source]
write_Environment(attr)[source]
is_Environment_allowed(req_type)[source]

MacroServerClass

Inheritance diagram of MacroServerClass
class MacroServerClass(name)[source]

Bases: SardanaDeviceClass

MacroServer Tango class class

class_property_list = {}

Sardana device class properties definition

device_property_list = {'EnvironmentDb': [tango._tango.CmdArgType.DevString, 'The environment database (usually a plain file).', '/tmp/tango/%(ds_exec_name)s/%(ds_inst_name)s/macroserver.properties'], 'LogReportFilename': [tango._tango.CmdArgType.DevString, "Filename (absolute) which contains user log reports [default: None, meaning don't store log report messages]. The system will save old log files by appending extensions to the filename. The extensions are date-and-time based, using the strftime format %Y-%m-%d_%H-%M-%S or a leading portion thereof, depending on the rollover interval.", None], 'LogReportFormat': [tango._tango.CmdArgType.DevString, "Log report format [default: '%(levelname)-8s %(asctime)s: %(message)s']", '%(levelname)-8s %(asctime)s: %(message)s'], 'LogstashCacheDbPath': [tango._tango.CmdArgType.DevString, 'Path to the Logstash cache database [default: None]. It is advised not to use the database cache, as it may have negative effects on logging performance. See #895. This property has been included in Sardana on a provisional basis. Backwards incompatible changes (up to and including its removal) may occur if deemed necessary by the core developers.', None], 'LogstashHost': [tango._tango.CmdArgType.DevString, 'Hostname where Logstash runs. This property has been included in Sardana on a provisional basis. Backwards incompatible changes (up to and including its removal) may occur if deemed necessary by the core developers.', None], 'LogstashPort': [tango._tango.CmdArgType.DevLong, 'Port on which Logstash will listen on events [default: 12345]. This property has been included in Sardana on a provisional basis. Backwards incompatible changes (up to and including its removal) may occur if deemed necessary by the core developers.', 12345], 'MacroPath': [tango._tango.CmdArgType.DevVarStringArray, "list of directories to search for macros (path separators can be '\n' or character conventionally used by the OS toseparate search path components, such as ':' for POSIXor ';' for Windows)", []], 'MaxParallelMacros': [tango._tango.CmdArgType.DevLong, 'Maximum number of macros that can execute concurrently.', [10]], 'PoolNames': [tango._tango.CmdArgType.DevVarStringArray, 'Sardana device pool device names', []], 'PythonPath': [tango._tango.CmdArgType.DevVarStringArray, "list of directories to be appended to sys.path at startup (path separators can be '\n' or ':')", []], 'RecorderPath': [tango._tango.CmdArgType.DevVarStringArray, "list of directories to search for recorders (path separators can be '\n' or character conventionally used by the OS toseparate search path components, such as ':' for POSIXor ';' for Windows)", []]}

Sardana device properties definition

cmd_list = {'GetMacroCode': [[tango._tango.CmdArgType.DevVarStringArray, '<MacroLib name> [, <Macro name>]'], [tango._tango.CmdArgType.DevVarStringArray, 'result is a sequence of 3 strings:\n<full path and file name>, <code>, <line number>']], 'GetMacroInfo': [[tango._tango.CmdArgType.DevVarStringArray, 'Macro(s) name(s)'], [tango._tango.CmdArgType.DevVarStringArray, 'Macro(s) description(s)']], 'ReloadMacro': [[tango._tango.CmdArgType.DevVarStringArray, 'Macro(s) name(s)'], [tango._tango.CmdArgType.DevVarStringArray, '[OK] if successfull or a traceback if there was a error (one string with complete traceback of each error)']], 'ReloadMacroLib': [[tango._tango.CmdArgType.DevVarStringArray, 'MacroLib(s) name(s)'], [tango._tango.CmdArgType.DevVarStringArray, '[OK] if successfull or a traceback if there was a error (one string with complete traceback of each error)']], 'SetMacroCode': [[tango._tango.CmdArgType.DevVarStringArray, '<MacroLib name>, <code> [, <Auto reload>=True]\n- if macro lib is a simple module name:\n  - if it exists, it is overwritten, otherwise a new python file is created in the directory of the first element in the MacroPath property- if macro lib is the full path name:\n  - if path is not in the MacroPath, an exception is thrown  - if file exists it is overwritten otherwise a new file is created'], [tango._tango.CmdArgType.DevVoid, '']]}

Sardana device command definition

attr_list = {'DoorList': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SPECTRUM, tango._tango.AttrWriteType.READ, 256]], 'Elements': [[tango._tango.CmdArgType.DevEncoded, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ], {'label': 'Elements', 'description': 'the list of all elements (a JSON encoded dict)'}], 'Environment': [[tango._tango.CmdArgType.DevEncoded, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'label': 'Environment', 'description': 'The macro server environment (a JSON encoded dict)'}], 'MacroLibList': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SPECTRUM, tango._tango.AttrWriteType.READ, 1024]], 'MacroList': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SPECTRUM, tango._tango.AttrWriteType.READ, 4096]], 'TypeList': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SPECTRUM, tango._tango.AttrWriteType.READ, 256]]}

Sardana device attribute definition