You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where some_namespace is an AttributeFrozenDict no error is given. It makes development a bit cumbersome on the plugin side. Maybe we can eject an error when this happens instead of not setting it and continuing?
The text was updated successfully, but these errors were encountered:
espenfl
changed the title
Silient fail when trying to overwrite AttributeFrozenDict entry
Silent fail when trying to overwrite AttributeFrozenDict entry
Nov 15, 2019
This is happening within the define of a Process class? That is to say, the code snippet you wrote, is what you are typing in the define classmethod? Or somewhere else?
This class comes from plumpy. I guess you are describing the following behavior:
In [1]: fromplumpy.utilsimportAttributesFrozendictIn [2]: d=AttributesFrozendict({'a': 1})
In [3]: d.a=5In [4]: dOut[4]: <AttributesFrozendict {'a': 1}>
This can indeed be a pitfall. The trouble is, once you call d.a, that returns the value of the key a in dictionary d, which is an integer. You then just assign 5 to it. This is the same as:
a=5
At that point the AttributesFrozenDict is no longer part of the process. It has no knowledge of the assignment, so it can also not raise. I don't see how we would solve this. We would have to override the __getattr__ of AttributesFrozenDict to always wrap the return variable in some custom class that would somehow raise when something is assigned to it. What method would be called in this case even? Anyway, I will transfer this to plumpy as really that is where the class comes from, but I don't have a solution.
Upon modifying input namespaces, e.g.
Where
some_namespace
is anAttributeFrozenDict
no error is given. It makes development a bit cumbersome on the plugin side. Maybe we can eject an error when this happens instead of not setting it and continuing?The text was updated successfully, but these errors were encountered: