Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Server green mode #333

Closed
stanislaw55 opened this issue Feb 18, 2020 · 5 comments
Closed

Server green mode #333

stanislaw55 opened this issue Feb 18, 2020 · 5 comments

Comments

@stanislaw55
Copy link

Hi,
According to docs, TANGO server GreenMode is currently in beta version. Is there any plan to provide stable version of TANGO Device Server GreenMode?

@ajoubertza
Copy link
Member

Hi @stanislaw55.
No immediate plans, sorry. Do you know of features that are missing or functionality that is broken (other than #173)? If we did any further work, I propose that the Asyncio mode is prioritised Gevent.

@andygotz
Copy link

Hi @stanislaw55,
the Green mode is used heavily at the ESRF (we have a number of gevent based applications) and is in production. I do not know why the documentation still says it is in beta. The asyncio mode is also used in production by some sites e.g. MAXIV. Maybe @tiagocoutinho and @vxgmichel can say something about what the status of the Green mode is.
Have you noticed something missing?
Who else is using the Green mode?

@vxgmichel
Copy link
Contributor

vxgmichel commented Feb 19, 2020

This addition to the docs was made 3 years ago (ef62a23), it may be time to get rid of it :)

The one point that comes to mind is @tiagocoutinho telling me about race conditions in tango when the monitor lock is disabled. If those haven't been fixed, I guess it would justify calling server green mode "experimental" (the word "beta" doesn't appear in the docs by the way).

Also, I think there are a few mistakes in this page:

[About gevent green mode] Another thing to have in mind is that the Tango monitor lock is present - you can’t have two read operations happening concurrently. Any subsequent ones will always have to wait for the first one to finish.

As far as I remember this is not true. The monitor lock is disabled for both the gevent and the asyncio green mode:

pytango/tango/server.py

Lines 1333 to 1334 in 5865b6f

if green_mode in (GreenMode.Gevent, GreenMode.Asyncio):
util.set_serial_model(SerialModel.NO_SYNC)

This has been the case since 2015: 803b7e9

Another mistake in the docs:

[About the asyncio green mode ]It’s especially useful if you want to perform some long operations and don’t want to prevent clients from accessing other parts of your device (attributes, in particular). This means that in Asyncio green mode there is no monitor lock!

... but then proceeds with an example of a command spawning a background task and returning immediately:

    @command
    async def long_running_command(self):
        loop = asyncio.get_event_loop()
        future = loop.create_task(self.coroutine_target())

Also, hi guys :)

@ajoubertza
Copy link
Member

Hi @vxgmichel :)

Thanks for the details (and the long memory). I've made a draft PR in the meantime. I'd appreciate if you'd have a look to see if I understand you correctly.

The removal of the "experimental" tag is pending @tiagocoutinho's response on the race conditions.

@stanislaw55
Copy link
Author

Hi @ajoubertza,
I had no idea that docs are outdated. It's good to see PR with an update ;)

Hi @andygotz
Great to here that Server GreenMode is used at production at ESRF. That makes me think there was just something broken with my setup. I will investigate further in #173.

When #334 is merged, I think this issue can be closed.

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

No branches or pull requests

4 participants