def read(self,stream,addr): try: data = yield stream.read_until('\r\n') data = data[:-2] if util.unserial(data)=={"Register":True}: self.NodeList[addr]=stream self.nodes = cycle(self.NodeList) print 'new Node Comes',addr,'\n' else: taskid,data = util.unserial(data) self.tasks[taskid].splitsRes.append(data) except Exception,e: self.closeSocket(stream, addr)
def read(self, stream, addr): try: data = yield stream.read_until('\r\n') data = data[:-2] if util.unserial(data) == {"Register": True}: self.NodeList[addr] = stream self.nodes = cycle(self.NodeList) print 'new Node Comes', addr, '\n' else: taskid, data = util.unserial(data) self.tasks[taskid].splitsRes.append(data) except Exception, e: self.closeSocket(stream, addr)
def compute_queue(self): if self.task_queue: try: taskid, data, dependencies = util.unserial(self.task_queue.pop(0)) result = (taskid, self.rdd_compute(data, dependencies)) self.result_queue.append(result) except Exception, e: print "Compute Err", e traceback.print_exc()
def compute_queue(self): if self.task_queue: try: taskid, data ,dependencies = util.unserial(self.task_queue.pop(0)) result = (taskid, self.rdd_compute(data, dependencies)) self.result_queue.append(result) except Exception,e: print 'Compute Err',e traceback.print_exc()