From e0e7f2a96af590900d6ced5060456ec9503484f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20R=C3=BC=C3=9Fmann?=
Date: Wed, 2 Oct 2024 13:04:35 +0000
Subject: [PATCH] Small improvement for exit code handling in gf_writeout
workflow
---
aiida_kkr/workflows/gf_writeout.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/aiida_kkr/workflows/gf_writeout.py b/aiida_kkr/workflows/gf_writeout.py
index 1594713b..a780acfb 100644
--- a/aiida_kkr/workflows/gf_writeout.py
+++ b/aiida_kkr/workflows/gf_writeout.py
@@ -153,6 +153,7 @@ def start(self):
####### init #######
# internal para / control para
self.ctx.abort = False
+ self.ctx.exit_code = None
# input both wf and options parameters
options_dict = self.inputs.options.get_dict()
@@ -224,13 +225,13 @@ def validate_input(self):
if not 'impurity_info' in inputs:
input_ok = False
- return self.exit_codes.ERROR_INVALID_INPUT_IMP_INFO # pylint: disable=no-member
+ self.ctx.exit_code = self.exit_codes.ERROR_INVALID_INPUT_IMP_INFO # pylint: disable=no-member
if 'remote_data' in inputs:
input_ok = True
else:
input_ok = False
- return self.exit_codes.ERROR_INVALID_REMOTE_DATA # pylint: disable=no-member
+ self.ctx.exit_code = self.exit_codes.ERROR_INVALID_REMOTE_DATA # pylint: disable=no-member
# extract correct remote folder of last calculation if input remote_folder node
# is not from KKRCalculation but kkr_scf_wc workflow
@@ -264,7 +265,7 @@ def validate_input(self):
'use the plugin kkr.kkr')
self.ctx.errors.append(error)
input_ok = False
- return self.exit_codes.ERROR_INVALID_INPUT_KKR # pylint: disable=no-member
+ self.ctx.exit_code = self.exit_codes.ERROR_INVALID_INPUT_KKR # pylint: disable=no-member
# set self.ctx.input_params_KKR
self.ctx.input_params_KKR = get_parent_paranode(self.inputs.remote_data)
@@ -484,6 +485,9 @@ def return_results(self):
therefore it only uses results from context.
"""
+ if self.ctx.exit_code is not None:
+ return self.ctx.exit_code
+
# capture error of unsuccessful flexrun
if not self.ctx.flexrun.is_finished_ok:
self.ctx.successful = False