def makePartDirs(self, part_role): if self.args['save_full_image']: self.args[''.join([part_role, '_image_dir' ])] = os.path.join(self.args['root_dir'], part_role + '_image') utils.makeDirectory(self.args[part_role + '_image_dir']) self.args[part_role + '_part_image_dir'] = os.path.join( self.args['root_dir'], part_role + '_part_image') utils.makeDirectory(self.args[part_role + '_part_image_dir']) return
def makeNeededDir(self): utils.makeDirectory(self.args['root_dir']) self.makePartDirs('train') if self.args['validation_rate'] > 0: self.makePartDirs('validation') if self.args['test_rate'] > 0: self.makePartDirs('test') self.args['annotations_dir'] = os.path.join(self.args['root_dir'], 'annotations') utils.makeDirectory(self.args['annotations_dir']) return
else: fpath+=conf.SPACE+filteredlist.pop()+"\n" foutxml.write(re.sub("__INPUTFILES__",fpath,t)) elif re.search("__OUTPUTROOTDIR__/__OUTPUTROOT__",t): tmp = re.sub("__OUTPUTROOTDIR__",conf.OUTDIR_ROOT,t) tmp2 = conf.SPACE + re.sub("__OUTPUTROOT__",conf.OUTPUT_PREFIX+pname + "_" + str(nxmlfile) + ".root",tmp) foutxml.write(tmp2) elif re.search("__GEARFILE__",t): tmp = conf.SPACE + re.sub("__GEARFILE__",conf.GEARFILE,t) foutxml.write(tmp) elif re.search("__INPUTPREFIX__",t): tmp = conf.SPACE + re.sub("__INPUTPREFIX__",conf.INPUT_PREFIX,t) foutxml.write(tmp) else: foutxml.write(t) # main function # prepare directories if necessary utils.makeDirectory(conf.TEMPLATEDIR) utils.makeDirectory(conf.XMLDIR) utils.makeDirectory(conf.OUTDIR_ROOT) # copy xml to this directory shutil.copy(conf.TEMPLATEXMLORIGDIR+"/"+conf.TEMPLATEFILE,conf.TEMPLATEDIR+"/"+conf.TEMPLATEFILE) for proc in conf.PROCESSES: writeXMLs(proc);
#!/usr/bin/python import os,utils,conf import signal signal.signal(signal.SIGINT, signal.SIG_DFL) utils.makeDirectory(conf.LOGDIR) xmls = os.listdir(conf.XMLDIR) minIndex=0 maxIndex=len(xmls) #minIndex=2 #maxIndex=2 for xml in xmls: suffix = '.' + xml.split('.')[-1] # suffix = .slcio basename = xml.split(suffix)[0] index = basename.split('_')[-1] if int(index) <= maxIndex and int(index) > minIndex : cmd = "bsub -q s " + "-o "+conf.LOGDIR+"/" + basename + ".log " + '\"Marlin ' + conf.XMLDIR + '/' + xml.strip() + '\"' os.system(cmd) #print cmd
#!/usr/bin/python import os,utils,conf utils.makeDirectory(conf.LOGDIR) xmls = os.listdir(conf.XMLDIR) minIndex=0 maxIndex=len(xmls) #minIndex=100 #maxIndex=200 for xml in xmls: suffix = '.' + xml.split('.')[-1] # suffix = .slcio basename = xml.split(suffix)[0] index = basename.split('_')[-1] if int(index) <= maxIndex and int(index) > minIndex : cmd = "bsub -q s " + "-o "+conf.LOGDIR+"/" + basename + ".log " + '\"Marlin ' + conf.XMLDIR + '/' + xml.strip() + '\"' os.system(cmd) #print cmd