def processItems(self): crs = CachedResultSet(crsName) crs.restart() crsi = CachedResultSetIterator.wrapResultSet(crs) while crsi.hasNext(): rs = crsi.next() if str(rs.getLong(1)) in self.myList: # at this point, we have a match! get to work self.processItem(rs) # now make sure our queue is empty... if it isn't, we failed validation for unfoundItem in self.myList: printErrorToRemigrate(unfoundItem, "Message passed in via command line file but NOT found in the CachedResultSet!")
def getNumItemsInJob(self,purgeId,spoolDir): crs = CachedResultSet(File(spoolDir),32768,False,str(purgeId)); crs.setAllowPartialMatch(True) try: crs.restart() items = 0 while crs.next(): items = items + 1 return items finally: crs.close()
for i in range(numThreads): threadQueue = ConcurrentLinkedQueue() wThread = WorkerThread("Thread" + str(i), threadQueue) wThread.start() threadList.append(wThread) # start a PrintThread printThread = PrintThread(printQueue) printThread.start() infile = open(idFile,'r') index = old_index = 0 runningCount = 0 queueToBuild = [] crs = CachedResultSet(crsName) crs.restart() crsi = CachedResultSetIterator.wrapResultSet(crs) rs = crsi.next() for line in infile: # first advance pointer thru CRS while rs.getLong(1) < long(str.strip(line)): if crsi.hasNext(): rs = crsi.next() else: # if we get here, we're looking for something in the file that is greater # than anything in the CRS. This means failure. print message below continue # next, see if they now match. if they do, get to work. if not, throw an error if rs.getLong(1) == long(str.strip(line)):