Gevent Client times out
|
|
---|---|
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:
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:
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 |
|
|
---|---|
|
Hi KGoetz, Where does sleep() method come from? Is it from the time module? Note that you must use gevent.sleep(), not time.sleep(). |
|
|
---|---|
I am no PyTango expert but out of curiosity, I went to PyTango documentation and I saw this on this page (https://pytango.readthedocs.io/en/stable/green_modes/green.html#gevent-mode):The list of methods that have been modified to accept gevent semantics are, on the tango.gevent.DeviceProxy(): I don't see command_inout in this list… So I see at least 3 possibilities:
We should not exclude the last possibility… Hoping this helps, Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new. |
|
|
---|---|
Hi TCoutInho, changing the sleep command to gevent.sleep does not change anything. Afaik it shouldn't even be necessary with gevent. The server works as intended. While the wait command is running other Clients can connect and make calls to commands or attributes. That's all working fine. The problem is, that no matter how I try to define the DeviceProxy, I get this TimeOutError when executing the wait command:
For my use I don't need asynchronous computing on the client side. Additionally when I try to create a normal tango DeviceProxy like this:
I get this error message:
My version of boost is 1.65.1 |
|
|
---|---|
Disclaimer: I am a PyTango newbee… Sorry if I add some confusion to this thread… The doc says the following about the command_inout Timeout parameter: The number of seconds to wait for the result. If None, then there is no limit on the wait time. Ignored when green_mode is Synchronous or wait is False. From what I understood while playing a bit with the code you provided and by reading the documentation, it seems like this timeout parameter given to command_inout method is actually different than the Tango client side timeout (Timeout involved in the CORBA communication) associated with your DeviceProxy. If you execute:
You will see that it is set to 3000 ms, which is the default value, and which corresponds to the value you see in the error message. Moreover, if you execute:
You will not get the same error, at least not immediately. You will first get an error ending with:
Clearly showing that we have distinct timeouts involved here. If you set your DeviceProxy client timeout to something big, you will not get any longer this error.
This client side timeout is different than the one given to DeviceProxy constructor according to https://pytango.readthedocs.io/en/stable/client_api/green.html#tango.gevent.DeviceProxy Hoping this helps a bit…
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new. |
|
|
---|---|
Hi Reynald, thanks. Who thought it could be this easy. I would have never thought that the timeout I set in the constructor would be a different one than the one that I needed. When setting the timeout with
everything works as I want it to. |