aiidateam / aiida-workgraph

Efficiently design and manage flexible workflows with AiiDA, featuring an interactive GUI, checkpoints, provenance tracking, and remote execution capabilities.
https://aiida-workgraph.readthedocs.io/en/latest/
MIT License
10 stars 5 forks source link

Avoid passing `None` to arguments of `prepare_shell_job_inputs` #351

Closed GeigerJ2 closed 1 week ago

GeigerJ2 commented 1 week ago

Originally noted in #348, and fixes #348.

The reason for the bug was that in this line: https://github.com/aiidateam/aiida-workgraph/blob/8f6260b44595f79471f6ea70e8efe0f0e158cdab/aiida_workgraph/engine/utils.py#L139 iteration was done over all input arguments of the prepare_shell_job_inputs function, using None as the default for the ones that weren't contained in the inputs dictionary passed to the prepare_for_shell_task function of WorkGraph. This would lead to None values being passed explicitly to the arguments of prepare_shell_job_inputs, in particular resolve_command, effectively overriding its default True value.

Inside aiida-shell the check for the absolute path of the executable inside the prepare_code function (see here) would thus be skipped, and the WorkGraph would just fail silently at a later stage. With this PR, only the input arguments that are also contained in the inputs of the prepare_for_shell_task are being explicitly passed, while the rest is left unset.