trackedRuns = list(set(trackedRuns)) vertexedRuns = list(set(vertexedRuns)) uploadedRuns = list(set(uploadedRuns)) print 'Initial status: %d runs, %d tracked, %d vertexed, %d uploaded' % ( len(runIDs), len(trackedRuns), len(vertexedRuns), len(uploadedRuns)) frecord = open(options.record, 'a') time.sleep(3) if options.debug: print 'Detailed initial status: ' for runID in runIDs: print runID, runID in trackedRuns, runID in vertexedRuns, runID in uploadedRuns # initialize grid GU.gridInit() # initialize all the log files, for job submittion and job monitoring logfile = os.path.join( GU.workDir, 'monitor_%s_%s.log' % (options.list.replace('list_', '').replace('.txt', ''), GU.getTimeStamp())) GU.submissionLog = logfile.replace('monitor', 'submission') fout = open(logfile, 'w') # loop until all jobs has been uploaded/tracked while len(uploadedRuns) != len(runIDs) or len(trackedRuns) != len( runIDs) or len(vertexedRuns) != len(runIDs): # commands to be re-submitted failedJobs = [] # check the status of tracking jobs, this part handles mergeing/moving ROOT files, and prepare vertex jobs
parser.add_option('-l', '--list', type = 'string', dest = 'list', help = 'List of run IDs', default = '') parser.add_option('-j', '--job', type = 'string', dest = 'job', help = 'Type of job: track, vertex, online, etc.', default = '') parser.add_option('-s', '--split', type = 'int', dest = 'nEvtMax', help = 'Constrain the single job to be less than certain events, default is no splitting', default = -1) parser.add_option('-c', '--config', type = 'string', dest = 'config', help = 'I/O configuration file', default = '') parser.add_option('-n', '--maxjobs', type = 'int', dest = 'nJobsMax', help = 'Maximum number of jobs to split one run', default = 10) parser.add_option('-r', '--resubmit', type = 'string', dest = 'resubmit', help = 'Catchup where it has been left', default = '') parser.add_option('-e', '--errlog', type = 'string', dest = 'errlog', help = 'Failed command log', default = 'submitAll_err.log') parser.add_option('-m', '--mcmode', action = 'store_true', dest = 'mcmode', help = 'Running for MC data', default = False) parser.add_option('-d', '--debug', action = 'store_true', dest = 'debug', help = 'Enable massive debugging output', default = False) (options, args) = parser.parse_args() if len(sys.argv) < 2: parser.parse_args(['--help']) # initialize grid credetial GridUtil.gridInit() # if in catchup mode, then simply submit jobs and exit if options.resubmit != '': cmds = [line.strip() for line in open(options.resubmit).readlines()] GridUtil.submitAllJobs(cmds, options.errlog) GridUtil.stopGridGuard() sys.exit(0) # initialize the configuration conf = GridUtil.JobConfig(options.config) # process runID list, if in MC mode, initialize file list from options.list runIDs = [] runFiles = [] runLengths = []