From: cfalcon <cf...@ce...> - 2016-01-14 14:26:33
|
TaurusManager only set the given polling period to the default scheme (by default Tango). Do the indicated TODO in the changeDefaultPollingPeriod method, and set the given value to all schemes. Adapt the evaluationFactory getAttribute method following the Tango implementation to set the PollingPeriod for the evaluationAttributes. --- lib/taurus/core/evaluation/evalfactory.py | 15 +++++++++------ lib/taurus/core/taurusmanager.py | 7 ++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/taurus/core/evaluation/evalfactory.py b/lib/taurus/core/evaluation/evalfactory.py index 6521057..9e4d2dc 100644 --- a/lib/taurus/core/evaluation/evalfactory.py +++ b/lib/taurus/core/evaluation/evalfactory.py @@ -345,12 +345,12 @@ class EvaluationAttribute(TaurusAttribute): pyVar_RegExp = re.compile("[a-zA-Z_][a-zA-Z0-9_]*") #regexp for a variable/method name (symbol) cref_RegExp = re.compile("\{(.+?)\}") #regexp for references to other taurus models within operation model names - def __init__(self, name, parent, storeCallback = None): - self.call__init__(TaurusAttribute, name, parent, storeCallback=storeCallback) - + def __init__(self, name, parent, **kwargs): + self.call__init__(TaurusAttribute, name, parent, **kwargs) + self._value = TaurusAttrValue() self._value.config.writable = False #Evaluation Attributes are always read-only (at least for now) - self._references = [] + self._references = [] self._validator= self.getNameValidator() self._transformation = None # reference to the configuration object @@ -736,7 +736,7 @@ class EvaluationFactory(Singleton, TaurusFactory, Logger): d = DevClass(fullname, parent=db, storeCallback=self._storeDev) #use full name return d - def getAttribute(self, attr_name): + def getAttribute(self, attr_name, **kwargs): """Obtain the object corresponding to the given attribute name. If the corresponding attribute already exists, the existing instance is returned. Otherwise a new instance is stored and returned. The evaluator @@ -759,7 +759,10 @@ class EvaluationFactory(Singleton, TaurusFactory, Logger): a = self.eval_attrs.get(fullname, None) if a is None: #if the full name is not there, create one dev = self.getDevice(validator.getDeviceName(attr_name)) - a = EvaluationAttribute(fullname, parent=dev, storeCallback=self._storeAttr) #use full name + kwargs['storeCallback'] = self._storeAttr + if not kwargs.has_key('pollingPeriod'): + kwargs['pollingPeriod'] = self.getDefaultPollingPeriod() + a = EvaluationAttribute(fullname, parent=dev, **kwargs) #use full name return a def getConfiguration(self, param): diff --git a/lib/taurus/core/taurusmanager.py b/lib/taurus/core/taurusmanager.py index d140b26..de116b8 100644 --- a/lib/taurus/core/taurusmanager.py +++ b/lib/taurus/core/taurusmanager.py @@ -361,9 +361,10 @@ class TaurusManager(Singleton, Logger): o.execute() def changeDefaultPollingPeriod(self, period): - self.getFactory()().changeDefaultPollingPeriod(period) - # todo: go through all known plugin factories and change their polling - # period + plugin_classes = self._get_plugin_classes() + for plugin_class in plugin_classes: + scheme = plugin_class.schemes[0] + self.getFactory(scheme)().changeDefaultPollingPeriod(period) def __str__name__(self, name): return '{0}({1})'.format(self.__class__.__name__, name) -- 2.4.0 |