poolcontrollermanager
¶
This module is part of the Python Pool library. It defines the class which controls finding, loading/unloading of device pool controller plug-ins.
Classes
ControllerManager¶
-
class
ControllerManager
[source]¶ Bases:
taurus.core.util.singleton.Singleton
,taurus.core.util.log.Logger
The singleton class responsible for managing controller plug-ins.
-
DEFAULT_CONTROLLER_DIRECTORIES
= ('poolcontrollers',)¶
-
setControllerPath
(controller_path, reload=True)[source]¶ Registers a new list of controller directories in this manager.
Parameters: controller_path (seq<str>) – a sequence of absolute paths where this manager should look for controllers Warning
as a consequence all the controller modules will be reloaded. This means that if any reference to an old controller object was kept it will refer to an old module (which could possibly generate problems of type class A != class A).
-
getControllerPath
()[source]¶ Returns the current sequence of absolute paths used to look for controllers.
Returns: sequence of absolute paths Return type: seq<str>
-
getOrCreateControllerLib
(lib_name, controller_name=None)[source]¶ Gets the exiting controller lib or creates a new controller lib file. If name is not None, a controller template code for the given controller name is appended to the end of the file.
Parameters: Returns: a sequence with three items: full_filename, code, line number line number is 0 if no controller is created or n representing the first line of code for the given controller name.
Return type: tuple<str, str, int>
-
setControllerLib
(lib_name, code)[source]¶ Creates a new controller library file with the given name and code. The new module is imported and becomes imediately available.
Parameters:
-
createControllerLib
(lib_name, path=None)[source]¶ Creates a new empty controller library (python module)
-
reloadController
(controller_name, path=None)[source]¶ Reloads the module corresponding to the given controller name
Raises: sardana.pool.poolexception.UnknownController
in case the controller is unknown orImportError
if the reload process is not successfullParameters: - controller_name (str) – controller class name
- path (seq<str>) – a list of absolute path to search for libraries [default: None, meaning the current ControllerPath will be used]
-
reloadControllers
(controller_names, path=None)[source]¶ Reloads the modules corresponding to the given controller names
Raises: sardana.pool.poolexception.UnknownController
in case the controller is unknown orImportError
if the reload process is not successfulParameters: - controller_names (seq<str>) – a list of controller class names
- path (seq<str>) – a list of absolute path to search for libraries [default: None, meaning the current ControllerPath will be used]
-
reloadControllerLibs
(module_names, path=None, reload=True)[source]¶ Reloads the given library(=module) names
Raises: sardana.pool.poolexception.UnknownController
in case the controller is unknown orImportError
if the reload process is not successfulParameters: - module_names (seq<str>) – a list of module names
- path (seq<str>) – a list of absolute path to search for libraries [default: None, meaning the current ControllerPath will be used]
-
reloadControllerLib
(module_name, path=None, reload=True)[source]¶ Reloads the given library(=module) names
Raises: sardana.pool.poolexception.UnknownController
in case the controller is unknown orImportError
if the reload process is not successfulParameters: - module_name (str) – controller library name (=python module name)
- path (seq<str>) – a list of absolute path to search for libraries [default: None, meaning the current ControllerPath will be used]
Returns: the ControllerLib object for the reloaded controller lib
Return type:
-