Skip to content

Ensure nested calcfunctions work as long store_provenance=False#2464

Merged
sphuber merged 1 commit into
aiidateam:provenance_redesignfrom
sphuber:fix_2444_nested_calcfunctions
Feb 8, 2019
Merged

Ensure nested calcfunctions work as long store_provenance=False#2464
sphuber merged 1 commit into
aiidateam:provenance_redesignfrom
sphuber:fix_2444_nested_calcfunctions

Conversation

@sphuber
Copy link
Copy Markdown
Contributor

@sphuber sphuber commented Feb 8, 2019

Fixes #2444

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.

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.
@sphuber sphuber force-pushed the fix_2444_nested_calcfunctions branch from 3df611b to 82ce56c Compare February 8, 2019 11:48
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-6.1%) to 63.65% when pulling 82ce56c on sphuber:fix_2444_nested_calcfunctions into bdb7983 on aiidateam:provenance_redesign.

@coveralls
Copy link
Copy Markdown

coveralls commented Feb 8, 2019

Coverage Status

Coverage decreased (-0.03%) to 69.742% when pulling 82ce56c on sphuber:fix_2444_nested_calcfunctions into bdb7983 on aiidateam:provenance_redesign.

@sphuber sphuber merged commit c6580e6 into aiidateam:provenance_redesign Feb 8, 2019
@sphuber sphuber deleted the fix_2444_nested_calcfunctions branch February 8, 2019 12:48
ltalirz added a commit to ltalirz/aiida-core that referenced this pull request Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants