Skip to content
Snippets Groups Projects
Commit ba61dd71 authored by Marcel Loose's avatar Marcel Loose :sunglasses:
Browse files

Merge branch 'improve_check_workflow_script' into 'master'

Improve script that checks workflow results

See merge request eosc/prefactor3-cwl!40

Former-commit-id: a3a73190 [formerly 922a512b]
Former-commit-id: 93c7c8fd
Former-commit-id: 77087df3
parents 398de4bf 38a20af7
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ def main(results_path, control_path): ...@@ -22,6 +22,7 @@ def main(results_path, control_path):
control_path : str control_path : str
Path to control results directory Path to control results directory
""" """
error = False
# Check that all expected output files are present # Check that all expected output files are present
dcmp = dircmp(results_path, control_path) dcmp = dircmp(results_path, control_path)
if len(dcmp.left_only) > 0 or len(dcmp.right_only) > 0: if len(dcmp.left_only) > 0 or len(dcmp.right_only) > 0:
...@@ -31,7 +32,7 @@ def main(results_path, control_path): ...@@ -31,7 +32,7 @@ def main(results_path, control_path):
if len(dcmp.right_only) > 0: if len(dcmp.right_only) > 0:
print('ERROR: The following files are present in the control but not in the ' print('ERROR: The following files are present in the control but not in the '
'output: {}'.format(dcmp.right_only)) 'output: {}'.format(dcmp.right_only))
sys.exit(1) error = True
# Check that the calibration solutions match the control ones # Check that the calibration solutions match the control ones
check_h5parm = os.path.join(results_path, 'cal_values', 'cal_solutions.h5') check_h5parm = os.path.join(results_path, 'cal_values', 'cal_solutions.h5')
...@@ -44,10 +45,19 @@ def main(results_path, control_path): ...@@ -44,10 +45,19 @@ def main(results_path, control_path):
control_soltab = control_solset.getSoltab(check_soltab.name) control_soltab = control_solset.getSoltab(check_soltab.name)
if not np.allclose(check_soltab.val, control_soltab.val, rtol=1e-03, if not np.allclose(check_soltab.val, control_soltab.val, rtol=1e-03,
atol=1e-03, equal_nan=True): atol=1e-03, equal_nan=True):
error = True
print('ERROR: Val array of soltab {} of solset {} does not match ' print('ERROR: Val array of soltab {} of solset {} does not match '
'the control'.format(check_soltab.name, check_solset.name)) 'the control'.format(check_soltab.name, check_solset.name))
sys.exit(1) with open("check_soltab.{}.val".format(check_soltab.name), "w") as f:
f.write(str(check_soltab.val))
with open("control_soltab.{}.val".format(control_soltab.name), "w") as f:
f.write(str(control_soltab.val))
else:
print('INFO: Val array of soltab {} of solset {} matches '
'the control'.format(check_soltab.name, check_solset.name))
control_h5.close()
check_h5.close()
sys.exit(error)
if __name__ == '__main__': if __name__ == '__main__':
descriptiontext = "Checks the ouput of a workflow run.\n" descriptiontext = "Checks the ouput of a workflow run.\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment