예제 #1
0
def setup():
    if CONF.periodic_enable:
        if CONF.periodic_fuzzy_delay:
            initial_delay = random.randint(0, CONF.periodic_fuzzy_delay)
            LOG.debug("Starting periodic tasks with initial delay {seconds} "
                      "seconds".format(seconds=initial_delay))
        else:
            initial_delay = None

        tg = threadgroup.ThreadGroup()
        pt = _make_periodic_tasks()
        tg.add_dynamic_timer(
            pt.run_periodic_tasks,
            initial_delay=initial_delay,
            periodic_interval_max=CONF.periodic_interval_max,
            context=None)
예제 #2
0
파일: periodic.py 프로젝트: RogerFed/sahara
def setup(app):
    if CONF.periodic_enable:
        if CONF.periodic_fuzzy_delay:
            initial_delay = random.randint(0, CONF.periodic_fuzzy_delay)
            LOG.debug("Starting periodic tasks with initial delay '%s' "
                      "seconds", initial_delay)
        else:
            initial_delay = None

        app.tg = threadgroup.ThreadGroup()
        pt = SaharaPeriodicTasks()
        app.tg.add_dynamic_timer(
            pt.run_periodic_tasks,
            initial_delay=initial_delay,
            periodic_interval_max=CONF.periodic_interval_max,
            context=None)