예제 #1
0
파일: ventilator.py 프로젝트: pyople/pyople
 def _distribute_self_tasks(self):
     """Send the attribute 'tasks' to other instances."""
     if self.display:
         print('ventilator cleaning self tasks')
     self.subscribed_tasks = []
     tasks_distribute = {}
     for code, list_data in self.tasks.items():
         for actual_data in list_data:
             try:
                 tasks_distribute[actual_data].append(uncode(code))
             except KeyError:
                 tasks_distribute[actual_data] = [uncode(code)]
     for actual_data, list_code in tasks_distribute.items():
         actual_data.send_restore_task(list_code)
         self.from_clean.recv_multipart()
     self.tasks = {}
     if self.display:
         print('ventilator cleaned self tasks')
예제 #2
0
파일: ventilator.py 프로젝트: pyople/pyople
 def _distribute_self_tasks(self):
     """Send the attribute 'tasks' to other instances."""
     if self.display:
         print('ventilator cleaning self tasks')
     self.subscribed_tasks = []
     tasks_distribute = {}
     for code, list_data in self.tasks.items():
         for actual_data in list_data:
             try:
                 tasks_distribute[actual_data].append(uncode(code))
             except KeyError:
                 tasks_distribute[actual_data] = [uncode(code)]
     for actual_data, list_code in tasks_distribute.items():
         actual_data.send_restore_task(list_code)
         self.from_clean.recv_multipart()
     self.tasks = {}
     if self.display:
         print('ventilator cleaned self tasks')
예제 #3
0
 def _del_task(self, code):
     """Unsubscribe to the task of the code."""
     if self.display:
         print('recv del: ' + code)
     self.tasks_del.setsockopt(UNSUBSCRIBE, code)
     un_code = uncode(code)
     self.tasks_sub.setsockopt(UNSUBSCRIBE, code_resend(un_code))
     try:
         self.subscribed_tasks.remove(un_code)
     except ValueError:
         pass
예제 #4
0
파일: sink.py 프로젝트: pyople/pyople
 def _del_task(self, code):
     """Unsubscribe to the task of the code."""
     if self.display:
         print('recv del: ' + code)
     self.tasks_del.setsockopt(UNSUBSCRIBE, code)
     un_code = uncode(code)
     self.tasks_sub.setsockopt(UNSUBSCRIBE, code_resend(un_code))
     try:
         self.subscribed_tasks.remove(un_code)
     except ValueError:
         pass
예제 #5
0
 def _update_zero_depend(self, code):
     """Update a task created with _new_zero_task."""
     self.tasks_sub.setsockopt(UNSUBSCRIBE, code)
     self._update_depend([uncode(code)])
예제 #6
0
 def _actualize_task_tornado(self, msg):
     """Auxiliary function of _actualize_task using tornado sockets."""
     self._actualize_task(uncode(msg[0]))
예제 #7
0
 def _update_zero_depend(self, code):
     """Update a task created with _new_zero_task."""
     self.tasks_sub.setsockopt(UNSUBSCRIBE, code)
     self._update_depend([uncode(code)])
예제 #8
0
파일: sink.py 프로젝트: pyople/pyople
 def _actualize_task_tornado(self, msg):
     """Auxiliary function of _actualize_task using tornado sockets."""
     self._actualize_task(uncode(msg[0]))