-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: respect nested output namespaces in Process.exposed_outputs
#4863
FIX: respect nested output namespaces in Process.exposed_outputs
#4863
Conversation
I do not think it does, since I think that |
Correct |
8c9a87e
to
6867517
Compare
Codecov Report
@@ Coverage Diff @@
## develop #4863 +/- ##
========================================
Coverage 79.62% 79.62%
========================================
Files 519 519
Lines 37095 37095
========================================
Hits 29532 29532
Misses 7563 7563
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
The `exposed_outputs` method was detecting nested namespaces in the dictionary of outputs of a node by using the namespace separator character of the port namespace class. However, this character, which is the `.`, gets converted to `__` when the link is stored in the database. This transformation is necessary since the `.` is a reserved character to enable attribute based dereferencing, e.g. node.outputs.some_output Since link labels can contain underscores, we use a double underscore which, together with the guarantee that link labels don't have leading or terminating underscores, can uniquely determine the namespaces in any given link label. The solution is to not manually reconstruct the namespaces in the output dictionary but simply use the `get_outgoing().nested()` method which does it for us.
6867517
to
e8b11c9
Compare
@ramirezfranciscof could you review this today. This needs to be released in 1.6.2 a.s.a.p as it is blocking some users. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, LGTM!
BTW: I'm a bit curious about having tests for this in test_process.py
and test_work_chain.py
. It would seem that the main difference is that the first calls the methods directly (tests that the methods work), whereas the second goes through the engine running system (i.e. tests that these methods are actually called during run).
If this is so, perhaps the name / location of the tests is not very indicative of their purpose and it would be good to open an issue to at some point deal with that. Am I missing something else @sphuber ?
Thanks for the quick review @ramirezfranciscof
Well, the |
Mmm ok, I think we are saying a similar thing. Let me reformulate maybe: I agree with the following points...
My point was more questioning if "integration" test should be on Now, I think I still have the question of why don't we test more directly (without going through the engine) the methods of specific subclasses of |
I don't think that there should be a distinction whether integration tests go into |
While trying to add a note on tab-completion for the In [1]: cj_node = load_node(311)
/opt/conda/lib/python3.7/site-packages/aiida/orm/utils/managers.py:98: AiidaDeprecationWarning: dereferencing nodes with links containing double underscores is deprecated, simply replace the double underscores with a single dot instead. For example:
`self.inputs.some__label` can be written as `self.inputs.some.label` instead.
Support for double underscores will be removed in the future.
'Support for double underscores will be removed in the future.', AiidaDeprecationWarning
In [2]: cj_node.outputs. <TAB> The deprecation warning prints when I try to tab-complete the outputs. @ramirezfranciscof guided me to this PR. I didn't look into much detail what is responsible, but if I revert back to |
This is not the corresponding PR, but #4625 is. I am bit surprised that the deprecation warning triggers already at tab completion though. It should only trigger when actually retrieving a node through a label containing double underscores. So I am confused how this is happening. Still, does the tab-completion still work, despite the warning? |
Yes, but it prints every time the tab-completion is attempted. 😅 |
By setting a traceback right before the deprecate waring I got the following information:
I have no idea where this |
The |
Fixes #3533
The
exposed_outputs
method was detecting nested namespaces in thedictionary of outputs of a node by using the namespace separator
character of the port namespace class. However, this character, which is
the
.
, gets converted to__
when the link is stored in the database.This transformation is necessary since the
.
is a reserved characterto enable attribute based dereferencing, e.g.
Since link labels can contain underscores, we use a double underscore
which, together with the guarantee that link labels don't have leading
or terminating underscores, can uniquely determine the namespaces in any
given link label.
The solution is to not manually reconstruct the namespaces in the output
dictionary but simply use the
get_outgoing().nested()
method whichdoes it for us.