def readCache(filename): # read the cache file and returns the list of the RunReports for all the cached files runReports = [] runNumbers = [] if os.path.exists(filename): print "reading cache file: " + filename cache = file(filename,"r") data = cache.readlines() for line in data: if line[0] != '#' and line != "": # read the relevant lines # print line items = line.split() # get the run # runCached = int(items[0]) runNumbers.append(runCached) # create the report runReport = RunReport(runCached) #runReport.setRunNumber(runCached) runReport.startTime = RunInfo.getDate(items[1] + " " + items[2]) runReport.stopTime = RunInfo.getDate(items[3] + " " + items[4]) runReport.pclRun = ast.literal_eval(items[5]) runReport.multipleFiles = ast.literal_eval(items[6]) runReport.hasPayload = ast.literal_eval(items[7]) runReport.hasUpload = ast.literal_eval(items[8]) runReport.uploadSucceeded = ast.literal_eval(items[9]) runReport.isOutofOrder = ast.literal_eval(items[10]) latencyJobFromEnd = float(items[11]) latencyStartCached = float(items[12]) latencyEndCached = float(items[13]) runReport.latencyJobFromEnd = latencyJobFromEnd runReport.latencyUploadFromStart = latencyStartCached runReport.latencyUploadFromEnd = latencyEndCached runReports.append(runReport) cache.close() return runNumbers, runReports
def readCache(filename): # read the cache file and returns the list of the RunReports for all the cached files runReports = [] runNumbers = [] if os.path.exists(filename): print "reading cache file: " + filename cache = file(filename,"r") data = cache.readlines() for line in data: if line[0] != '#' and line != "": # read the relevant lines items = line.split() # get the run # runCached = int(items[0]) runNumbers.append(runCached) # create the report rRep = RunReportTagCheck() rRep.setRunNumber(runCached) startCached = RunInfo.getDate(items[1] + " " + items[2]) rRep.setStartTime(startCached) stopCached = RunInfo.getDate(items[3] + " " + items[4]) rRep.setStopTime(stopCached) remaining = len(items) - 5 last = 4 #print runCached while remaining >= 1: record = data[0].split()[last] status = items[last+1] rRep.addRecordAndStatus(record,status) #print data[0].split() #print record, status last += 1 remaining -= 1 runReports.append(rRep) cache.close() return runNumbers, runReports
deltaTRunH = deltaTRun.seconds/(60.*60.) # FIXME if rRep.runNumber() > lastPromptRecoRun and not nextFound: pageWriter.setNextPromptReco(rRep.runNumber(), rRep.startTime(), rRep.stopTime(), deltaTRunH) nextFound = True producePlots(rcdReports, runReports, nextPromptRecoRun) status = monitorStatus.MonitorStatus('read') status.readJsonFile(webArea + "status.json") pageWriter.setBackendUpdateDate(status.getField('update')) pageWriter.statusSummary(status.getField('status'),status.getField('msg')) #update = datetime.datetime update = RunInfo.getDate(status.getField('update')) deltatfromend = datetime.datetime.today() - update # deltatfromendH = deltatfromend.days*24. + deltatfromend.seconds/(60.*60.) #print deltatfromendH pageWriter.setOldUpdateWarning(deltatfromend) pageWriter.buildPage(webArea) sys.exit(0)