def probeMainSecondaryMem(self, record, filedescriptor2, partition, timestage2): # Probe a record against its corresponding partition in secondary memory. file2 = open(filedescriptor2[partition].file.name, 'r') records2 = file2.readlines() timestamps = filedescriptor2[partition].timestamps dtsLast = float("inf") for record2 in records2: (tuple2, ats2, dts2) = record2.split('|') tuple2 = eval(tuple2) ats2 = int(ats2) dts2 = int(dts2) dtsLast = dts2 probedStage1 = False probedStage2 = False for v in self.vars: join = True if record.tuple[v] != tuple2[v]: join = False break if (join): # Check if the records were probed in stage 2. for pairTS in timestamps: (dtsLast, probeTS) = pairTS #if (isOverlapped((record.ats, record.dts), pairTS) and (record.dts >= pairTS[0])): #if ((record.dts <= probeTS) and (dts2 > probeTS) and (ats2 <= probeTS)): if ((dts2 <= probeTS) and (record.dts > probeTS) and (record.ats <= probeTS)): probedStage2 = True #print "Probed in stage 2:", (record.ats, record.dts), pairTS break # Check if the records were probed in Stage 1. if (isOverlapped((record.ats, record.dts), (ats2, dts2))): probedStage1 = True #print "Probed in stage1:", (record.ats, record.dts), (ats2, dts2) # Produce result if records have not been produced. if (not (probedStage1) and not (probedStage2)): res = record.tuple.copy() res.update(tuple2) self.qresults.put(res) #if (len(res)==5): print "Produced at:", timestage2, res, (record.ats, record.dts), timestamps, (ats2,dts2) file2.close() return dtsLast
def probeMainSecondaryMem(self, record, filedescriptor2, partition, timestage2): # Probe a record against its corresponding partition in secondary memory. file2 = open(filedescriptor2[partition].file.name, 'r') records2 = file2.readlines() timestamps = filedescriptor2[partition].timestamps dtsLast = float("inf") for record2 in records2: (tuple2, ats2, dts2) = record2.split('|') tuple2 = eval(tuple2) ats2 = int(ats2) dts2 = int(dts2) dtsLast = dts2 probedStage1 = False probedStage2 = False for v in self.vars: join = True if record.tuple[v] != tuple2[v]: join = False break if (join): # Check if the records were probed in stage 2. for pairTS in timestamps: (dtsLast, probeTS) = pairTS #if (isOverlapped((record.ats, record.dts), pairTS) and (record.dts >= pairTS[0])): #if ((record.dts <= probeTS) and (dts2 > probeTS) and (ats2 <= probeTS)): if ((dts2 <= probeTS) and (record.dts > probeTS) and (record.ats <= probeTS)): probedStage2 = True #print "Probed in stage 2:", (record.ats, record.dts), pairTS break # Check if the records were probed in Stage 1. if (isOverlapped((record.ats, record.dts), (ats2, dts2))): probedStage1 = True #print "Probed in stage1:", (record.ats, record.dts), (ats2, dts2) # Produce result if records have not been produced. if (not(probedStage1) and not(probedStage2)): res = record.tuple.copy() res.update(tuple2) self.qresults.put(res) #if (len(res)==5): print "Produced at:", timestage2, res, (record.ats, record.dts), timestamps, (ats2,dts2) file2.close() return dtsLast
def probeSecondarySecondaryMem(self, filedescriptor1, filedescriptor2): # Probe partitions in secondary memory. for partition in filedescriptor1.keys(): if (filedescriptor2.has_key(partition)): file1 = open(filedescriptor1[partition].file.name, 'r') records1 = file1.readlines() timestamps1 = filedescriptor1[partition].timestamps for record1 in records1: (tuple1, ats1, dts1) = record1.split('|') tuple1 = eval(tuple1) ats1 = int(ats1) dts1 = int(dts1) file2 = open(filedescriptor2[partition].file.name, 'r') records2 = file2.readlines() timestamps2 = filedescriptor2[partition].timestamps for record2 in records2: (tuple2, ats2, dts2) = record2.split('|') tuple2 = eval(tuple2) ats2 = int(ats2) dts2 = int(dts2) probedStage1 = False probedStage2 = False for v in self.vars: join = True if tuple1[v] != tuple2[v]: join = False break if (join): # Check if the records were probed in stage 2. for pairTS in timestamps1: (dtsLast, probeTS) = pairTS # (dts1 <= dtsLast) and if ((dts1 <= probeTS) and (dts2 > probeTS) and (ats2 <= probeTS)): probedStage2 = True break for pairTS in timestamps2: (dtsLast, probeTS) = pairTS #(dts2 <= dtsLast) and if ((dts2 <= probeTS) and (dts1 > probeTS) and (ats1 <= probeTS)): probedStage2 = True break # Check if the records were probed in Stage 1. if (isOverlapped((ats1, dts1), (ats2, dts2))): probedStage1 = True # Produce result if records have not been produced. if (not(probedStage1) and not(probedStage2)): res = tuple1.copy() res.update(tuple2) self.qresults.put(res) #if (len(res)==5): print "Produced Sec Sec!:", res, (ats1, dts1), (ats2,dts2), timestamps1, timestamps2 file2.close() file1.close()
def probeSecondarySecondaryMem(self, filedescriptor1, filedescriptor2): # Probe partitions in secondary memory. for partition in filedescriptor1.keys(): if (filedescriptor2.has_key(partition)): file1 = open(filedescriptor1[partition].file.name, 'r') records1 = file1.readlines() timestamps1 = filedescriptor1[partition].timestamps for record1 in records1: (tuple1, ats1, dts1) = record1.split('|') tuple1 = eval(tuple1) ats1 = int(ats1) dts1 = int(dts1) file2 = open(filedescriptor2[partition].file.name, 'r') records2 = file2.readlines() timestamps2 = filedescriptor2[partition].timestamps for record2 in records2: (tuple2, ats2, dts2) = record2.split('|') tuple2 = eval(tuple2) ats2 = int(ats2) dts2 = int(dts2) probedStage1 = False probedStage2 = False for v in self.vars: join = True if tuple1[v] != tuple2[v]: join = False break if (join): # Check if the records were probed in stage 2. for pairTS in timestamps1: (dtsLast, probeTS) = pairTS # (dts1 <= dtsLast) and if ((dts1 <= probeTS) and (dts2 > probeTS) and (ats2 <= probeTS)): probedStage2 = True break for pairTS in timestamps2: (dtsLast, probeTS) = pairTS #(dts2 <= dtsLast) and if ((dts2 <= probeTS) and (dts1 > probeTS) and (ats1 <= probeTS)): probedStage2 = True break # Check if the records were probed in Stage 1. if (isOverlapped((ats1, dts1), (ats2, dts2))): probedStage1 = True # Produce result if records have not been produced. if (not (probedStage1) and not (probedStage2)): res = tuple1.copy() res.update(tuple2) self.qresults.put(res) #if (len(res)==5): print "Produced Sec Sec!:", res, (ats1, dts1), (ats2,dts2), timestamps1, timestamps2 file2.close() file1.close()