示例#1
0
    def run(self):
        pool = NodePool.get_instance()
        status = TaskStatus()

        # 10 times retry maximum until success
        for i in range(10):
            node = pool.get_node(self.timeout)
            status = node.execute(self.task)
            pool.return_node(node)

            if self.debug:
                print(status.to_json())

            if status.code == TaskStatus.CODE_EXECUTION_SUCCESS:
                if status.result is not None:
                    self.manager.append(status.result)
                break