IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 8, 2011, 2:44:12 PM (15 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20110906
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110906

  • branches/eam_branches/ipp-20110906/ippToPsps/jython/metrics.py

    r32354 r32630  
    5252
    5353    # 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)
    5558    prevList = allIDs
    5659    numEverything = len(allIDs)
     
    7376       numPending = len(pending)
    7477
     78       #if stage == 'merge_worthy' and batchType == "P2":
     79       #    for n in pending: print n
     80
    7581       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))
    7682       sys.stdout.write("|%-19s" % str)
     
    7985       print >> DATFILE, stage, numSuccess, numFail, numPending
    8086
     87       if stage == 'processed': numPendingProcessed = numPending
     88
    8189    sys.stdout.write("|\n")
    8290    plotMe(batchType, tempFilename)
    8391    DATFILE.close()
     92
     93    return numPendingProcessed
    8494
    8595'''
     
    91101    for i in range(0, colCount): sys.stdout.write("+-------------------")
    92102    sys.stdout.write("+\n")
     103
     104'''
     105Prints various timing stats for this batch type
     106'''
     107def 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
    93120
    94121'''
     
    112139gpc1Db = Gpc1Db(logger, configDoc)
    113140
     141MINRA = None
     142MAXRA = None
     143MINDEC = None
     144MAXDEC = None
     145
    114146DVOLABEL = configDoc.find("dvo/gpc1Label").text
    115147EPOCH = configDoc.find("options/epoch").text
     
    119151logger.infoPair("Loading epoch", EPOCH)
    120152logger.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
     154try:
     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))
     160except:
     161    pass
     162   
     163
     164logger.info("+----+------------------+---------------+-------------------+------------------+----------------+")
     165logger.info("|Type| batches per hour | last 24 hours | per day this week | total detections | last published |")
     166logger.info("+----+------------------+---------------+-------------------+------------------+----------------+")
     167rateP2 = printStats("P2")
     168rateST = printStats("ST")
     169logger.info("+----+------------------+---------------+-------------------+------------------+----------------+")
     170
    125171logger.info("")
    126172
     
    135181sys.stdout.write("|\n")
    136182writetableSeparator(colCount)
    137 printTableRow(stages, "P2")
    138 printTableRow(stages, "ST")
     183pendP2Processed = printTableRow(stages, "P2")
     184pendSTProcessed = printTableRow(stages, "ST")
    139185writetableSeparator(colCount)
    140186
     187logger.info("")
     188try: logger.infoPair("Estimated time for P2s", "%.1f hours" % (pendP2Processed / rateP2))
     189except: pass
     190try: logger.infoPair("Estimated time for STs", "%.1f hours" % (pendSTProcessed / rateST))
     191except: pass
Note: See TracChangeset for help on using the changeset viewer.