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.29 by peller, Wed Feb 13 10:06:17 2013 UTC vs.
Revision 1.32 by bortigno, Tue Feb 19 17:23:59 2013 UTC

# Line 16 | Line 16 | parser.add_option("-S","--samples",dest=
16                        help="samples you want to run on")
17   parser.add_option("-F", "--folderTag", dest="ftag", default="",
18                        help="Creats a new folder structure for outputs or uses an existing one with the given name")
19 + parser.add_option("-N", "--number-of-events", dest="nevents_split", default=100000,
20 +                      help="Number of events per file when splitting.")
21 + parser.add_option("-P", "--philipp-love-progress-bars", dest="philipp_love_progress_bars", default=False,
22 +                      help="If you share the love of Philipp...")
23 +
24   (opts, args) = parser.parse_args(sys.argv)
25  
26 < import os,shutil,pickle,subprocess,ROOT
26 > import os,shutil,pickle,subprocess,ROOT,re
27   ROOT.gROOT.SetBatch(True)
28 < from myutils import BetterConfigParser, Sample, ParseInfo
28 > from myutils import BetterConfigParser, Sample, ParseInfo, sample_parser
29   import getpass
30  
31   if opts.tag == "":
# Line 94 | Line 99 | if( not os.path.isdir(logPath) ):
99          print 'Exit'
100          sys.exit(-1)
101  
102 < repDict = {'en':en,'logpath':logPath,'job':'','task':opts.task,'queue': 'all.q','timestamp':timestamp}
102 > repDict = {'en':en,'logpath':logPath,'job':'','task':opts.task,'queue': 'all.q','timestamp':timestamp,'additional':'','job_id':''}
103   def submit(job,repDict):
104          repDict['job'] = job
105 <        command = 'qsub -V -cwd -q %(queue)s -l h_vmem=6G -N %(job)s_%(en)s%(task)s -o %(logpath)s/%(timestamp)s_%(job)s_%(en)s_%(task)s.out -e %(logpath)s/%(timestamp)s_%(job)s_%(en)s_%(task)s.err runAll.sh %(job)s %(en)s ' %(repDict) + opts.task
105 >        command = 'qsub -V -cwd -q %(queue)s -l h_vmem=6G -N %(job)s_%(en)s%(task)s -o %(logpath)s/%(timestamp)s_%(job)s_%(en)s_%(task)s.out -e %(logpath)s/%(timestamp)s_%(job)s_%(en)s_%(task)s.err runAll.sh %(job)s %(en)s ' %(repDict) + opts.task + ' ' + repDict['job_id'] + ' ' + repDict['additional']
106          print command
107          subprocess.call([command], shell=True)
108  
# Line 126 | Line 131 | if opts.task == 'plot':
131      for item in Plot_vars:
132          submit(item,repDict)
133  
134 +
135   elif opts.task == 'dc':
136 <    repDict['queue'] = 'all.q'
136 >    repDict['queue'] = 'short.q'
137      for item in DC_vars:
138          if 'ZH%s'%opts.mass in item:
139              submit(item,repDict)
# Line 137 | Line 143 | elif opts.task == 'dc':
143   elif opts.task == 'prep':
144      submit('prepare',repDict)
145  
146 < elif opts.task == 'eval' or opts.task == 'sys' or opts.task == 'syseval':
146 > elif opts.task == 'sys' or opts.task == 'syseval':
147 >    path = config.get("Directories","SYSin")
148 >    samplesinfo = config.get("Directories","samplesinfo")
149 >    info = ParseInfo(samplesinfo,path)
150      if ( opts.samples == ""):
151          for job in info:
152 +            if (job.subsample): continue #avoid multiple submissions form subsamples
153 +            # TO FIX FOR SPLITTED SAMPLE
154              submit(job.name,repDict)
155      else:
156          for sample in samplesList:
157              submit(sample,repDict)
158  
159 < os.system('qstat')
160 < os.system('./qstat.py')
159 > elif opts.task == 'eval':
160 >    path = config.get("Directories","MVAin")
161 >    samplesinfo = config.get("Directories","samplesinfo")
162 >    info = ParseInfo(samplesinfo,path)
163 >    if ( opts.samples == ""):
164 >        for job in info:
165 >            if (job.subsample): continue #avoid multiple submissions from subsamples
166 >            if(info.checkSplittedSampleName(job.identifier)): # if multiple entries for one name  (splitted samples) use the identifier to submit
167 >                    print '@INFO: Splitted samples: submit through identifier'
168 >                    submit(job.identifier,repDict)
169 >            else: submit(job.name,repDict)
170 >    else:
171 >        for sample in samplesList:
172 >            submit(sample,repDict)
173 >
174 >
175 > elif( opts.task == 'split' ):
176 >        path = config.get("Directories","SPLITin")
177 >        samplesinfo = config.get("Directories","samplesinfo")
178 >        repDict['job_id']=opts.nevents_split
179 >        info = ParseInfo(samplesinfo,path)
180 >        if ( opts.samples == "" ):
181 >                for job in info:
182 >                        if (job.subsample): continue #avoid multiple submissions from subsamples
183 >                        submit(job.name,repDict)
184 >        else:
185 >                for sample in samplesList:
186 >                        submit(sample,repDict)
187 >
188 > #BDT optimisation
189 > elif opts.task == 'mva_opt':
190 >        total_number_of_steps=1
191 >        setting = ''
192 >        for par in (config.get('Optimisation','parameters').split(',')):
193 >                scan_par=eval(config.get('Optimisation',par))
194 >                setting+=par+'='+str(scan_par[0])+':'
195 >                if len(scan_par) > 1 and scan_par[2] != 0:
196 >                        total_number_of_steps+=scan_par[2]
197 >        setting=setting[:-1] # eliminate last column at the end of the setting string
198 >        print setting
199 >        repDict['additional']=setting
200 >        repDict['job_id']=config.get('Optimisation','training')
201 >        submit('OPT_main_set',repDict)
202 >        main_setting=setting
203 >
204 >        #Scanning all the parameters found in the training config in the Optimisation sector
205 >        for par in (config.get('Optimisation','parameters').split(',')):
206 >                scan_par=eval(config.get('Optimisation',par))
207 >                print par
208 >                if len(scan_par) > 1 and scan_par[2] != 0:
209 >                        for step in range(scan_par[2]):
210 >                                value = (scan_par[0])+((1+step)*(scan_par[1]-scan_par[0])/scan_par[2])
211 >                                print value
212 >                                setting=re.sub(par+'.*?:',par+'='+str(value)+':',main_setting)
213 >                                repDict['additional']=setting
214 > #                               repDict['job_id']=config.get('Optimisation','training')
215 >                                submit('OPT_'+par+str(value),repDict)
216 > #                               submit(config.get('Optimisation','training'),repDict)
217 >                                print setting
218 >
219 >
220 > os.system('qstat')
221 > if (opts.philipp_love_progress_bars):
222 >        os.system('./qstat.py')

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines