ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/python/submitThem.py
Revision: 1.6
Committed: Thu Sep 20 18:20:00 2012 UTC (12 years, 7 months ago) by nmohr
Content type: text/x-python
Branch: MAIN
Changes since 1.5: +28 -12 lines
Log Message:
Different logpath

File Contents

# User Rev Content
1 nmohr 1.1 #! /usr/bin/env python
2 nmohr 1.6 import os,sys,pickle,subprocess
3     from optparse import OptionParser
4     from BetterConfigParser import BetterConfigParser
5     from samplesclass import sample
6 nmohr 1.1
7 nmohr 1.6 parser = OptionParser()
8     parser.add_option("-T", "--tag", dest="tag", default="",
9     help="Tag to run the analysis with, example '8TeV' uses config8TeV and pathConfig8TeV to run the analysis")
10    
11     (opts, args) = parser.parse_args(sys.argv)
12     if opts.tag == "":
13     print "Please provide tag to run the analysis with, example '-T 8TeV' uses config8TeV and pathConfig8TeV to run the analysis."
14     sys.exit(123)
15     en = opts.tag
16     configs = ['config%s'%(en),'pathConfig%s'%(en)]
17     print configs
18     config = BetterConfigParser()
19     config.read(configs)
20     logPath = config.get("Directories","logpath")
21     repDict = {'en':en,'logpath':logPath,'job':''}
22     def submit(job,repDict):
23     repDict['job'] = job
24     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
25 nmohr 1.1 print command
26     subprocess.call([command], shell=True)
27    
28 nmohr 1.6 path = config.get("Directories","samplepath")
29     infofile = open(path+'/env/samples.info','r')
30     info = pickle.load(infofile)
31     infofile.close()
32 nmohr 1.1
33 nmohr 1.6 for job in info:
34     submit(job.name,repDict)