forked from jpata/hepaccelerate-cms
-
Notifications
You must be signed in to change notification settings - Fork 5
/
check.py
21 lines (16 loc) · 921 Bytes
/
check.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os, os.path
import argparse
parser = argparse.ArgumentParser(description='Checks output of batch jobs')
parser.add_argument('--logs', help='directory with submission scripts / logs', type=str, default=None, required=True)
parser.add_argument('--outdir', help='directory with output files', type=str, default=None, required=True)
parser.add_argument('--resubmit', action='store_true', help='resubmit missing files')
args = parser.parse_args()
# simple version for working with CWD
njobs = len([f for f in os.listdir(args.logs) if ".job" in f])
sample = args.logs.split('/')[-2]
print(sample)
for nCount in range(0,njobs):
if not os.path.exists(args.outdir + "out_" + sample + "_" + str(nCount) + ".json"):
print(args.outdir + "out_" + sample + "_" + str(nCount) + ".json")
if args.resubmit:
os.system("sbatch -o {0}/slurm-{1}_resubmit.out {0}/{1}.job".format(args.logs,nCount))