ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/python/submitThem.py
(Generate patch)

Comparing UserCode/VHbb/python/submitThem.py (file contents):
Revision 1.1 by nmohr, Thu Jun 21 13:45:14 2012 UTC vs.
Revision 1.7 by nmohr, Fri Sep 21 14:50:48 2012 UTC

# Line 1 | Line 1
1   #! /usr/bin/env python
2 < import os,time,subprocess
2 > import os,shutil,sys,pickle,subprocess,ROOT
3 > from optparse import OptionParser
4 > from BetterConfigParser import BetterConfigParser
5 > from samplesclass import sample
6 > import getpass
7  
8 < def submit(job):
9 <        command = 'qsub -q all.q -N %s -o /shome/nmohr/VHbbAnalysis/LOG/%s.out -e /shome/nmohr/VHbbAnalysis/LOG/%s.err runAll.sh %s' %(job,job,job,job)
8 >
9 > parser = OptionParser()
10 > parser.add_option("-T", "--tag", dest="tag", default="",
11 >                      help="Tag to run the analysis with, example '8TeV' uses config8TeV and pathConfig8TeV to run the analysis")
12 >
13 > (opts, args) = parser.parse_args(sys.argv)
14 > if opts.tag == "":
15 >        print "Please provide tag to run the analysis with, example '-T 8TeV' uses config8TeV and pathConfig8TeV to run the analysis."
16 >        sys.exit(123)
17 > en = opts.tag
18 > configs = ['config%s'%(en),'pathConfig%s'%(en)]
19 > print configs
20 > config = BetterConfigParser()
21 > config.read(configs)
22 > btagLibrary = config.get('BTagReshaping','library')
23 > submitDir = os.getcwd()
24 > os.chdir(os.path.dirname(btagLibrary))
25 > if not os.path.exists(btagLibrary):
26 >    ROOT.gROOT.LoadMacro('%s+'%btagLibrary.replace('_h.so','.h'))
27 > shutil.copyfile(os.path.basename(btagLibrary),'/scratch/%s/%s'%(getpass.getuser(),os.path.basename(btagLibrary)))
28 > shutil.copyfile('/scratch/%s/%s'%(getpass.getuser(),os.path.basename(btagLibrary)),btagLibrary)
29 > os.chdir(submitDir)
30 > logPath = config.get("Directories","logpath")
31 > repDict = {'en':en,'logpath':logPath,'job':''}
32 > def submit(job,repDict):
33 >        repDict['job'] = job
34 >        command = 'qsub -V -cwd -q all.q -N %(job)s_%(en)s -o %(logpath)s/%(job)s_%(en)s.out -e %(logpath)s/%(job)s_%(en)s.err runAll.sh %(job)s %(en)s' %repDict
35          print command
36          subprocess.call([command], shell=True)
37  
38 < #theJobs = ['STbar_tW','ST_tW']
39 < #theJobs = ['ZH110','ZH125','ZH120','Zudsg','Zbb','Zcc','ZH115','ZH130','ZZ','Zudsg70100','Zbb70100','Zcc70100','Zudsg5070','Zbb5070','Zcc5070','Zmm','Zudsg100','Zbb100','Zcc100','ST_s','TT','Zee','STbar_s','STbar_t','WZ','WW','STbar_tW','ST_tW']
40 < #theJobs = ['ZH110','ZH125']
41 < theJobs = ['ZH110','ZH125','ZH120','Zudsg','Zbb','Zcc','ZH115','ZH130','ZZ','Zudsg70100','Zbb70100','Zcc70100','Zudsg5070','Zbb5070','Zcc5070','Zmm','Zudsg100','Zbb100','Zcc100','ST_s','TT','Zee','STbar_s','STbar_t','WZ','WW','STbar_tW','ST_tW']
13 <
38 > path = config.get("Directories","samplepath")
39 > infofile = open(path+'/env/samples.info','r')
40 > info = pickle.load(infofile)
41 > infofile.close()
42  
43 < for job in theJobs:
44 <        submit(job)
17 <        #time.sleep(10)
43 > for job in info:
44 >        submit(job.name,repDict)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines