Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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()
Exemplo n.º 4
0
 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()