Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #9
0
def pytest_configure(config):
    if config.option.blocking_detection:  # pragma: no cover
        from eventlet import debug
        debug.hub_blocking_detection(True)
Example #10
0
def pytest_configure(config):
    if config.option.blocking_detection:  # pragma: no cover
        from eventlet import debug
        debug.hub_blocking_detection(True)
Example #11
0
# -*- 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)