-
Notifications
You must be signed in to change notification settings - Fork 191
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 bug in verdi process show
where not all called processes are shown
#2962
Fix bug in verdi process show
where not all called processes are shown
#2962
Conversation
If link names are not unique, would this not rather indicate that a list should be returned instead of a dictionary? What if someone calls a link Of course, this depends a bit where this is intended to be used. Concerning the method 1-line description:
This is assuming a lot of knowledge about the context (original form, collapsed link labels, ...). Could this be rewritten in a more intuitive form (perhaps with an additional sentence in the description?) |
This would be fine, even if there is another link with Here we have a similar situation. The
Note that the pseudos are nested, because it is a namespace.
Yes, but I don't think I can explain the data structure and design of AiiDA in every docstring. |
And here a suggestion for the docstring:
|
The utility `get_node_info` was called by `verdi process show` to format a multiline string of the given process node, including all the inputs and called processes. The function used the `LinkManager.nested` to reconstruct a nested representation of the relevant set of neighboring nodes. This is useful for the inputs and outputs that can in fact be nested and have unique labels, however, for called links, the link labels are not necessarily unique and so the dictionary returned by the nested method could only represent a single called process with the same link label. To fix this we use a different formatter that simply takes the list of neighboring nodes, which then does not care about label uniqueness. Since the `nested` method was silently overwriting duplicate keys, which caused this bug, its behavior is adapted to raise a `KeyError` in this situation.
b156501
to
5ba688a
Compare
LinkManager.nested
verdi process show
where not all called processes are shown
@ltalirz OK I have updated the solution as discussed. Instead of adapting |
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.
thanks @sphuber
looks good!
Thanks @ltalirz for the useful discussion, the eventual solution is far better than the original one |
Fixes #2868
The utility
get_node_info
was called byverdi process show
to formata multiline string of the given process node, including all the inputs
and called processes. The function used the
LinkManager.nested
toreconstruct a nested representation of the relevant set of neighboring
nodes. This is useful for the inputs and outputs that can in fact be
nested and have unique labels, however, for called links, the link
labels are not necessarily unique and so the dictionary returned by the
nested method could only represent a single called process with the same
link label. To fix this we use a different formatter that simply takes
the list of neighboring nodes, which then does not care about label
uniqueness.
Since the
nested
method was silently overwriting duplicate keys, whichcaused this bug, its behavior is adapted to raise a
KeyError
in thissituation.