Skip to content

Commit

Permalink
Use ProcessBuilder._merge instead of ProcessBuilder._update (#335)
Browse files Browse the repository at this point in the history
The `ProcessBuilder._update` method does not properly recurse into
nested mapping like `ProcessBuilder._merge` does. Note that the
recursiveness just considers normal Python mappings and will not
recurse inside node instances that may behave like mappings, such as
`Dict` nodes.
  • Loading branch information
sphuber authored Mar 4, 2024
1 parent b738fd4 commit 24a1819
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/aiida_common_workflows/workflows/dissociation.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def get_sub_workchain_builder(self, distance, reference_workchain=None):
builder = process_class.get_input_generator().get_builder(
structure=molecule, reference_workchain=reference_workchain, **self.inputs.generator_inputs
)
builder._update(**self.inputs.get('sub_process', {}))
builder._merge(**self.inputs.get('sub_process', {}))

distance_node = molecule.creator.inputs.distance

Expand Down
2 changes: 1 addition & 1 deletion src/aiida_common_workflows/workflows/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def get_sub_workchain_builder(self, scale_factor, reference_workchain=None):
base_inputs['reference_workchain'] = reference_workchain

builder = process_class.get_input_generator().get_builder(**base_inputs, **self.inputs.generator_inputs)
builder._update(**self.inputs.get('sub_process', {}))
builder._merge(**self.inputs.get('sub_process', {}))

return builder, structure

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
else:
inputs = generate_inputs(self.process_class._process_class, protocol, code, structure, override)

builder._update(inputs)
builder._merge(inputs)

# RelaxType
if relax_type == RelaxType.NONE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
inputs['calc']['kpoints'] = previous_kpoints
inputs['base'].pop('kpoints_spacing', None)

builder._update(inputs)
builder._merge(inputs)

return builder

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
'wf_parameters': wf_para,
}

builder._update(inputs)
builder._merge(inputs)

return builder

Expand Down

0 comments on commit 24a1819

Please sign in to comment.