示例#1
0
文件: relval.py 项目: anantoni/CMG
def processRelVal( relval, cfgFileName, process, negate, tier=None, batch = None):
    
    relvalID = relval.id()
    if batch is None:
        batch = 'bsub -q 1nh -J %s < ./batchScript.sh | tee job_id.txt' % relvalID  

    files = pickRelValInputFiles(
        cmsswVersion  =  relval.cmssw
        , relVal = relval.relval
        , globalTag = relval.tag
        , numberOfFiles = 999
        )
    if not files:
        raise Exception("No relval files found for '%s'" % relvalID )

    # changing the source to the chosen relval files
    process.source.fileNames = files
    
    print process.source.fileNames
    
    # building cfg

    outFile = open("tmpConfig.py","w")
    outFile.write("import FWCore.ParameterSet.Config as cms\n")
    outFile.write(process.dumpPython())
    outFile.close()

    # building cmsBatch command
    
    print relvalID

    dataset = relval.dataset
    if tier!=None:
        dataset += '/' + tier
        
    outDir = '.' + dataset
    castorOutDir = myCastorBaseDir() + '/' + dataset

    #if tier!=None:
    #    castorOutDir += '/' + tier
    #    outDir += '/' + tier

    print 'local  output: ', outDir
    print 'castor output:', castorOutDir
    
    # output directory creation will be handled by cmsBatch
    # os.system( 'mkdir -p ' + outDir )
    
    cmsBatch = "cmsBatch.py 1 tmpConfig.py -r %s -o %s -b '%s' " % (castorOutDir, outDir, batch)
    if negate:
        cmsBatch += ' -n'
    print cmsBatch
    os.system( cmsBatch )
    addToDatasets( dataset ) 

    return (outDir, castorOutDir)
示例#2
0
def processRelVal(relval, cfgFileName, process, negate, tier=None, batch=None):

    relvalID = relval.id()
    if batch is None:
        batch = 'bsub -q 1nh -J %s < ./batchScript.sh | tee job_id.txt' % relvalID

    files = pickRelValInputFiles(cmsswVersion=relval.cmssw,
                                 relVal=relval.relval,
                                 globalTag=relval.tag,
                                 numberOfFiles=999)
    if not files:
        raise Exception("No relval files found for '%s'" % relvalID)

    # changing the source to the chosen relval files
    process.source.fileNames = files

    print process.source.fileNames

    # building cfg

    outFile = open("tmpConfig.py", "w")
    outFile.write("import FWCore.ParameterSet.Config as cms\n")
    outFile.write(process.dumpPython())
    outFile.close()

    # building cmsBatch command

    print relvalID

    dataset = relval.dataset
    if tier != None:
        dataset += '/' + tier

    outDir = '.' + dataset
    castorOutDir = myCastorBaseDir() + '/' + dataset

    #if tier!=None:
    #    castorOutDir += '/' + tier
    #    outDir += '/' + tier

    print 'local  output: ', outDir
    print 'castor output:', castorOutDir

    # output directory creation will be handled by cmsBatch
    # os.system( 'mkdir -p ' + outDir )

    cmsBatch = "cmsBatch.py 1 tmpConfig.py -r %s -o %s -b '%s' " % (
        castorOutDir, outDir, batch)
    if negate:
        cmsBatch += ' -n'
    print cmsBatch
    os.system(cmsBatch)
    addToDatasets(dataset)

    return (outDir, castorOutDir)
示例#3
0
#    destBaseDir = castorBaseDir.defaultCastorBaseDir


print 'starting prod for sample:', sampleName

# preparing castor dir -----------------

# cdir = options.castorBaseDir 

if options.tier != "":
    sampleName += "/" + options.tier

print "sampleName ",sampleName
outFile = destBaseDir
outFile += sampleName

# prepare local output dir:
localOutputDir = './' + sampleName 
mkdir = 'mkdir -p ' + localOutputDir
print mkdir
os.system(mkdir)

# the output castor directory will be prepared by cmsBatch

cmsBatch = 'cmsBatch.py %s %s -r %s -b "%s" -o %s' % (options.nInput, cfg, outFile, options.batch, localOutputDir)

addToDatasets( sampleName )


print cmsBatch