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


Python eventlet.green方法代码示例

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


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

示例1: report

# 需要导入模块: import eventlet [as 别名]
# 或者: from eventlet import green [as 别名]
def report(self, autocolor=True):
        total = 0
        errors = []
        for r in self.traversal:
            total += 1
            if r.is_leaf_error():
                exc = r.exception[1]
                indent = "  "
                if getattr(exc, "report_traceback", True):
                    tb = "\n\n" + r.get_traceback().strip()
                    errors.append("%s%s: unexpected error%s" % (indent, r.executor.name,
                                                                tb.replace("\n", "\n  " + indent)))
                else:
                    errors.append("%s%s: %s" % (indent, r.executor.context, exc))

        if autocolor:
            if errors:
                color = self.terminal.bold_red
            else:
                color = self.terminal.green
        else:
            color = lambda x: x

        result = "\n".join(["%s tasks run, %s errors" % (total, len(errors))] + errors)

        return "\n".join([color(line) for line in result.splitlines()]) 
开发者ID:datawire,项目名称:forge,代码行数:28,代码来源:executor.py

示例2: _single_run

# 需要导入模块: import eventlet [as 别名]
# 或者: from eventlet import green [as 别名]
def _single_run(self, application, sock):
        """Start a WSGI server in a new green thread."""
        LOG.info("Starting single process server")
        eventlet.wsgi.server(sock, application, custom_pool=self.pool,
                             log=self._wsgi_logger,
                             debug=False,
                             keepalive=CONF.api.http_keepalive) 
开发者ID:openstack,项目名称:searchlight,代码行数:9,代码来源:wsgi.py

示例3: test_hang

# 需要导入模块: import eventlet [as 别名]
# 或者: from eventlet import green [as 别名]
def test_hang(testdir):
    p = py.path.local(__file__).dirpath("conftest.py")
    p.copy(testdir.tmpdir.join(p.basename))
    testdir.makepyfile(
        """
        import pytest
        from eventlet.green import time
        @pytest.mark.timeout(0.01)
        def test_hang():
            time.sleep(3.0)
    """
    )
    result = testdir.runpytest()
    assert "failed to timeout" not in result.stdout.str()
    result.stdout.fnmatch_lines(["*Timeout: 0.01*"]) 
开发者ID:tox-dev,项目名称:detox,代码行数:17,代码来源:conftest.py

示例4: _single_run

# 需要导入模块: import eventlet [as 别名]
# 或者: from eventlet import green [as 别名]
def _single_run(self, application, sock):
        """Start a WSGI server in a new green thread."""

        LOG.info("Starting single process server")
        eventlet.wsgi.server(sock, application, custom_pool=self.pool,
                             url_length_limit=URL_LENGTH_LIMIT,
                             log=self._logger, debug=cfg.CONF.debug) 
开发者ID:openstack,项目名称:senlin,代码行数:9,代码来源:wsgi.py


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