diff options
-rwxr-xr-x | utils/submit-grid-jobs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/utils/submit-grid-jobs b/utils/submit-grid-jobs index 2e9feb7..4e3bd5b 100755 --- a/utils/submit-grid-jobs +++ b/utils/submit-grid-jobs @@ -586,6 +586,7 @@ if __name__ == '__main__': parser.add_argument('--max-retries', type=int, default=2, help="maximum number of times to try and resubmit a grid job") parser.add_argument('--auto', action='store_true', default=False, help="automatically loop over database entries and submit grid jobs") parser.add_argument('--max-jobs', type=int, default=100, help="maximum number of jobs in the grid queue at any time") + parser.add_argument('-r','--reprocess', action='store_true', default=False, help="force reprocessing of runs which are already in the database") args = parser.parse_args() log.set_verbosity(args.loglevel) @@ -619,6 +620,10 @@ if __name__ == '__main__': conn.commit() + results = c.execute('SELECT DISTINCT run FROM state') + + unique_runs = [row[0] for row in results.fetchall()] + if 'SDDM_DATA' not in os.environ: log.warn("Please set the SDDM_DATA environment variable to point to the fitter source code location", file=sys.stderr) sys.exit(1) @@ -674,7 +679,12 @@ if __name__ == '__main__': else: check_call([zdab_cat,filename,"-o",output.name],stderr=f) - with h5py.File(output.name) as f: + with h5py.File(output.name,'r') as f: + if len(f['ev']) and not args.reprocess and int(f['ev'][0]['run']) in unique_runs: + head, tail = split(filename) + log.notice("Skipping %s because run %i is already in the database" % (tail,int(f['ev'][0]['run']))) + continue + for ev in f['ev']: if ev['nhit'] >= args.min_nhit: for i in range(1,args.max_particles+1): |