Skip to content

Commit

Permalink
Merge pull request #2991 from CliMA/ck/regression_test_robustness
Browse files Browse the repository at this point in the history
Print better warnings in regression tests
  • Loading branch information
charleskawczynski authored May 8, 2024
2 parents 80ca1a7 + 3e708a9 commit e90f40e
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions regression_tests/compute_mse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,26 @@ function regression_test(; job_id, reference_mse, ds_filename_computed, varname)
ds_filename_reference = joinpath(path, ds_filename_computed)
@info "`ds_filename_computed`: `$ds_filename_computed`"
@info "`ds_filename_reference`: `$ds_filename_reference`"
job_dir = dirname(ds_filename_reference)
nc_tar = joinpath(job_dir, "nc_files.tar")
# We may have converted to tarball, try to
# extract nc files from tarball first:
if !isfile(ds_filename_reference)
# We may have converted to tarball, try to
# extract nc files from tarball first:
job_dir = dirname(ds_filename_reference)
mktempdir(joinpath(job_dir, tempdir())) do tdir
# We must extract to an empty folder, let's
# move it back to job_dir after.
Tar.extract(joinpath(job_dir, "nc_files.tar"), tdir) do hdr
basename(hdr.path) == basename(ds_filename_reference)
if isfile(nc_tar)
mktempdir(joinpath(job_dir, tempdir())) do tdir
# We must extract to an empty folder, let's
# move it back to job_dir after.
Tar.extract(nc_tar, tdir) do hdr
basename(hdr.path) == basename(ds_filename_reference)
end
mv(
joinpath(tdir, basename(ds_filename_reference)),
joinpath(job_dir, basename(ds_filename_reference));
force = true,
)
end
mv(
joinpath(tdir, basename(ds_filename_reference)),
joinpath(job_dir, basename(ds_filename_reference));
force = true,
)
else
@warn "There is no reference dataset, and no NC tar file."
end
end
if !isfile(ds_filename_reference)
Expand Down

0 comments on commit e90f40e

Please sign in to comment.