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

BaseRestartWorkChain: do not assume metadata exists in inputs #4210

Merged
merged 1 commit into from
Jul 1, 2020

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Jul 1, 2020

Fixes #4209

The contract of the base restart work chain is that the setup will
define the self.ctx.inputs attribute, however, it is not defined what
its contents should be. The run_process method was unjustly assuming
that the metadata key would be set to a dictionary, which is not
always the case. In this fix, we simply check for its existence and
create the dictionary if it doesn't yet exist.

The contract of the base restart work chain is that the `setup` will
define the `self.ctx.inputs` attribute, however, it is not defined what
its contents should be. The `run_process` method was unjustly assuming
that the `metadata` key would be set to a dictionary, which is not
always the case. In this fix, we simply check for its existence and
create the dictionary if it doesn't yet exist.
@codecov
Copy link

codecov bot commented Jul 1, 2020

Codecov Report

Merging #4210 into develop will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4210      +/-   ##
===========================================
+ Coverage    79.04%   79.11%   +0.07%     
===========================================
  Files          467      467              
  Lines        34492    34492              
===========================================
+ Hits         27260    27284      +24     
+ Misses        7232     7208      -24     
Flag Coverage Δ
#django 71.03% <100.00%> (+0.07%) ⬆️
#sqlalchemy 71.91% <100.00%> (+0.07%) ⬆️
Impacted Files Coverage Δ
aiida/engine/processes/workchains/restart.py 68.25% <100.00%> (+14.19%) ⬆️
aiida/engine/processes/workchains/context.py 75.00% <0.00%> (+25.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d582b0f...c7708e4. Read the comment docs.

@sphuber sphuber merged commit 862fa20 into aiidateam:develop Jul 1, 2020
@sphuber sphuber deleted the fix/4209/base-restart-metadata branch July 1, 2020 11:10
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.

BaseRestartWorkChain assumes metadata is always defined in self.ctx.inputs
2 participants