I’m writing an instrument server for a detector. For this I want the server to use gevent for asynchronous operation. A minimal model for my server looks like this:
import tango
from tango import AttrQuality, AttrWriteType, DispLevel, DevState, DebugIt, DevULong, GreenMode
from tango.server import Device, DeviceMeta, attribute, command, pipe, device_property
class EigerDectris(Device):
'''Eiger Detektor Server.'''
#Defining the basic device properties for connecting to the server API
api_version = device_property(dtype=str, default_value= '1.6.0')
ip_address = device_property(dtype=str, default_value= '10.42.41.10')
__metaclass__ = DeviceMeta
green_mode = GreenMode.Gevent
@command
def wait(self):
i = 0
while(i < 60):
print(i)
sleep(1)
i += 1
def init_device(self):
self._cache_values = {}
super(EigerDectris, self).init_device()
if __name__ == '__main__':
EigerDectris.run_server()
Some requests to the detector take a long tame (several seconds) to simulate this i use the “wait” command. The Client I wrote to test this looks like this:
from tango.gevent import DeviceProxy
if __name__ == '__main__':
dev = DeviceProxy('tango://saxssans:10000/saxssans/detector/eiger',wait = False)
d = dev.get()
wait = d.command_inout('wait', timeout = None)
When doing this i get TimeOutErrors. What am I doing wrong here?
Im using Ubuntu 18.04 with the following packages:
Python 2.7.15
tango 9.2.2
gevent 1.0