fix missing update after error on parameter
the main error was a suppressed update when the value does not change, but the readerror gets None this error was the reason for strange behaviour in frappy.proxy while finding the cause, other improvements were done: - nodeStateChange: add 'activating' to the possible online states - improve status handling in proxy Change-Id: I2a1873065ab051bdba2200f50e6ad09ae55e168e Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/33901 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
@@ -370,9 +370,10 @@ class SecopClient(ProxyClient):
|
|||||||
# pylint: disable=unsubscriptable-object
|
# pylint: disable=unsubscriptable-object
|
||||||
self._init_descriptive_data(self.request(DESCRIPTIONREQUEST)[2])
|
self._init_descriptive_data(self.request(DESCRIPTIONREQUEST)[2])
|
||||||
self.nodename = self.properties.get('equipment_id', self.uri)
|
self.nodename = self.properties.get('equipment_id', self.uri)
|
||||||
self._set_state(True, 'connected')
|
|
||||||
if self.activate:
|
if self.activate:
|
||||||
|
self._set_state(True, 'activating')
|
||||||
self.request(ENABLEEVENTSREQUEST)
|
self.request(ENABLEEVENTSREQUEST)
|
||||||
|
self._set_state(True, 'connected')
|
||||||
break
|
break
|
||||||
except Exception:
|
except Exception:
|
||||||
# print(formatExtendedTraceback())
|
# print(formatExtendedTraceback())
|
||||||
|
|||||||
@@ -524,7 +524,7 @@ class Module(HasAccessibles):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
err = e
|
err = e
|
||||||
else:
|
else:
|
||||||
changed = pobj.value != value
|
changed = pobj.value != value or pobj.readerror
|
||||||
# store the value even in case of error
|
# store the value even in case of error
|
||||||
pobj.value = value
|
pobj.value = value
|
||||||
if err:
|
if err:
|
||||||
|
|||||||
@@ -30,11 +30,15 @@ from frappy.properties import Property
|
|||||||
from frappy.io import HasIO
|
from frappy.io import HasIO
|
||||||
|
|
||||||
|
|
||||||
|
DISCONNECTED = Readable.Status.ERROR, 'disconnected'
|
||||||
|
|
||||||
|
|
||||||
class ProxyModule(HasIO, Module):
|
class ProxyModule(HasIO, Module):
|
||||||
module = Property('remote module name', datatype=StringType(), default='')
|
module = Property('remote module name', datatype=StringType(), default='')
|
||||||
status = Parameter('connection status', Readable.status.datatype) # add status even when not a Readable
|
status = Parameter('connection status', Readable.status.datatype) # add status even when not a Readable
|
||||||
|
|
||||||
_consistency_check_done = False
|
_consistency_check_done = False
|
||||||
|
_connection_status = None # status when not connected
|
||||||
_secnode = None
|
_secnode = None
|
||||||
enablePoll = False
|
enablePoll = False
|
||||||
|
|
||||||
@@ -45,6 +49,8 @@ class ProxyModule(HasIO, Module):
|
|||||||
def updateEvent(self, module, parameter, value, timestamp, readerror):
|
def updateEvent(self, module, parameter, value, timestamp, readerror):
|
||||||
if parameter not in self.parameters:
|
if parameter not in self.parameters:
|
||||||
return # ignore unknown parameters
|
return # ignore unknown parameters
|
||||||
|
if parameter == 'status' and not readerror:
|
||||||
|
self._connection_status = None
|
||||||
# should be done here: deal with clock differences
|
# should be done here: deal with clock differences
|
||||||
self.announceUpdate(parameter, value, readerror, timestamp)
|
self.announceUpdate(parameter, value, readerror, timestamp)
|
||||||
|
|
||||||
@@ -108,19 +114,18 @@ class ProxyModule(HasIO, Module):
|
|||||||
# for now, the error message must be enough
|
# for now, the error message must be enough
|
||||||
|
|
||||||
def nodeStateChange(self, online, state):
|
def nodeStateChange(self, online, state):
|
||||||
disconnected = Readable.Status.ERROR, 'disconnected'
|
|
||||||
if online:
|
if online:
|
||||||
if not self._consistency_check_done:
|
if not self._consistency_check_done:
|
||||||
self._check_descriptive_data()
|
self._check_descriptive_data()
|
||||||
self._consistency_check_done = True
|
self._consistency_check_done = True
|
||||||
if self.status == disconnected:
|
if self._connection_status:
|
||||||
self.status = Readable.Status.IDLE, 'connected'
|
self.status = Readable.Status.IDLE, state
|
||||||
else:
|
else:
|
||||||
readerror = CommunicationFailedError('disconnected')
|
readerror = CommunicationFailedError('disconnected')
|
||||||
if self.status != disconnected:
|
if self.status != disconnected:
|
||||||
for pname in set(self.parameters) - set(('module', 'status')):
|
for pname in set(self.parameters) - set(('module', 'status')):
|
||||||
self.announceUpdate(pname, None, readerror)
|
self.announceUpdate(pname, None, readerror)
|
||||||
self.status = disconnected
|
self.status = self._connection_status = DISCONNECTED
|
||||||
|
|
||||||
def checkProperties(self):
|
def checkProperties(self):
|
||||||
pass # skip
|
pass # skip
|
||||||
|
|||||||
Reference in New Issue
Block a user