aiidateam / aiida-common-workflows

A repository for the implementation of common workflow interfaces across materials-science codes and plugins
https://aiida-common-workflows.readthedocs.io
MIT License
52 stars 31 forks source link

Return non-zero exit code when `aiida-common-workflows launch` workflow fails #289

Closed chrisjsewell closed 1 year ago

chrisjsewell commented 2 years ago

It would be ideal if the run below, for example, returned a non-zero exit code, so that it would be trivial to implement CI tests. (Obviously, this would only be the case for non-daemon runs)

(aiida) root@instance:/# aiida-common-workflows launch relax nwchem -S Si -X nwchem.main
Running a NwchemCommonRelaxWorkChain...
07/24/2022 07:26:44 PM <43967> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [331|NwchemBaseWorkChain|run_process]: launching NwchemCalculation<332> iteration #1
07/24/2022 07:27:06 PM <43967> aiida.orm.nodes.process.calculation.calcjob.CalcJobNode: [WARNING] output parser returned exit code<312>: The stdout output file was incomplete.
07/24/2022 07:27:06 PM <43967> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [331|NwchemBaseWorkChain|inspect_process]: NwchemCalculation<332> failed and error was not handled, restarting once more
07/24/2022 07:27:06 PM <43967> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [331|NwchemBaseWorkChain|run_process]: launching NwchemCalculation<335> iteration #2
07/24/2022 07:27:26 PM <43967> aiida.orm.nodes.process.calculation.calcjob.CalcJobNode: [WARNING] output parser returned exit code<312>: The stdout output file was incomplete.
07/24/2022 07:27:26 PM <43967> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [331|NwchemBaseWorkChain|inspect_process]: NwchemCalculation<335> failed and error was not handled for the second consecutive time, aborting
07/24/2022 07:27:26 PM <43967> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [331|NwchemBaseWorkChain|on_terminated]: remote folders will not be cleaned
07/24/2022 07:27:26 PM <43967> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [330|NwchemCommonRelaxWorkChain|inspect_workchain]: NwchemBaseWorkChain<331> failed with exit status 402.
NwchemCommonRelaxWorkChain<330> terminated with state: finished [400] `The `NwchemBaseWorkChain` workchain failed with exit status 402.`
NwchemCommonRelaxWorkChain<330> registered no outputs

at the moment I have to do something "hacky" like grep for terminated with state: finished [0]