tango-controls/pytango

Server green mode

Closed this issue · 5 comments

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?

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.

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?

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 :)

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.

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.