def delete(self, server_task, subtask): """Delete the data in the database associated with the server_task and subtask. Publish the message to finish the task.""" if subtask: name_task = code_new_task(server_task, subtask) else: name_task = server_task self.redis_manager.tasks_pub.send(code_finish(name_task)) self.redis_manager.db_delete(map(lambda(x): code_output(name_task, x), range(self.num_output)))
def delete(self, server_task, subtask): """Delete the data in the database associated with the server_task and subtask. Publish the message to finish the task.""" if subtask: name_task = code_new_task(server_task, subtask) else: name_task = server_task self.redis_manager.tasks_pub.send(code_finish(name_task)) self.redis_manager.db_delete( map(lambda (x): code_output(name_task, x), range(self.num_output)))
def _new_code(self): """Create the code for a new task. The new code can't be an existing code.""" new = code_new_task(self.code, self.total_code) self.total_code += 1 return new