コード例 #1
0
ファイル: hub_test.py プロジェクト: 2013Commons/HUE-SHARK
 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)
コード例 #2
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)
コード例 #3
0
ファイル: hub_test.py プロジェクト: MarSoft/eventlet
 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
ファイル: hub_test.py プロジェクト: 2013Commons/HUE-SHARK
    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
ファイル: hub_test.py プロジェクト: MarSoft/eventlet
    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
ファイル: conftest.py プロジェクト: pombredanne/nameko
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
ファイル: pytest.py プロジェクト: onefinestay/nameko
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)