Ensure nested calcfunctions work as long store_provenance=False#2464
Merged
sphuber merged 1 commit intoFeb 8, 2019
Merged
Conversation
giovannipizzi
approved these changes
Feb 8, 2019
In principle `calcfunctions` are not allowed to call other `calcfunctions` because a calculation is not allowed to call other calculations. However, `calcfunctions` can be called as normal functions by setting the metadata variable `store_provenance` to `False`. Therefore, as long as `store_provenance` is turned off for nested functions, a `calcfunction` is allowed to call other `calcfunctions`. To make this work, the `Process._setup_db_record` method had to be adapted to only add a call link to the parent process, if and only if `store_provenance` for the child node is enabled. Otherwise, the link validation would fail since a `CALL` link outgoing of a `CalculationNode` is forbidden.
3df611b to
82ce56c
Compare
ltalirz
added a commit
to ltalirz/aiida-core
that referenced
this pull request
Feb 11, 2019
sphuber
pushed a commit
that referenced
this pull request
Feb 11, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2444
In principle
calcfunctionsare not allowed to call othercalcfunctionsbecause a calculation is not allowed to call other calculations.
However,
calcfunctionscan be called as normal functions by settingthe metadata variable
store_provenancetoFalse. Therefore, as longas
store_provenanceis turned off for nested functions, acalcfunctionis allowed to call othercalcfunctions.To make this work, the
Process._setup_db_recordmethod had to beadapted to only add a call link to the parent process, if and only if
store_provenancefor the child node is enabled. Otherwise, the linkvalidation would fail since a
CALLlink outgoing of aCalculationNodeis forbidden.