Changeset 32110
- Timestamp:
- Aug 16, 2011, 1:14:22 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/metrics.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/metrics.py
r32092 r32110 3 3 import smtplib 4 4 import sys 5 import os 5 6 6 7 from java.lang import Math … … 13 14 14 15 ''' 16 Makes a gnuplot of the data 17 ''' 18 def plotMe(batchType, file): 19 20 OUTPUTFILE = DVOLABEL + "_" + batchType + ".png" 21 f=os.popen('gnuplot', 'w') 22 23 if 0: 24 TERM = "X11" 25 else: 26 TERM = "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8" 27 28 print >> f, "set term " + TERM + "; \ 29 set output \"" + OUTPUTFILE + "\"; \ 30 set title \"ippToPsps : " + batchType + " loading for " + DVOLABEL + "\"; \ 31 set boxwidth; \ 32 set xtic rotate by -90 scale 0; \ 33 set style data histogram; \ 34 set style histogram rowstacked; \ 35 set style fill solid border -1; \ 36 set ylabel \"Items processed per loading stage\"; \ 37 set boxwidth 0.75; \ 38 plot '" + file + "' using 2:xtic(1) notitle lt 2, '' using 3 notitle lt 1, '' using 4 notitle lt rgb \"#808080\"" 39 40 f.flush() 41 42 ''' 15 43 Prepares a string of the format: 16 44 … … 18 46 19 47 ''' 20 def prepareStr( prevList, thisList):48 def prepareStr(masterList, prevList, thisList, FILE, name): 21 49 22 unsuccessful = list(set(prevList) - set(thisList))50 unsuccessful = list(set(prevList) - set(thisList)) 23 51 24 str = "%d" % len(thisList) 25 if len(unsuccessful) > 0: str = str + "(%d)" % len(unsuccessful) 52 countTotal = len(masterList) 53 countSuccessful = len(thisList) 54 countUnsuccessful = len(unsuccessful) 26 55 27 return str 56 str = "%d" % countSuccessful 57 if countUnsuccessful: str = str + "(%d)" % countUnsuccessful 58 59 print >> FILE, name, countSuccessful, countUnsuccessful, (countTotal - countSuccessful - countUnsuccessful) 60 #;sys.stdout.softspace=0; 61 return str 28 62 29 63 ''' … … 39 73 mergedIDs = ippToPspsDb.getMergedIDs(batchType, EPOCH, DVOLABEL) 40 74 75 tempFilename = batchType + '.dat' 76 DATFILE = open(tempFilename,'w') 77 prepareStr(allIDs, allIDs, allIDs, DATFILE, "inDVO"), 78 41 79 logger.info("| %2s | %-12d | %-12s | %-12s | %-12s | %-12s | %-12s | %-12s | %-19s |" % ( 42 80 batchType, 43 81 len(allIDs), 44 prepareStr(allIDs, processedIDs),45 prepareStr( processedIDs, datastoreIDs),46 prepareStr( datastoreIDs, loadedToODMIDs),47 prepareStr( loadedToODMIDs, mergeWorthyIDs),48 prepareStr( mergeWorthyIDs, mergedIDs),82 prepareStr(allIDs, allIDs, processedIDs, DATFILE, "processed"), 83 prepareStr(allIDs, processedIDs, datastoreIDs, DATFILE, "onDatastore"), 84 prepareStr(allIDs, datastoreIDs, loadedToODMIDs, DATFILE, "loadedToODM"), 85 prepareStr(allIDs, loadedToODMIDs, mergeWorthyIDs, DATFILE, "MergeWorthy"), 86 prepareStr(allIDs, mergeWorthyIDs, mergedIDs, DATFILE, "Merged"), 49 87 len(list(set(allIDs) - set(mergedIDs))), 50 88 ippToPspsDb.getTimeOfLastBatchPublished(batchType, EPOCH, DVOLABEL))) 51 89 90 plotMe(batchType, tempFilename) 91 DATFILE.close() 92 #os.remove(tempFilename) 52 93 53 94 ''' … … 83 124 logger.info("+------+----------------+----------------+----------------+----------------+----------------+----------------+----------------+----------------------+") 84 125 85 #logger.info("Total batches published %d" % totalP2Published)86 #logger.info("Total batches left %d" % (totalP2 - totalP2Published))87 #logger.info("Total failed batches %d" % ippToPspsDb.getTotalFailedBatches("P2", EPOCH))88 #logger.info("Average time per batch %.2f minutes" % ippToPspsDb.getAverageTimePerBatch("P2", EPOCH))89 #logger.info("Last published %.2f hours ago" % ippToPspsDb.getLastBatchPublished("P2"))90 #logger.info("Average batches per day %.2f" % ippToPspsDb.getBatchesPerDay("P2", EPOCH))91 #logger.info("-----------------------------------------------------")92 126 93 127
Note:
See TracChangeset
for help on using the changeset viewer.
