Open marco-buttu opened 9 years ago
The idea of having non-blocking python client has been discussed in ALMA for a couple of years. However, it never was implemented, I do not know the reasons. Nonetheless, this would be a very nice thing to have in ACS.
If no one is opposed, then this ticket should be implemented. Let's wait a little bit for comments.
@marco-buttu would you volunteer to implement this?
If I remember correctly I have implemented a non-blocking client in C++ a long time ago (>10 years?). Perhaps this could serve as a blue print?
@javarias: ok
@tjuerges I think it is a good idea to have your implementation of a non-blocking client as a blue-print. Could you release the client code under a free software license and attach the source code file to this ticket?
@javarias OK. I scavenged my own Subversion repos and did the same to all the source codes on my several computers. Unfortunately I cannot find the example code and it seems that I do not have a copy any more. But I am quite certain that I have sent example code to either the (very) old mailing list or to Gianluca or submitted it to the old examples repo at ESO.
Anyway, the recipe is quite simple: instanciate a simple client and call the run method in a new thread with a timeout of let's say 5s in a loop (in that thread). That loop then checks during every iteration if a stop flag was set by some external entity and leaves the endless cycle if that flag got set.
Good news! Eventually I found the source code.
Argh! Github does not allow me to attach a tarball. Do we have an upload area?
@tjuerges : There is a pending task of creating a contributions area and merge all the contrib code that is out there (#20). Ideally your code should go there. In the meantime I think it might be quicker if you send the tarball directly to Marco and Jorge.
@moraklein OK, I'll do that.
Edit: I have just sent an email to @javarias and @marco-buttu with the non-blocking client code example in C++.
@marco-buttu Did you get a chance to translate the code to Python? If so, it would be very useful to have the source code here in the repo.
@tjuerges I did not, it is still pending in my queue. For sure I will put the code here
If the manager is offline, then a Python client istantiation is blocking:
But I would like to do something in this case (for instance, I would like the user to be aware of this), so currently, before to get the client, I am verifying the manager is online . Something like this:
But these instructions are not atomc, so this approach is not reliable. What do you think about having a non blocking
PySimpleClient()
?