当前位置: 首页>>代码示例>>Python>>正文


Python eventlet.Timeout类代码示例

本文整理汇总了Python中eventlet.Timeout的典型用法代码示例。如果您正苦于以下问题:Python Timeout类的具体用法?Python Timeout怎么用?Python Timeout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Timeout类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: read_with_timeout

    def read_with_timeout(self, size):
        timeout = Timeout(self.timeout)
        try:
            chunk = os.read(self.obj_data, size)
        except Timeout as t:
            if t is timeout:
                self.close()
                raise t
        except Exception as e:
            self.close()
            raise e
        finally:
            timeout.cancel()

        return chunk
开发者ID:ajiang38740,项目名称:swift-storlets,代码行数:15,代码来源:storlet_handler.py

示例2: _call

    def _call(self, method_name, timeout_sec, **kwargs):
        LOG.debug("Calling %s" % method_name)

        timeout = Timeout(timeout_sec)
        try:
            result = rpc.call(self.context, self._get_routing_key(),
                              {'method': method_name, 'args': kwargs})
            LOG.debug("Result is %s" % result)
            return result
        except Exception as e:
            LOG.error(e)
            raise exception.GuestError(original_message=str(e))
        except Timeout as t:
            if t is not timeout:
                raise
            else:
                raise exception.GuestTimeout()
        finally:
            timeout.cancel()
开发者ID:hub-cap,项目名称:reddwarf_lite,代码行数:19,代码来源:api.py

示例3: poll_response

    def poll_response(self, response):
        """
        The API might return a job nr in the response in case of a async
        response: https://github.com/fog/fog/issues/575
        """
        status = response.status

        timeout = Timeout(CONF[CFG_GROUP].job_timeout)
        try:
            while status == 307:
                time.sleep(1)
                url = response.headers.get('Location')
                LOG.debug("Polling %s" % url)

                polled_response = self.get(url)
                status = response.status
        except Timeout as t:
            if t == timeout:
                raise DynTimeoutError('Timeout reached when pulling job.')
        finally:
            timeout.cancel()
        return polled_response
开发者ID:CingHu,项目名称:designate,代码行数:22,代码来源:impl_dynect.py

示例4: __str__

 def __str__(self):
     return '%s: %s' % (Timeout.__str__(self), self.msg)
开发者ID:mahak,项目名称:swift,代码行数:2,代码来源:exceptions.py

示例5: __init__

 def __init__(self, seconds=None, msg=None):
     Timeout.__init__(self, seconds=seconds)
     self.msg = msg
开发者ID:mahak,项目名称:swift,代码行数:3,代码来源:exceptions.py


注:本文中的eventlet.Timeout类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。