diff options
author | tlatorre <tlatorre@uchicago.edu> | 2019-08-28 11:07:03 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2019-08-28 11:07:03 -0500 |
commit | 8a1d843403cda4b82417167d3473f3cefdfdc463 (patch) | |
tree | e9d96a5c2442ae1104a4b231095d2d9becca5b2f /utils/cat-grid-jobs | |
parent | 169f148f885ddcd3697656129fd01968853a21de (diff) | |
download | sddm-8a1d843403cda4b82417167d3473f3cefdfdc463.tar.gz sddm-8a1d843403cda4b82417167d3473f3cefdfdc463.tar.bz2 sddm-8a1d843403cda4b82417167d3473f3cefdfdc463.zip |
update cat-grid-jobs
This commit updates cat-grid-jobs to only warn once about a mismatch between
the SHA1 of the current zdab-cat program and the grid results, and also cleans
up some of the output.
Diffstat (limited to 'utils/cat-grid-jobs')
-rwxr-xr-x | utils/cat-grid-jobs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/utils/cat-grid-jobs b/utils/cat-grid-jobs index 1f83bea..218c1b7 100755 --- a/utils/cat-grid-jobs +++ b/utils/cat-grid-jobs @@ -119,6 +119,18 @@ class bcolors: UNDERLINE = '\033[4m' def print_warning(msg): + print(bcolors.WARNING + msg + bcolors.ENDC,file=sys.stderr) + +warned = False + +def print_warning_once(msg): + global warned + if not warned: + print_warning(msg) + print("skipping further warnings") + warned = True + +def print_fail(msg): print(bcolors.FAIL + msg + bcolors.ENDC,file=sys.stderr) if __name__ == '__main__': @@ -126,7 +138,7 @@ if __name__ == '__main__': import matplotlib.pyplot as plt import numpy as np from subprocess import check_call - from os.path import join + from os.path import join, split import os import sys import h5py @@ -161,9 +173,13 @@ if __name__ == '__main__': total_events = fout['ev'].shape[0] for filename in glob.glob(join(args.directory,'*.hdf5')): with h5py.File(filename) as f: + if 'git_sha1' not in f.attrs: + print_fail("No git sha1 found for %s. Skipping..." % tail) + continue # Check to see if the git sha1 match if fout.attrs['git_sha1'] != f.attrs['git_sha1']: - print_warning("git_sha1 is %s for current version but %s for %s" % (fout.attrs['git_sha1'],f.attrs['git_sha1'],filename)) + head, tail = split(filename) + print_warning_once("git_sha1 is %s for current version but %s for %s" % (fout.attrs['git_sha1'],f.attrs['git_sha1'],tail)) # get fits which match up with the events valid_fits = f['fits'][np.isin(f['fits'][:][['run','gtid']],fout['ev'][:][['run','gtid']])] # Add the fit results |