def run(self, input): if self.user == 'CMS': return {'Topdir':None,'Directory':None} topdir = castortools.lfnToCastor(castorBaseDir(user=self.user)) directory = '%s/%s' % (topdir,self.dataset) directory = directory.replace('//','/') if not castortools.fileExists(directory): if hasattr(self,'create') and self.create: castortools.createCastorDir(directory) #castortools.chmod(directory,'775') if not castortools.isDirectory(directory): raise Exception("Dataset directory '%s' does not exist or could not be created" % directory) return {'Topdir':topdir,'Directory':directory}
def run(self, input): if self.user == 'CMS': return {'Topdir':None,'Directory':None} topdir = castortools.lfnToCastor(castorBaseDir(user=self.user)) directory = '%s/%s' % (topdir,self.dataset) # directory = directory.replace('//','/') if not castortools.fileExists(directory): if hasattr(self,'create') and self.create: castortools.createCastorDir(directory) #castortools.chmod(directory,'775') if not castortools.isDirectory(directory): raise Exception("Dataset directory '%s' does not exist or could not be created" % directory) return {'Topdir':topdir,'Directory':directory}
config.add_section(safe_name) directory = '%s/%s' % (topdir,d) if opts.tier: directory = os.path.join(directory,opts.tier) directory = directory.replace('//','/') config.set(safe_name,'CMSSW.datasetpath',d) lfn = castortools.castorToLFN(directory) config.set(safe_name,'USER.user_remote_dir',lfn) output_dirs.append(lfn) #create the directory on EOS if not castortools.fileExists(directory): castortools.createCastorDir(directory) castortools.chmod(directory,'775') if not castortools.isDirectory(directory): raise Exception("Dataset directory '%s' does not exist or could not be created" % directory) config.write(file(opts.output,'wb')) from logger import logger logDir = 'Logger' os.mkdir(logDir) log = logger( logDir ) log.logCMSSW() log.addFile( os.path.join( os.getcwd(), opts.cfg) ) log.addFile( os.path.join( os.getcwd(), opts.output) ) for d in output_dirs:
# preparing castor dir ----------------- import castorBaseDir cdir = castortools.lfnToCastor( castorBaseDir.castorBaseDir(user=options.user) ) cdir += sampleNameDir if castortools.isCastorFile( cdir ) and not options.force: print 'The destination castor directory already exists:' print cdir print 'Please check. If everything is fine, run again with the -f option.' sys.exit(1) rfmkdir = 'rfmkdir -m 775 -p ' + cdir print rfmkdir castortools.createCastorDir(cdir) castortools.chmod(cdir, '775') # making local crab directory --------- ldir = '.' + sampleNameDir mkdir = 'mkdir -p ' + ldir print mkdir os.system( mkdir ) #cpcrab = 'cp crab.cfg %s/crab.cfg' % ldir #print cpcrab #os.system( cpcrab ) #prepare the crab file newCrabPath = '%s/crab.cfg' % ldir
config.add_section(safe_name) directory = '%s/%s' % (topdir, d) if opts.tier: directory = os.path.join(directory, opts.tier) directory = directory.replace('//', '/') config.set(safe_name, 'CMSSW.datasetpath', d) lfn = castortools.castorToLFN(directory) config.set(safe_name, 'USER.user_remote_dir', lfn) output_dirs.append(lfn) #create the directory on EOS if not castortools.fileExists(directory): castortools.createCastorDir(directory) castortools.chmod(directory, '775') if not castortools.isDirectory(directory): raise Exception( "Dataset directory '%s' does not exist or could not be created" % directory) config.write(file(opts.output, 'wb')) from logger import logger logDir = 'Logger' os.mkdir(logDir) log = logger(logDir) log.logCMSSW() log.addFile(os.path.join(os.getcwd(), opts.cfg)) log.addFile(os.path.join(os.getcwd(), opts.output))
# preparing castor dir ----------------- import castorBaseDir cdir = castortools.lfnToCastor(castorBaseDir.castorBaseDir(user=options.user)) cdir += sampleNameDir if castortools.isCastorFile(cdir) and not options.force: print 'The destination castor directory already exists:' print cdir print 'Please check. If everything is fine, run again with the -f option.' sys.exit(1) rfmkdir = 'rfmkdir -m 775 -p ' + cdir print rfmkdir castortools.createCastorDir(cdir) castortools.chmod(cdir, '775') # making local crab directory --------- ldir = '.' + sampleNameDir mkdir = 'mkdir -p ' + ldir print mkdir os.system(mkdir) #cpcrab = 'cp crab.cfg %s/crab.cfg' % ldir #print cpcrab #os.system( cpcrab ) #prepare the crab file newCrabPath = '%s/crab.cfg' % ldir