-
Notifications
You must be signed in to change notification settings - Fork 52
Problems for axis attributes with same name but different properties #1436
Comments
Hi First, many thanks to @HEnquist for this comprehensive bug report. Indeed it looks like the same thing as #39. As, together with @HEnquist, we have advanced with the investigation using other channels now is the moment to share the results with the rest of the community. As you know, Sardana heavily uses very dynamic attributes. By very I mean that we even allow attributes with the same name with different characteristics (type, format, writable) for different device instances of the same class. Something what seems to be not possible with Tango when you keep these devices in the same device server. When you move them to a separate device server the limitation does not apply. Currently Sardana does a trick and removes the attribute from an internal list of attributes of a Tango device class before adding a conflicting attribute in order to avoid exceptions comming from the Tango library. This trick works quite well, but is not perfect - usually problems appear when changing the writable charactaristic. @HEnquist opened this issue tango-controls/cppTango#814 to ask if Tango would eventually fully accept device level dynamic attributes as it is done for commands. Here I list which features of Sardana rely on this:
With @HEnquist we have not seen an easy solution in Sardana, without redesigning a lot of concepts, in case Tango does not accept this featuer request. Unless you see an obvious workaround let's wait for an official answer from Tango before starting to brainstorm on what we could do. |
Just to keep you all updated, today we had a meeting with the Tango experts and they accepted the idea of dynamic attributes on the device level. Some of the argumentes mentioned were:
The idea is to work on a PR for cppTango and target the 9.4 release (mid 2021). @HEnquist and myself plan to start work on it in the following weeks. If you want to help, just let us know:) Thanks to all! |
@HEnquist, I wonder what should we do with this issue. The limitation is actually in Tango. I don't have in mind any workaround we could do in Sardana. Maybe just raise an early exception on the controller load/initialization time instead of failing when accessing the attribute. What do you think? Many thanks! |
With @cmft we found a related issue when two controller classes define the same attribute but using different letter casing e.g. "FORMULA" and "Formula". Note that both attributes have the same characteristics, both are:
We found this issue between the |
Sorry didn't see this! I also don't think there is any reasonable way to work around this in Sardana. I'm working on the needed changes in Tango but it's difficult to get time for it. Once that is done, then pyTango needs a small update. And finally after than, Sardana needs to add one argument to create the tango attributes as device-level. Since the current workaround of removing and re-adding attributes causes difficult-to-diagnose trouble, it could definitely be a good idea to stop doing it. So then when a new attribute doesn't match the definition already in the class, just don't add the attribute, and give a clear warning. This would be easy to implement, but could cause trouble in cases where the current approach happens to work. I can make a quick MR for that, could make it easier to discuss pros and cons. |
If I remember correctly, there are at least two cases when it does not work:
Maybe we could start with raising an exception for these two cases? |
That seems like a good idea. I'm thinking if perhaps we should remove |
This problem does not happen on old system (sardana 2.8 and Tango8). |
This might be the same as reported here: #39
The problem arises when for example two Motor controllers define an axis attribute with the same name, but with different properties. When the second controller is set up during Pool start, this somehow messes up the first one.
These two PseudoMotor controllers can be used to reproduce the problem:
Start with an empty Pool, with just a dummy motor or two. Then add a BuggyA:
And a BuggyB:
Restart the Pool (not sure if this is really required)
Then write to BestValueA:
Not that it is looking for the wrong write method (write_WorstValue).
I believe something bad happens when the second BuggyB controller calls
remove_unwanted_dynamic_attributes
sardana/src/sardana/tango/pool/PoolDevice.py
Line 216 in 76a8cf3
This seems to somehow affect the previously created BuggyA controller.
This is causing quite serious issues for us when there are several types of Motor controllers at a beamline.
The text was updated successfully, but these errors were encountered: