IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32655


Ignore:
Timestamp:
Nov 10, 2011, 4:00:22 PM (15 years ago)
Author:
rhenders
Message:

Neatened this up so that the 'all' option will sequentially check unloaded, unmergeworthy and unmerged batches, thus reducing the risk of polling the same batch twice

File:
1 edited

Legend:

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

    r32542 r32655  
    1717Method to actually poll ODM
    1818'''
    19 def poll(batchType):
     19def poll(batchType, stage):
    2020 
     21    if stage == "unloaded":
     22        ids = ippToPspsDb.getUnloadedBatchIDs(EPOCH, DVOLABEL, batchType)
     23    elif stage == "unmergeworthy":
     24        ids = ippToPspsDb.getUnmergeWorthyBatchIDs(EPOCH, DVOLABEL, batchType)
     25    elif stage == "unmerged":
     26        ids = ippToPspsDb.getUnmergedBatchIDs(EPOCH, DVOLABEL, batchType)
    2127
    22     lookingForUnloaded = 0
    23     lookingForUnmergeworthy = 0
    24     lookingForUnmerged = 0
    25     lookingForAll = 0
    26 
    27     if TYPE == "unloaded":
    28         lookingForUnloaded = 1
    29         ids = ippToPspsDb.getUnloadedBatchIDs(EPOCH, DVOLABEL, batchType)
    30     elif TYPE == "unmergeworthy":
    31         lookingForUnmergeworthy = 1
    32         ids = ippToPspsDb.getUnmergeWorthyBatchIDs(EPOCH, DVOLABEL, batchType)
    33     elif TYPE == "unmerged":
    34         lookingForUnmerged = 1
    35         ids = ippToPspsDb.getUnmergedBatchIDs(EPOCH, DVOLABEL, batchType)
    36     elif TYPE == "unfinished":
    37         lookingForAll = 1
    38         ids = ippToPspsDb.getAllUnfinishedBatchIDs(EPOCH, DVOLABEL, batchType)
    39 
    40     logger.infoTitle("Checking %d %s %s batches" % (len(ids), TYPE, batchType))
     28    logger.infoTitle("Checking %d %s %s batches" % (len(ids), stage, batchType))
    4129
    4230    results = {}
     
    5341           ippToPspsDb.updateOdmStatus(id, results)
    5442
    55            if lookingForUnloaded:
     43           if stage == "unloaded":
    5644               if results['LOADEDTOODM'] == 1: newLoaded = newLoaded + 1
    5745               if results['MERGEWORTHY'] == 1: newMergeWorthy = newMergeWorthy + 1
    5846               if results['MERGED'] == 1: newMerged = newMerged + 1
    5947
    60            elif lookingForUnmergeworthy:
     48           elif stage == "unmergeworthy":
    6149               if results['MERGEWORTHY'] == 1: newMergeWorthy = newMergeWorthy + 1
    6250               if results['MERGED'] == 1: newMerged = newMerged + 1
    6351
    64            elif lookingForUnmerged:
     52           elif stage == "unmerged":
    6553               if results['MERGED'] == 1: newMerged = newMerged + 1
    6654
     
    8876    CONFIG  = sys.argv[1]
    8977    BATCHTYPE = sys.argv[2]
    90     TYPE = sys.argv[3]
     78    STAGE = sys.argv[3]
    9179else:
    92     print "\n** Usage: " + sys.argv[0] + " <configPath> <P2|ST|all> <unloaded|unmergeworthy|unmerged|unfinished> [hours]\n"
     80    print "\n** Usage: " + sys.argv[0] + " <configPath> <P2|ST|all> <unloaded|unmergeworthy|unmerged|all> [hours]\n"
    9381    sys.exit(1)
    9482
     
    113101EPOCH = configDoc.find("options/epoch").text
    114102
     103if STAGE == "all": stages = ['unloaded', 'unmergeworthy', 'unmerged']
     104else: stages = [STAGE]
     105
     106if BATCHTYPE == "all": batchTypes = ['P2', 'ST']
     107else: batchTypes = [BATCHTYPE]
     108
     109for stage in stages: logger.infoPair("Checking stage", stage)
     110for batchType in batchTypes: logger.infoPair("Checking batch type", batchType)
     111
    115112while True:
    116113
    117     if BATCHTYPE == "all":
    118         poll("P2")
    119         poll("ST")
    120     else:   
    121         poll(BATCHTYPE)
     114    for stage in stages:
     115        for batchType in batchTypes:
     116            poll(batchType, stage)
    122117
    123118    if SECONDS:
Note: See TracChangeset for help on using the changeset viewer.