Skip to content

Commit

Permalink
Small improvement for exit code handling in gf_writeout workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippRue committed Oct 2, 2024
1 parent eae066c commit e0e7f2a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions aiida_kkr/workflows/gf_writeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e0e7f2a

Please sign in to comment.