Skip to content
GitLab
Explore
Sign in
Register
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ResearchAndDevelopment
LINC
Commits
c18f2b75
Commit
c18f2b75
authored
Oct 26, 2021
by
David Rafferty
Committed by
Marcel Loose
Oct 26, 2021
Browse files
Options
Downloads
Patches
Plain Diff
Improve CI checks
Former-commit-id:
f7b25116
parent
6b4ebf8d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test_jobs/check_workflow_results.py
+48
-18
48 additions, 18 deletions
test_jobs/check_workflow_results.py
with
48 additions
and
18 deletions
test_jobs/check_workflow_results.py
+
48
−
18
View file @
c18f2b75
...
...
@@ -9,28 +9,57 @@ import h5py
import
sys
import
numpy
as
np
def
check_all_files_present
(
dcmp
,
leftname
=
'
left
'
,
rightname
=
'
right
'
):
"""
Checks recursively that all files are present in both compared directories
Parameters
----------
dcmp : dircmp object
The result of dircmp(left, right)
leftname : str, optional
Name of the left part of the input dcmp
rightname : str, optional
Name of the right part of the input dcmp
Returns
-------
agree : bool
True if all files are present, False if not
"""
agree
=
True
if
dcmp
.
left_only
or
dcmp
.
right_only
:
if
dcmp
.
left_only
:
print
(
'
ERROR: The following files are present in the {0} but not in the
'
'
{1}: {2}
'
.
format
(
leftname
,
rightname
,
dcmp
.
left_only
))
if
dcmp
.
right_only
:
print
(
'
ERROR: The following files are present in the {0} but not in the
'
'
{1}: {2}
'
.
format
(
rightname
,
leftname
,
dcmp
.
right_only
))
agree
=
False
for
sub_dcmp
in
dcmp
.
subdirs
.
values
():
if
not
check_all_files_present
(
sub_dcmp
,
leftname
=
leftname
,
rightname
=
rightname
):
agree
=
False
return
agree
def
main
(
check
,
control
):
"""
Checks the outputs of an end-to-end workflow job
Parameters
----------
check
_path
: str
check : str
Path to output results directory of job
control
_path
: str
control : str
Path to control results directory
"""
error
=
False
# Check that all expected output files are present
dcmp
=
dircmp
(
check
,
control
)
if
len
(
dcmp
.
left_only
)
>
0
or
len
(
dcmp
.
right_only
)
>
0
:
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
))
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
))
all_present
=
check_all_files_present
(
dcmp
,
leftname
=
'
output
'
,
rightname
=
'
control
'
)
if
not
all_present
:
error
=
True
check_path
=
check
+
'
/cal_values/cal_solutions.h5
'
...
...
@@ -44,13 +73,13 @@ def main(check, control):
if
name
not
in
(
'
source
'
,
'
antenna
'
)]
try
:
control_h5
[
solsetname
]
except
:
except
KeyError
:
print
(
"
Error: solset {} not present in control.
"
.
format
(
solsetname
))
sys
.
exit
(
1
)
for
soltabname
in
soltabnames
:
try
:
control_h5
[
solsetname
][
soltabname
]
except
:
except
KeyError
:
print
(
"
Error: soltab {} not present in control.
"
.
format
(
soltabname
))
sys
.
exit
(
1
)
check_soltabval
=
check_h5
[
solsetname
][
soltabname
][
'
val
'
]
...
...
@@ -69,7 +98,7 @@ def main(check, control):
if
not
np
.
allclose
(
check_soltabval
,
matching_vals
,
rtol
=
1e-03
,
atol
=
1e-03
,
equal_nan
=
True
):
error
=
True
print
(
"
Val array of soltab {} does not match the control
"
.
format
(
soltabname
))
print
(
"
ERROR:
Val array of soltab {} does not match the control
"
.
format
(
soltabname
))
with
open
(
"
check_soltab.{}.val
"
.
format
(
soltabname
),
"
w
"
)
as
f
:
f
.
write
(
str
(
check_soltabval
[:]))
with
open
(
"
control_soltab.{}.val
"
.
format
(
soltabname
),
"
w
"
)
as
f
:
...
...
@@ -80,6 +109,7 @@ def main(check, control):
control_h5
.
close
()
sys
.
exit
(
error
)
if
__name__
==
'
__main__
'
:
descriptiontext
=
"
Checks the output of a workflow run.
\n
"
...
...
This diff is collapsed.
Click to expand it.
David Rafferty
@rafferty
mentioned in commit
4baf7379
·
Dec 1, 2021
mentioned in commit
4baf7379
mentioned in commit 4baf737986d1159938470bd9418cd1307b9898f2
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