IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32092


Ignore:
Timestamp:
Aug 12, 2011, 4:07:06 PM (15 years ago)
Author:
rhenders
Message:

now reporting much more information, specifically, the ODM status (merge-worthy, merged etc); using new logging method from pslogger; printing processed and pending in table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/metrics.py

    r32002 r32092  
    1212from gpc1db import Gpc1Db
    1313
     14'''
     15Prepares a string of the format:
    1416
     17n-processed(n-pending)
    1518
     19'''
     20def prepareStr(prevList, thisList):
     21
     22     unsuccessful = list(set(prevList) - set(thisList))
     23
     24     str = "%d" % len(thisList)
     25     if len(unsuccessful) > 0: str = str + "(%d)" % len(unsuccessful)
     26
     27     return str
     28
     29'''
     30Prints (to the log) one row of data (one row being one batch-type)
     31'''
    1632def printTableRow(batchType):
    1733
    18     allIDs = gpc1Db.getIDsInThisDVODbForThisStage(dvoGpc1Label, batchType)
    19     processedIDs = ippToPspsDb.getProcessedIDsForThisStage(batchType, epoch, dvoGpc1Label)
    20     failedIDs = ippToPspsDb.getFailedBatches(batchType, epoch, dvoGpc1Label)
    21     unprocessedIDs = list(set(allIDs) - set(processedIDs))
     34    allIDs = gpc1Db.getIDsInThisDVODbForThisStage(DVOLABEL, batchType)
     35    processedIDs = ippToPspsDb.getProcessedIDs(batchType, EPOCH, DVOLABEL)
     36    datastoreIDs = ippToPspsDb.getloadedToDatastoreIDs(batchType, EPOCH, DVOLABEL)
     37    loadedToODMIDs = ippToPspsDb.getLoadedToODMIDs(batchType, EPOCH, DVOLABEL)
     38    mergeWorthyIDs = ippToPspsDb.getMergeWothyIDs(batchType, EPOCH, DVOLABEL)
     39    mergedIDs = ippToPspsDb.getMergedIDs(batchType, EPOCH, DVOLABEL)
    2240
    23     logger.info("|  %2s  |  %7d     |  %7d        |   %7d    | %7d    | %6.1f hours ago |" % (
     41    logger.info("|  %2s  |  %-12d  |  %-12s  |  %-12s  |  %-12s  |  %-12s  |  %-12s  |  %-12s  |  %-19s |" % (
    2442                batchType,
    2543                len(allIDs),
    26                 len(processedIDs),
    27                 len(list(set(failedIDs) - set(processedIDs))),
    28                 len(unprocessedIDs),
    29                 ippToPspsDb.getLastBatchPublished(batchType)))
     44                prepareStr(allIDs, processedIDs),
     45                prepareStr(processedIDs, datastoreIDs),
     46                prepareStr(datastoreIDs, loadedToODMIDs),
     47                prepareStr(loadedToODMIDs, mergeWorthyIDs),
     48                prepareStr(mergeWorthyIDs, mergedIDs),
     49                len(list(set(allIDs) - set(mergedIDs))),
     50                ippToPspsDb.getTimeOfLastBatchPublished(batchType, EPOCH, DVOLABEL)))
    3051
    3152
     
    3354Start of program.
    3455'''
    35 
    3656if len(sys.argv) > 1: CONFIG  = sys.argv[1]
    3757else:
     
    4262configDoc = ElementTree(file=CONFIG)
    4363
    44 
    45 logging.config.fileConfig("logging.conf")
    4664logging.setLoggerClass(PSLogger)
    47 logger = logging.getLogger("ippToPspsLog")
    48 logger.setLevel(logging.INFO)
     65logger = logging.getLogger("metrics")
     66logger.setup(configDoc, "metrics")
    4967
    5068ippToPspsDb = IppToPspsDb(logger, configDoc)
    5169gpc1Db = Gpc1Db(logger, configDoc)
    5270
    53 epoch = configDoc.find("options/epoch").text
    54 dvoGpc1Label = configDoc.find("dvo/gpc1Label").text
     71DVOLABEL = configDoc.find("dvo/gpc1Label").text
     72EPOCH = configDoc.find("options/epoch").text
    5573
    56 logger.info("Loading epoch  " + epoch)
    57 logger.info("+------+--------------+-----------------+--------------+------------+------------------+")
    58 logger.info("| Type | Total in DVO | Total published | Total failed | Total left |  Last published  |")
    59 logger.info("+------+--------------+-----------------+--------------+------------+------------------+")
     74logger.infoTitle("ippToPsps loading summary")
     75logger.infoPair("Loading epoch", EPOCH)
     76logger.infoPair("DVO label", DVOLABEL)
     77logger.info("")
     78logger.info("+------+----------------+----------------+----------------+----------------+----------------+----------------+----------------+----------------------+")
     79logger.info("| Type |  Total in DVO  |   Processed    |  On datastore  | Loaded to ODM  |  Merge-worthy  |     Merged     |  Total missing |    Last published    |")
     80logger.info("+------+----------------+----------------+----------------+----------------+----------------+----------------+----------------+----------------------+")
    6081printTableRow("P2")
    6182printTableRow("ST")
    62 logger.info("+------+--------------+-----------------+--------------+------------+------------------+")
     83logger.info("+------+----------------+----------------+----------------+----------------+----------------+----------------+----------------+----------------------+")
    6384
    6485#logger.info("Total batches published      %d" % totalP2Published)
    6586#logger.info("Total batches left           %d" % (totalP2 - totalP2Published))
    66 #logger.info("Total failed batches         %d" % ippToPspsDb.getTotalFailedBatches("P2", epoch))
    67 #logger.info("Average time per batch       %.2f minutes" % ippToPspsDb.getAverageTimePerBatch("P2", epoch))
     87#logger.info("Total failed batches         %d" % ippToPspsDb.getTotalFailedBatches("P2", EPOCH))
     88#logger.info("Average time per batch       %.2f minutes" % ippToPspsDb.getAverageTimePerBatch("P2", EPOCH))
    6889#logger.info("Last published               %.2f hours ago" % ippToPspsDb.getLastBatchPublished("P2"))
    69 #logger.info("Average batches per day      %.2f" % ippToPspsDb.getBatchesPerDay("P2", epoch))
     90#logger.info("Average batches per day      %.2f" % ippToPspsDb.getBatchesPerDay("P2", EPOCH))
    7091#logger.info("-----------------------------------------------------")
    7192
Note: See TracChangeset for help on using the changeset viewer.