Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non blocking Python Clients #43

Open
marco-buttu opened this issue Oct 3, 2015 · 10 comments
Open

Non blocking Python Clients #43

marco-buttu opened this issue Oct 3, 2015 · 10 comments
Assignees

Comments

@marco-buttu
Copy link
Contributor

If the manager is offline, then a Python client istantiation is blocking:

>>> from Acspy.Clients.SimpleClient import PySimpleClient
>>> client = PySimpleClient()
Acspy.Util.ACSCorba._Client.__init__ - manager is not available.
      This method will block until manager comes online!

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:

>>> from Acspy.Util.ACSCorba import getManager
>>> if getManager():
...     client = PySimpleClient()

But these instructions are not atomc, so this approach is not reliable. What do you think about having a non blocking PySimpleClient()?

@javarias
Copy link
Collaborator

javarias commented Oct 8, 2015

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?

@tjuerges
Copy link

tjuerges commented Oct 8, 2015

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?

@marco-buttu
Copy link
Contributor Author

@javarias: ok

@javarias
Copy link
Collaborator

@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?

@tjuerges
Copy link

@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.

@tjuerges
Copy link

Good news! Eventually I found the source code.

Argh! Github does not allow me to attach a tarball. Do we have an upload area?

@moraklein
Copy link

@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.

@tjuerges
Copy link

tjuerges commented Nov 6, 2015

@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++.

@tjuerges
Copy link

@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.

@marco-buttu
Copy link
Contributor Author

@tjuerges I did not, it is still pending in my queue. For sure I will put the code here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants