Skip to content
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 upload_calculation when running with store_provenance=False #3513

Merged

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Nov 5, 2019

Fixes #3511

When running a CalcJob in dry-run mode, it is often advised to also set
store_provenance=False which means nodes will not be stored, so input
nodes can be unstored. However, in upload_calculation to process the
local_copy_list the load_node function was used to load the
corresponding node, which would fail in this scenario. The only possible
solution is to pass the full mapping of inputs to the function and if
the loading of the node fails, try to fish out the corresponding node
from the mapping. If all fails, we emit a warning and skip the rule.

…alse`

When running a `CalcJob` in dry-run mode, it is often advised to also set
`store_provenance=False` which means nodes will not be stored, so input
nodes can be unstored. However, in `upload_calculation` to process the
`local_copy_list` the `load_node` function was used to load the
corresponding node, which would fail in this scenario. The only possible
solution is to pass the full mapping of inputs to the function and if
the loading of the node fails, try to fish out the corresponding node
from the mapping. If all fails, we emit a warning and skip the rule.
@sphuber sphuber requested a review from ltalirz November 5, 2019 08:10

try:
data_node = load_node(uuid=uuid)
except exceptions.NotExistent:
logger.warning('failed to load Node<{}> specified in the `local_copy_list`'.format(uuid))
data_node = find_data_node(inputs, uuid)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to allow this in general or only when dry_run=True?

Also, maybe good to add a comment line to both 188 and 190

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was wondering about that too, but I just kept the current behavior for now where it just emits a warning log. We might want to change this to actually raise. If the plugin specified that a the contents of a node need to be copied over and it is not there, that should be a problem and most likely the calculation should not work. I am not sure in what use case a mere warning is the desired alternative.

Copy link
Member

@ltalirz ltalirz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @sphuber !
logic of the find_data_node function looks good - just one question regarding its usage

Copy link
Member

@ltalirz ltalirz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, up to you whether to raise there or not - I'd be ok with these changes.

@sphuber sphuber merged commit b93c5e3 into aiidateam:develop Nov 8, 2019
@sphuber sphuber deleted the fix_3511_dry_run_store_provenance_false branch November 8, 2019 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

passing unstored data node surfaces programming error in aiida-core
2 participants