Skip to content

Commit

Permalink
Automatically set CalcInfo.uuid in CalcJob.run (aiidateam#2874)
Browse files Browse the repository at this point in the history
The `uuid` field in the `CalcInfo` data structure which is built and
returned by the `CalcJob.prepare_for_submission` implementation, is used
subsequently by the engine to create the remote working directory.
Previously, the implementer of `prepare_for_submission` was required to
set it, but this always boiled down to setting it to the UUID of the
process node. Since this is the only behavior that should happen anyway,
we might as well have the engine take care of this, making the
implementation of the `prepare_for_submission` for plugins simpler.
  • Loading branch information
sphuber authored and unkcpz committed May 20, 2019
1 parent 0da3c44 commit 0fda503
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion aiida/calculations/plugins/arithmetic/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def prepare_for_submission(self, folder):
codeinfo.code_uuid = input_code.uuid

calcinfo = CalcInfo()
calcinfo.uuid = str(self.node.uuid)
calcinfo.codes_info = [codeinfo]
calcinfo.retrieve_list = retrieve_list
calcinfo.local_copy_list = local_copy_list
Expand Down
1 change: 0 additions & 1 deletion aiida/calculations/plugins/templatereplacer.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ def prepare_for_submission(self, folder):
calcinfo.retrieve_list = []
calcinfo.retrieve_temporary_list = []

calcinfo.uuid = self.node.uuid
calcinfo.local_copy_list = local_copy_list
calcinfo.remote_copy_list = remote_copy_list

Expand Down
1 change: 1 addition & 0 deletions aiida/engine/processes/calcjobs/calcjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def run(self):
raise exceptions.InvalidOperation('calculation node has unstored links in cache')

calc_info, script_filename = self.presubmit(folder)
calc_info.uuid = str(self.uuid)
input_codes = [load_node(_.code_uuid, sub_classes=(Code,)) for _ in calc_info.codes_info]

for code in input_codes:
Expand Down

0 comments on commit 0fda503

Please sign in to comment.