macroserver
Functions
Classes
MacroServer
- class MacroServer(full_name, name=None, macro_path=None, environment_db=None, recorder_path=None)[source]
Bases:
MSContainer
,MSObject
,SardanaElementManager
,SardanaIDManager
- logReportKlass
alias of
NonOverlappingTimedRotatingFileHandler
- set_environment_db(environment_db)[source]
Sets the environment database.
- Parameters:
env_db – environment database name
- Return type:
- report(msg, *args, **kwargs)[source]
Record a log message in the sardana report (if enabled) with default level INFO. The msg is the message format string, and the args are the arguments which are merged into msg using the string formatting operator. (Note that this means that you can use keywords in the format string, together with a single dictionary argument.)
kwargs are the same as
logging.Logger.debug()
plus an optional level kwargs which has default value INFOExample:
self.report("this is an official report!")
- get_pool(pool_name)[source]
Returns the device pool object corresponding to the given device name or None if no match is found.
- property max_parallel_macros
maximum number of macros which can execute at the same time
- reload_macro_lib(lib_name)[source]
Reloads the given library(=module) names.
- Raises:
LibraryError in case the reload process is not successful
- Parameters:
module_name – macro library name (=python module name)
path – a list of absolute path to search for libraries [default: None, means the current MacroPath will be used]
- Returns:
the MacroLibrary object for the reloaded macro library
- get_macros(filter=None)[source]
Returns a
dict
containing information about macros.- Parameters:
filter – a regular expression for macro names [default: None, meaning all macros]
- Returns:
a
dict
containing information about macros
- get_macro_classes()[source]
Returns a
dict
containing information about macro classes.- Parameters:
filter – a regular expression for macro names [default: None, meaning all macros]
- Returns:
a
dict
containing information about macro classes
- get_macro_functions()[source]
Returns a
dict
containing information about macro functions.- Parameters:
filter – a regular expression for macro names [default: None, meaning all macros]
- Returns:
a
dict
containing information about macro functions
- get_or_create_macro_lib(lib_name, macro_name=None)[source]
Gets the exiting macro lib or creates a new macro lib file. If name is not None, a macro template code for the given macro name is appended to the end of the file.
- Parameters:
- Return type:
- Returns:
a sequence with three items: full_filename, code, line number is 0 if no macro is created or n representing the first line of code for the given macro name.
- get_env(key=None, door_name=None, macro_name=None)[source]
Gets the environment matching the given parameters:
door_name and macro_name define the context where to look for the environment. If both are None, the global environment is used. If door name is None but macro name not, the given macro environment is used and so on…
If key is None it returns the complete environment, otherwise key must be a string containing the environment variable name.
- Parameters:
key (
Optional
[str
]) – environment variable name [default: None, meaning all environment]door_name (
Optional
[str
]) – local context for a given door [default: None, meaning no door context is used]macro_name (
Optional
[str
]) – local context for a given macro [default: None, meaning no macro context is used]
- Return type:
- Returns:
a
dict
containing the environment- Raises:
UnknownEnv
- set_env(key, value)[source]
Sets the environment key to the new value and stores it persistently.
- Parameters:
key – the key for the environment
value – the value for the environment
- Returns:
a tuple with the key and value objects stored