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')
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
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)])
def _actualize_task_tornado(self, msg): """Auxiliary function of _actualize_task using tornado sockets.""" self._actualize_task(uncode(msg[0]))