Hello,
I have a problem with a device server that I developed in c ++ and is using events.
I am using the push_event () method with a callback activated for each new value of a scalar attribute.
I actually have two problems:
- the callback is unnecessarily activated by an erroneous event.
- the callback is activated with an identical event value
These two problems occures more often than the polling is fast on the subscribed attribute …
To try to understand how events work, I reproduce the same problems with a python client which subscribes an event on the ‘short_scalar’ attribute of tangotest.
The ‘short_scalar’ attribute is configured as follows:
polling: below 50ms
event: absolute and relative 0.1
The client:
import PyTango,time
import sys
import tango
mybool=1
dev='sys/tg_test/1'
dp=PyTango.DeviceProxy(dev)
attrlist=['short_scalar_w','short_scalar']
attr='short_scalar'
class CBTANGOTEST():
def push_event(self,event):
if event.err:
print("error event ",event)
print
return
tce=event.attr_value.value
print ("tangotest event: ",tce)
tcr=dp.read_attributes(attrlist)
print tcr[0].value,tcr[1].value
cb=CBTANGOTEST()
evt=dp.subscribe_event(attr,PyTango.EventType.CHANGE_EVENT,cb)
while mybool==1:
time.sleep(0.1)
The output:
('tangotest event: ', 134)
0 134
('tangotest event: ', 173)
0 173
('tangotest event: ', 89)
0 89
('error event ', EventData(attr_name = 'tango://srv-2.thomx.fr:20000/sys/tg_test/1/short_scalar', attr_value = None, device = TangoTest(sys/tg_test/1), err = True, errors = (DevError(desc = 'The polling thread is late and discard this object polling.\nAdvice: Tune device server polling', origin = 'PollThread::err_out_of_sync', reason = 'API_PollThreadOutOfSync', severity = tango._tango.ErrSeverity.ERR),), event = 'change', reception_date = TimeVal(tv_nsec = 0, tv_sec = 1624538377, tv_usec = 497499)))
('tangotest event: ', 89)
0 89
('error event ', EventData(attr_name = 'tango://srv-2.thomx.fr:20000/sys/tg_test/1/short_scalar', attr_value = None, device = TangoTest(sys/tg_test/1), err = True, errors = (DevError(desc = 'The polling thread is late and discard this object polling.\nAdvice: Tune device server polling', origin = 'PollThread::err_out_of_sync', reason = 'API_PollThreadOutOfSync', severity = tango._tango.ErrSeverity.ERR),), event = 'change', reception_date = TimeVal(tv_nsec = 0, tv_sec = 1624538377, tv_usec = 700628)))
('tangotest event: ', 89)
0 89
('error event ', EventData(attr_name = 'tango://srv-2.thomx.fr:20000/sys/tg_test/1/short_scalar', attr_value = None, device = TangoTest(sys/tg_test/1), err = True, errors = (DevError(desc = 'The polling thread is late and discard this object polling.\nAdvice: Tune device server polling', origin = 'PollThread::err_out_of_sync', reason = 'API_PollThreadOutOfSync', severity = tango._tango.ErrSeverity.ERR),), event = 'change', reception_date = TimeVal(tv_nsec = 0, tv_sec = 1624538377, tv_usec = 898083)))
('tangotest event: ', 89)
0 89
('error event ', EventData(attr_name = 'tango://srv-2.thomx.fr:20000/sys/tg_test/1/short_scalar', attr_value = None, device = TangoTest(sys/tg_test/1), err = True, errors = (DevError(desc = 'The polling thread is late and discard this object polling.\nAdvice: Tune device server polling', origin = 'PollThread::err_out_of_sync', reason = 'API_PollThreadOutOfSync', severity = tango._tango.ErrSeverity.ERR),), event = 'change', reception_date = TimeVal(tv_nsec = 0, tv_sec = 1624538378, tv_usec = 100202)))
('tangotest event: ', 89)
0 89
Can someone tell me if this is normal?
Thanks a lot for your help.