Changeset 32694 for branches/eam_branches/ipp-20111110/ippToPsps
- Timestamp:
- Nov 17, 2011, 2:02:08 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20111110
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippToPsps/jython/ipptopspsdb.py (modified) (1 diff)
-
ippToPsps/jython/pollOdm.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111110
- Property svn:mergeinfo changed
/trunk (added) merged: 32650,32652-32656,32658,32665-32666,32668-32669,32671,32674,32676,32678,32680-32682,32687
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20111110/ippToPsps/jython/ipptopspsdb.py
r32580 r32694 125 125 126 126 self.logger.debug("Found %d processed but-not-on-datastore items" % len(ids)) 127 128 return ids129 130 '''131 Returns a list of processed batch IDs that either not yet loaded to the ODM or not merge_worthy or not merged132 NOTE we exclude batches already deleted from the datastore, as sometimes we delete stuff prior to loading to ODM if there is a known problem with the batch133 '''134 def getAllUnfinishedBatchIDs(self, epoch, dvoGpc1Label, batchType):135 136 sql = "SELECT batch_id \137 FROM batch \138 WHERE timestamp > '" + epoch + "' \139 AND dvo_db = '" + dvoGpc1Label + "' \140 AND loaded_to_datastore = 1 \141 AND batch_type = '" + batchType + "' \142 AND deleted_datastore = 0 \143 AND loaded_to_ODM != -1 \144 AND merge_worthy != -1 \145 AND merged = 0"146 147 ids = []148 try:149 rs = self.executeQuery(sql)150 while (rs.next()):151 ids.append(rs.getInt(1))152 except:153 self.logger.exception("Can't query for unloaded batch ids in ipptopsps Db")154 155 rs.close()156 157 self.logger.debug("Found %d unloaded items" % len(ids))158 127 159 128 return ids -
branches/eam_branches/ipp-20111110/ippToPsps/jython/pollOdm.py
r32542 r32694 17 17 Method to actually poll ODM 18 18 ''' 19 def poll(batchType ):19 def poll(batchType, stage): 20 20 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) 21 27 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)) 41 29 42 30 results = {} … … 53 41 ippToPspsDb.updateOdmStatus(id, results) 54 42 55 if lookingForUnloaded:43 if stage == "unloaded": 56 44 if results['LOADEDTOODM'] == 1: newLoaded = newLoaded + 1 57 45 if results['MERGEWORTHY'] == 1: newMergeWorthy = newMergeWorthy + 1 58 46 if results['MERGED'] == 1: newMerged = newMerged + 1 59 47 60 elif lookingForUnmergeworthy:48 elif stage == "unmergeworthy": 61 49 if results['MERGEWORTHY'] == 1: newMergeWorthy = newMergeWorthy + 1 62 50 if results['MERGED'] == 1: newMerged = newMerged + 1 63 51 64 elif lookingForUnmerged:52 elif stage == "unmerged": 65 53 if results['MERGED'] == 1: newMerged = newMerged + 1 66 54 … … 88 76 CONFIG = sys.argv[1] 89 77 BATCHTYPE = sys.argv[2] 90 TYPE = sys.argv[3]78 STAGE = sys.argv[3] 91 79 else: 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" 93 81 sys.exit(1) 94 82 … … 113 101 EPOCH = configDoc.find("options/epoch").text 114 102 103 if STAGE == "all": stages = ['unloaded', 'unmergeworthy', 'unmerged'] 104 else: stages = [STAGE] 105 106 if BATCHTYPE == "all": batchTypes = ['P2', 'ST'] 107 else: batchTypes = [BATCHTYPE] 108 109 for stage in stages: logger.infoPair("Checking stage", stage) 110 for batchType in batchTypes: logger.infoPair("Checking batch type", batchType) 111 115 112 while True: 116 113 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) 122 117 123 118 if SECONDS:
Note:
See TracChangeset
for help on using the changeset viewer.
