-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsubmitskimjob.py
executable file
·31 lines (24 loc) · 1.14 KB
/
submitskimjob.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from importlib import import_module
# loop over the directories and submit background jobs
def submit(jobconfmod):
# get input directory, outputdirectory, stderrout file from the job configuration python module
mod = import_module(jobconfmod)
nanoaod_inputdir_outputdir_pairs= getattr(mod, 'nanoaod_inputdir_outputdir_pairs')
# job configuation module name is to be passed to the skim namoaod main
for indir,outdir,outfile in nanoaod_inputdir_outputdir_pairs:
os.system('./skimnanoaod.py '+ indir + ' ' + outdir + ' ' + jobconfmod + ' > ' + outfile + ' 2>&1 &') # submit background jobs
pass
if __name__=="__main__":
from argparse import ArgumentParser
parser = ArgumentParser(usage="%prog jobconfigmodule", description='submits skim jobs in background where the job '\
+' configuration python module name should be passedd')
parser.add_argument("jobconfmod")
args = parser.parse_args()
jobconfmod_fname = args.jobconfmod
# strip .py from the filename
jobconfmod = jobconfmod_fname.replace('.py', '')
submit(jobconfmod)
pass