taurus-org / taurus

Moved to https://gitlab.com/taurus-org/taurus
http://taurus-scada.org
43 stars 46 forks source link

TangoAttribute.poll to private API? #1103

Open reszelaz opened 4 years ago

reszelaz commented 4 years ago

This is just to discuss it at some time.. I wonder if TangoAttribute.poll should not be rather a part of the private API. I think that the users normally interact with the TaurusAttribute.enablePolling and TaurusAttribute.disablePolling.

cpascual commented 4 years ago

I am talking from memory, but... I thing that .poll is part of the TaurusAttribute API (not just TangoAttribute). And yes , I think that it makes little sense that it is public. It is there just for historic reasons to maintain compat with taurus 3. So, I agree, but the discussion should take into account all schemes, not just Tango

reszelaz commented 4 years ago

Yes, you are right. It comes from the base class: TaurusAttribute where it raises NotImplementedError. It must be implemented in all schemes so the polling works. It is the TaurusPollingTimer which calls it indirectly (via device). So, it is implemented in: tango, epics, eval, h5file schemes.. I see it as very internal API, it is very complicated to use it, especially in the case of the tango scheme. And I think it may confuse the users, unless we provide a clear guides (first having a use case for that).

What about renaming it to _poll? Alternativally giving a clear warning: "don't use use it unless you know what you do" :)

What about giving it default implementation:

    def poll(self):
        v = self.read(cache=False)
        self.fireEvent(TaurusEventType.Periodic, v)

All schemes but tango implements it this way.