示例#1
0
 def test_block_detect(self):
     def look_im_blocking():
         import time
         time.sleep(2)
     from eventlet import debug
     debug.hub_blocking_detection(True)
     gt = eventlet.spawn(look_im_blocking)
     self.assertRaises(RuntimeError, gt.wait)
     debug.hub_blocking_detection(False)
def pytest_configure(config):
    if config.option.blocking_detection:
        from eventlet import debug
        debug.hub_blocking_detection(True)

    log_level = config.getoption('log_level')
    if log_level is not None:
        log_level = getattr(logging, log_level)
        logging.basicConfig(level=log_level, stream=sys.stderr)
示例#3
0
 def test_block_detect(self):
     def look_im_blocking():
         import time
         time.sleep(2)
     from eventlet import debug
     debug.hub_blocking_detection(True)
     gt = eventlet.spawn(look_im_blocking)
     self.assertRaises(RuntimeError, gt.wait)
     debug.hub_blocking_detection(False)
示例#4
0
def pytest_configure(config):
    if config.option.blocking_detection:
        from eventlet import debug
        debug.hub_blocking_detection(True)

    log_level = config.getoption('log_level')
    if log_level is not None:
        log_level = getattr(logging, log_level)
        logging.basicConfig(level=log_level, stream=sys.stderr)
示例#5
0
    def test_block_detect_with_itimer(self):
        def look_im_blocking():
            import time
            time.sleep(0.5)

        from eventlet import debug
        debug.hub_blocking_detection(True, resolution=0.1)
        gt = eventlet.spawn(look_im_blocking)
        self.assertRaises(RuntimeError, gt.wait)
        debug.hub_blocking_detection(False)
示例#6
0
    def test_block_detect_with_itimer(self):
        def look_im_blocking():
            import time
            time.sleep(0.5)

        from eventlet import debug
        debug.hub_blocking_detection(True, resolution=0.1)
        gt = eventlet.spawn(look_im_blocking)
        self.assertRaises(RuntimeError, gt.wait)
        debug.hub_blocking_detection(False)
示例#7
0
def pytest_configure(config):
    # monkey patch an encoding attribute onto GreenPipe to
    # satisfy a pytest assertion
    import py
    from eventlet.greenio import GreenPipe
    GreenPipe.encoding = py.std.sys.stdout.encoding

    if config.option.blocking_detection:
        from eventlet import debug
        debug.hub_blocking_detection(True)

    log_level = config.getoption('log_level')
    if log_level is not None:
        log_level = getattr(logging, log_level)
        logging.basicConfig(level=log_level, stream=sys.stderr)
示例#8
0
def pytest_configure(config):
    # monkey patch an encoding attribute onto GreenPipe to
    # satisfy a pytest assertion
    import py
    from eventlet.greenio import GreenPipe
    GreenPipe.encoding = py.std.sys.stdout.encoding

    if config.option.blocking_detection:
        from eventlet import debug
        debug.hub_blocking_detection(True)

    log_level = config.getoption('log_level')
    if log_level is not None:
        log_level = getattr(logging, log_level)
        logging.basicConfig(level=log_level, stream=sys.stderr)
示例#9
0
文件: pytest.py 项目: hedin/nameko
def pytest_configure(config):
    if config.option.blocking_detection:  # pragma: no cover
        from eventlet import debug
        debug.hub_blocking_detection(True)
示例#10
0
def pytest_configure(config):
    if config.option.blocking_detection:  # pragma: no cover
        from eventlet import debug
        debug.hub_blocking_detection(True)
示例#11
0
文件: daemon.py 项目: UfSoft/EvAFM
# -*- coding: utf-8 -*-
"""
    evafm.core.daemon
    ~~~~~~~~~~~~~~~~~


    :copyright: © 2011 UfSoft.org - Pedro Algarvio ([email protected])
    :license: BSD, see LICENSE for more details.
"""

from eventlet.hubs import use_hub, get_hub
import eventlet
import time
use_hub('zeromq')
from eventlet import debug
debug.hub_blocking_detection(True, 0.3)

import logging
import giblets.search
from giblets import ComponentManager
from evafm.common.daemonbase import BaseDaemon, BaseOptionParser


class Daemon(BaseDaemon):

    def prepare(self):
        super(Daemon, self).prepare()
        self.mgr = ComponentManager()
        giblets.search.find_plugins_by_entry_point("evafm.core.checkers")
        from evafm.core.core import Core
        self.core = Core(self.mgr)