示例#1
0
def _run_worker():
    LOG.info('(PID=%s) RulesEngine started.', os.getpid())

    timer = None
    rules_engine_worker = worker.get_worker()

    try:
        timer_thread = None
        if cfg.CONF.timer.enable:
            timer = St2Timer(local_timezone=cfg.CONF.timer.local_timezone)
            timer_thread = eventlet.spawn(_kickoff_timer, timer)
            LOG.info(TIMER_ENABLED_LOG_LINE)
        else:
            LOG.info(TIMER_DISABLED_LOG_LINE)
        rules_engine_worker.start()
        if timer:
            return timer_thread.wait() and rules_engine_worker.wait()
        else:
            return rules_engine_worker.wait()
    except (KeyboardInterrupt, SystemExit):
        LOG.info('(PID=%s) RulesEngine stopped.', os.getpid())
        rules_engine_worker.shutdown()
    except:
        LOG.exception('(PID:%s) RulesEngine quit due to exception.', os.getpid())
        return 1
    finally:
        if timer:
            timer.cleanup()

    return 0
def _run_worker():
    LOG.info('(PID=%s) RulesEngine started.', os.getpid())

    timer = None
    rules_engine_worker = worker.get_worker()

    try:
        timer_thread = None
        if cfg.CONF.timer.enable:
            timer = St2Timer(local_timezone=cfg.CONF.timer.local_timezone)
            timer_thread = eventlet.spawn(_kickoff_timer, timer)
            LOG.info(TIMER_ENABLED_LOG_LINE)
        else:
            LOG.info(TIMER_DISABLED_LOG_LINE)
        rules_engine_worker.start()
        if timer:
            return timer_thread.wait() and rules_engine_worker.wait()
        else:
            return rules_engine_worker.wait()
    except (KeyboardInterrupt, SystemExit):
        LOG.info('(PID=%s) RulesEngine stopped.', os.getpid())
        rules_engine_worker.shutdown()
    except:
        LOG.exception('(PID:%s) RulesEngine quit due to exception.',
                      os.getpid())
        return 1
    finally:
        if timer:
            timer.cleanup()

    return 0
示例#3
0
def _run_worker():
    LOG.info('(PID=%s) RulesEngine started.', os.getpid())

    rules_engine_worker = worker.get_worker()

    try:
        rules_engine_worker.start()
        return rules_engine_worker.wait()
    except (KeyboardInterrupt, SystemExit):
        LOG.info('(PID=%s) RulesEngine stopped.', os.getpid())
        rules_engine_worker.shutdown()
    except:
        LOG.exception('(PID:%s) RulesEngine quit due to exception.', os.getpid())
        return 1

    return 0
示例#4
0
文件: rulesengine.py 项目: nzlosh/st2
def _run_worker():
    LOG.info('(PID=%s) RulesEngine started.', os.getpid())

    rules_engine_worker = worker.get_worker()

    try:
        rules_engine_worker.start()
        return rules_engine_worker.wait()
    except (KeyboardInterrupt, SystemExit):
        LOG.info('(PID=%s) RulesEngine stopped.', os.getpid())
        rules_engine_worker.shutdown()
    except:
        LOG.exception('(PID:%s) RulesEngine quit due to exception.', os.getpid())
        return 1

    return 0
示例#5
0
def _run_worker():
    LOG.info("(PID=%s) RulesEngine started.", os.getpid())

    rules_engine_worker = worker.get_worker()

    try:
        rules_engine_worker.start()
        return rules_engine_worker.wait()
    except (KeyboardInterrupt, SystemExit):
        LOG.info("(PID=%s) RulesEngine stopped.", os.getpid())
        deregister_service(RULESENGINE)
        rules_engine_worker.shutdown()
    except:
        LOG.exception("(PID:%s) RulesEngine quit due to exception.",
                      os.getpid())
        return 1

    return 0
示例#6
0
def _run_worker():
    LOG.info('(PID=%s) RulesEngine started.', os.getpid())

    timer = St2Timer(local_timezone=cfg.CONF.timer.local_timezone)
    rules_engine_worker = worker.get_worker()

    try:
        timer_thread = eventlet.spawn(_kickoff_timer, timer)
        rules_engine_worker.start()
        return (timer_thread.wait() and rules_engine_worker.wait())
    except (KeyboardInterrupt, SystemExit):
        LOG.info('(PID=%s) RulesEngine stopped.', os.getpid())
        rules_engine_worker.shutdown()
    except:
        LOG.exception('(PID:%s) RulesEngine quit due to exception.', os.getpid())
        return 1
    finally:
        timer.cleanup()

    return 0
示例#7
0
def _run_worker():
    LOG.info('(PID=%s) RulesEngine started.', os.getpid())

    timer = St2Timer(local_timezone=cfg.CONF.timer.local_timezone)
    rules_engine_worker = worker.get_worker()

    try:
        timer_thread = eventlet.spawn(_kickoff_timer, timer)
        rules_engine_worker.start()
        return (timer_thread.wait() and rules_engine_worker.wait())
    except (KeyboardInterrupt, SystemExit):
        LOG.info('(PID=%s) RulesEngine stopped.', os.getpid())
        rules_engine_worker.shutdown()
    except:
        LOG.exception('(PID:%s) RulesEngine quit due to exception.',
                      os.getpid())
        return 1
    finally:
        timer.cleanup()

    return 0