action="store_true", help="don't check for duplicates") (options, args) = parser.parse_args() if len(args) != 1: print 'provide exactly one directory in argument.' sys.exit(1) dir = args[0] checkOutput = commands.getoutput("chunkOutCheck.py " + str(dir) + "/*") print checkOutput checkOutput_lines = checkOutput.split("\n") badFiles = set() for aline in checkOutput_lines: if aline.startswith("['"): thisBadFile = aline.split("['")[1].split("']")[0].split(dir)[1] while thisBadFile.startswith("/"): thisBadFile = thisBadFile.split("/")[1] badFiles.add(thisBadFile) try: haddChunks(dir, options.remove, options.clean, badFiles) except OSError: print "-> Looks like there's an hadded file in the way. Will proceed with post-processing only." print " (If you want to re-do the hadd, please remove the file or run with -r)" postProcess(dir, options.fast)
import os import sys from optparse import OptionParser parser = OptionParser() parser.usage = """ %prog <dir> Find chunks in dir, and run recursive hadd to group all chunks. For example: DYJets_Chunk0/, DYJets_Chunk1/ ... -> hadd -> DYJets/ WJets_Chunk0/, WJets_Chunk1/ ... -> hadd -> WJets/ """ parser.add_option("-r","--remove", dest="remove", default=False,action="store_true", help="remove existing destination directories.") parser.add_option("-c","--clean", dest="clean", default=False,action="store_true", help="move chunks to Chunks/ after processing.") (options,args) = parser.parse_args() if len(args)!=1: print 'provide exactly one directory in argument.' sys.exit(1) dir = args[0] haddChunks(dir, options.remove, options.clean)
parser.usage = """ %prog <dir> Find chunks in dir, and run recursive hadd to group all chunks. For example: DYJets_Chunk0/, DYJets_Chunk1/ ... -> hadd -> DYJets/ WJets_Chunk0/, WJets_Chunk1/ ... -> hadd -> WJets/ """ parser.add_option("-r","--remove", dest="remove", default=False,action="store_true", help="remove existing destination directories.") parser.add_option("-n","--nanoAOD", dest="nanoAOD", default=False,action="store_true", help="remove existing destination directories.") parser.add_option("-c","--clean", dest="clean", default=False,action="store_true", help="move chunks to Chunks/ after processing.") parser.add_option("--max-size", dest="maxSize", default=None,type="float", help="max size of a chunk (in Gb)") (options,args) = parser.parse_args() if len(args)!=1: print 'provide exactly one directory in argument.' sys.exit(1) dir = args[0] haddChunks(dir, options.remove, options.clean, maxSize=options.maxSize, nanoAOD=options.nanoAOD)
parser = OptionParser() parser.usage = """ %prog <dir> Find chunks in dir, and run recursive hadd to group all chunks. For example: DYJets_Chunk0/, DYJets_Chunk1/ ... -> hadd -> DYJets/ WJets_Chunk0/, WJets_Chunk1/ ... -> hadd -> WJets/ """ parser.add_option("-r", "--remove", dest="remove", default=False, action="store_true", help="remove existing destination directories.") parser.add_option("-c", "--clean", dest="clean", default=False, action="store_true", help="move chunks to Chunks/ after processing.") (options, args) = parser.parse_args() if len(args) != 1: print 'provide exactly one directory in argument.' sys.exit(1) dir = args[0] haddChunks(dir, options.remove, options.clean)
DYJets_Chunk0/, DYJets_Chunk1/ ... -> hadd -> DYJets/ WJets_Chunk0/, WJets_Chunk1/ ... -> hadd -> WJets/ """ parser.add_option("-r", "--remove", dest="remove", default=False, action="store_true", help="remove existing destination directories.") parser.add_option("-c", "--clean", dest="clean", default=False, action="store_true", help="move chunks to Chunks/ after processing.") parser.add_option("--max-size", dest="maxSize", default=None, type="float", help="max size of a chunk (in Gb)") (options, args) = parser.parse_args() if len(args) != 1: print 'provide exactly one directory in argument.' sys.exit(1) dir = args[0] haddChunks(dir, options.remove, options.clean, maxSize=options.maxSize)