- Timestamp:
- Nov 8, 2011, 2:44:12 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110906
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippToPsps/jython/metrics.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110906
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20110906/ippToPsps/jython/metrics.py
r32354 r32630 52 52 53 53 # get a master list of IDs in DVO for this batch type 54 allIDs = gpc1Db.getIDsInThisDVODbForThisStage(DVOLABEL, batchType) 54 if MINRA and MAXRA and MINDEC and MAXDEC: 55 allIDs = gpc1Db.getIDsInThisDVODbForThisStage(DVOLABEL, batchType, MINRA, MAXRA, MINDEC, MAXDEC) 56 else: 57 allIDs = gpc1Db.getIDsInThisDVODbForThisStage(DVOLABEL, batchType) 55 58 prevList = allIDs 56 59 numEverything = len(allIDs) … … 73 76 numPending = len(pending) 74 77 78 #if stage == 'merge_worthy' and batchType == "P2": 79 # for n in pending: print n 80 75 81 str = "\033[1;34m%5s\033[1;m \033[1;32m%5s\033[1;m \033[1;31m%5s\033[1;m " % (getIntAsString(numPending), getIntAsString(numSuccess), getIntAsString(numFail)) 76 82 sys.stdout.write("|%-19s" % str) … … 79 85 print >> DATFILE, stage, numSuccess, numFail, numPending 80 86 87 if stage == 'processed': numPendingProcessed = numPending 88 81 89 sys.stdout.write("|\n") 82 90 plotMe(batchType, tempFilename) 83 91 DATFILE.close() 92 93 return numPendingProcessed 84 94 85 95 ''' … … 91 101 for i in range(0, colCount): sys.stdout.write("+-------------------") 92 102 sys.stdout.write("+\n") 103 104 ''' 105 Prints various timing stats for this batch type 106 ''' 107 def printStats(batchType): 108 109 rate = ippToPspsDb.countBatchesInLastPeriod(batchType, EPOCH, DVOLABEL, "1 HOUR") / 1.0 110 111 logger.info("| %2s | %16.1f | %13d | %17.1f | %16d | %14s |" % 112 (batchType, 113 rate, 114 ippToPspsDb.countBatchesInLastPeriod(batchType, EPOCH, DVOLABEL, "24 HOUR"), 115 ippToPspsDb.countBatchesInLastPeriod(batchType, EPOCH, DVOLABEL, "1 WEEK") / 7.0, 116 ippToPspsDb.getTotalDetectionsPublished(batchType, EPOCH, DVOLABEL), 117 ippToPspsDb.getTimeOfLastBatchPublished(batchType, EPOCH, DVOLABEL))) 118 119 return rate 93 120 94 121 ''' … … 112 139 gpc1Db = Gpc1Db(logger, configDoc) 113 140 141 MINRA = None 142 MAXRA = None 143 MINDEC = None 144 MAXDEC = None 145 114 146 DVOLABEL = configDoc.find("dvo/gpc1Label").text 115 147 EPOCH = configDoc.find("options/epoch").text … … 119 151 logger.infoPair("Loading epoch", EPOCH) 120 152 logger.infoPair("DVO label", DVOLABEL) 121 logger.infoPair("P2 batches per hour", "%.1f" % ippToPspsDb.getBatchesPerHour("P2", EPOCH, DVOLABEL, 2)) 122 logger.infoPair("ST batches per hour", "%.1f" % ippToPspsDb.getBatchesPerHour("ST", EPOCH, DVOLABEL, 2)) 123 logger.infoPair("Last P2 batch published", ippToPspsDb.getTimeOfLastBatchPublished("P2", EPOCH, DVOLABEL)) 124 logger.infoPair("Last ST batch published", ippToPspsDb.getTimeOfLastBatchPublished("ST", EPOCH, DVOLABEL)) 153 154 try: 155 MINRA = float(configDoc.find("dvo/minRA").text) 156 MAXRA = float(configDoc.find("dvo/maxRA").text) 157 MINDEC = float(configDoc.find("dvo/minDec").text) 158 MAXDEC = float(configDoc.find("dvo/maxDec").text) 159 logger.infoPair("Coordinates", "%.1f to %.1f RA, %.1f to %.1f Dec" % (MINRA, MAXRA, MINDEC, MAXDEC)) 160 except: 161 pass 162 163 164 logger.info("+----+------------------+---------------+-------------------+------------------+----------------+") 165 logger.info("|Type| batches per hour | last 24 hours | per day this week | total detections | last published |") 166 logger.info("+----+------------------+---------------+-------------------+------------------+----------------+") 167 rateP2 = printStats("P2") 168 rateST = printStats("ST") 169 logger.info("+----+------------------+---------------+-------------------+------------------+----------------+") 170 125 171 logger.info("") 126 172 … … 135 181 sys.stdout.write("|\n") 136 182 writetableSeparator(colCount) 137 p rintTableRow(stages, "P2")138 p rintTableRow(stages, "ST")183 pendP2Processed = printTableRow(stages, "P2") 184 pendSTProcessed = printTableRow(stages, "ST") 139 185 writetableSeparator(colCount) 140 186 187 logger.info("") 188 try: logger.infoPair("Estimated time for P2s", "%.1f hours" % (pendP2Processed / rateP2)) 189 except: pass 190 try: logger.infoPair("Estimated time for STs", "%.1f hours" % (pendSTProcessed / rateST)) 191 except: pass
Note:
See TracChangeset
for help on using the changeset viewer.
