gapi.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:gce-manager 作者: binary-com 项目源码 文件源码
def wait_for_operation(self, zone, op_response, retry_count=MAX_API_RETRY_COUNT):
        try:
            while True and op_response is not None:
                compute = discovery.build(API_TYPE, API_VERSION, credentials=self.config.credentials)
                result = compute.zoneOperations().get(project=self.config.PROJECT_ID, zone=zone, operation=op_response['name']).execute()

                if result['status'] == 'DONE' or self.abort_all:
                    return result['status']
                else:
                    time.sleep(1)
        except Exception, exception:
            if retry_count > 0 and not self.abort_all:
                self._log(API_RETRY_MESSAGE % (sys._getframe().f_code.co_name, exception))
                return self.wait_for_operation(zone, op_response, (retry_count - 1))
            else:
                self._log(API_MAX_RETRY_NESSAGE % (sys._getframe().f_code.co_name, MAX_API_RETRY_COUNT, exception))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号