Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LINC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ResearchAndDevelopment
LINC
Commits
9b7f9cd4
Commit
9b7f9cd4
authored
3 years ago
by
David Rafferty
Browse files
Options
Downloads
Patches
Plain Diff
Add script to check results
Former-commit-id:
ada40b2d
parent
0a8b4658
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test_jobs/check_workflow_results.py
+58
-0
58 additions, 0 deletions
test_jobs/check_workflow_results.py
with
58 additions
and
0 deletions
test_jobs/check_workflow_results.py
0 → 100755
+
58
−
0
View file @
9b7f9cd4
#! /usr/bin/env python3
"""
Checks the outputs of a workflow run
"""
import
argparse
from
argparse
import
RawTextHelpFormatter
from
losoto.h5parm
import
h5parm
import
os
import
sys
from
filecmp
import
dircmp
import
numpy
as
np
def
main
(
results_path
,
control_path
):
"""
Checks the outputs of an end-to-end workflow job
Parameters
----------
results_path : str
Path to output results directory of job
control_path : str
Path to control results directory
"""
# Check that all expected output files are present
dcmp
=
dircmp
(
results_path
,
control_path
)
if
len
(
dcmp
.
left_only
)
>
0
:
print
(
'
ERROR: The following files are present in the output but not in the control: {}
'
.
format
(
dcmp
.
left_only
))
sys
.
exit
(
1
)
if
len
(
dcmp
.
right_only
)
>
0
:
print
(
'
ERROR: The following files are present in the control but not in the output: {}
'
.
format
(
dcmp
.
right_only
))
sys
.
exit
(
1
)
# Check that the calibration solutions match the control ones
check_h5parm
=
os
.
path
.
join
(
results_path
,
'
cal_values
'
,
'
cal_solutions.h5
'
)
control_h5parm
=
os
.
path
.
join
(
control_path
,
'
cal_values
'
,
'
cal_solutions.h5
'
)
check_h5
=
h5parm
(
check_h5parm
,
readonly
=
True
)
control_h5
=
h5parm
(
control_h5parm
,
readonly
=
True
)
for
check_solset
in
check_h5
.
getSolsets
():
control_solset
=
control_h5
.
getSolset
(
check_solset
.
name
)
for
check_soltab
in
check_solset
.
getSoltabs
():
control_soltab
=
control_solset
.
getSoltab
(
check_soltab
.
name
)
if
not
np
.
allclose
(
check_soltab
.
val
,
control_soltab
.
val
,
rtol
=
1e-03
,
atol
=
1e-03
,
equal_nan
=
True
):
print
(
'
ERROR: Val array of soltab {} of solset {} does not match
'
'
the control
'
.
format
(
check_soltab
.
anme
,
check_solset
.
name
))
sys
.
exit
(
1
)
if
__name__
==
'
__main__
'
:
descriptiontext
=
"
Checks the ouput of a workflow run.
\n
"
parser
=
argparse
.
ArgumentParser
(
description
=
descriptiontext
,
formatter_class
=
RawTextHelpFormatter
)
parser
.
add_argument
(
'
results_path
'
,
help
=
'
Path to output results
'
)
parser
.
add_argument
(
'
control_path
'
,
help
=
'
Path to control results
'
)
args
=
parser
.
parse_args
()
main
(
args
.
results_path
,
args
.
control_path
)
This diff is collapsed.
Click to expand it.
Andre Offringa
@offringa
mentioned in commit
bd184c29
·
3 years ago
mentioned in commit
bd184c29
mentioned in commit bd184c296a246c2421f378b288d0bb1a770ea5a0
Toggle commit list
Andre Offringa
@offringa
mentioned in commit
fd755f83
·
3 years ago
mentioned in commit
fd755f83
mentioned in commit fd755f832d4ad01ee347657d5e8e9fee121064b9
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment