def taskList_action(self, data):
     list = Task.get_all_task()
     result = []
     for task in list:
         task_dict = task.__dict__
         task_dict["agentList"] = []
         for agent in task.get_all_agent():
             agent_dict = agent.__dict__
             agent_dict["heartbeat"] = agent.heartbeat()
             task_dict["agentList"].append(agent_dict)
         result.append(task_dict)
     self.res['res'] = result
     return json.dumps(self.res)
Exemplo n.º 2
0
    def run(self, *args):
        dead_agents = []
        task_list = Task.get_all_task()
        for taskObj in task_list:
            agent_list = taskObj.get_all_agent()
            for agentObj in agent_list:
                if not agentObj.heartbeat():
                    dead_agents.append(agentObj)

        if len(dead_agents) == 0:
            logging.debug("[Exit]CheckACPActiveAgents...success")
            return Success("CheckACPActiveAgents...success.")
        else:
            logging.debug("[Exit]CheckACPActiveAgents...failure")
            result = Failure(self.failureMessage(dead_agents))
            info = {"dead_agents": dead_agents}
            result.info = info
            return result