Run periodics in sahara-engine instead of sahara-api
Periodics should run in engine, not in api, because they don't interact with the user. On the other hand they do require remote operations. Change-Id: I00273de0632ee99ca21e9ddd796755172af2a4da
This commit is contained in:
parent
4e24c3ca5b
commit
cf913fbcc6
@ -52,7 +52,7 @@ def main():
|
|||||||
|
|
||||||
app = server.make_app()
|
app = server.make_app()
|
||||||
|
|
||||||
server.setup_sahara_api(app, 'all-in-one')
|
server.setup_sahara_api('all-in-one')
|
||||||
server.setup_sahara_engine()
|
server.setup_sahara_engine()
|
||||||
|
|
||||||
wsgi.server(eventlet.listen((cfg.CONF.host, cfg.CONF.port), backlog=500),
|
wsgi.server(eventlet.listen((cfg.CONF.host, cfg.CONF.port), backlog=500),
|
||||||
|
@ -52,7 +52,7 @@ def main():
|
|||||||
|
|
||||||
app = server.make_app()
|
app = server.make_app()
|
||||||
|
|
||||||
server.setup_sahara_api(app, 'distributed')
|
server.setup_sahara_api('distributed')
|
||||||
|
|
||||||
wsgi.server(eventlet.listen((cfg.CONF.host, cfg.CONF.port), backlog=500),
|
wsgi.server(eventlet.listen((cfg.CONF.host, cfg.CONF.port), backlog=500),
|
||||||
app, log=logging.WritableLogger(LOG), debug=False)
|
app, log=logging.WritableLogger(LOG), debug=False)
|
||||||
|
@ -95,20 +95,16 @@ def setup_common(possible_topdir, service_name):
|
|||||||
plugins_base.setup_plugins()
|
plugins_base.setup_plugins()
|
||||||
|
|
||||||
|
|
||||||
def setup_sahara_api(app, mode):
|
def setup_sahara_api(mode):
|
||||||
periodic.setup(app)
|
|
||||||
|
|
||||||
#TODO(dmitryme): move periodics to engine, until then the remote
|
|
||||||
# initialization here is a temporal hack
|
|
||||||
remote_driver = _get_remote_driver()
|
|
||||||
remote.setup_remote(remote_driver, None)
|
|
||||||
|
|
||||||
ops = _get_ops_driver(mode)
|
ops = _get_ops_driver(mode)
|
||||||
|
|
||||||
service_api.setup_service_api(ops)
|
service_api.setup_service_api(ops)
|
||||||
edp_api.setup_edp_api(ops)
|
edp_api.setup_edp_api(ops)
|
||||||
|
|
||||||
|
|
||||||
def setup_sahara_engine():
|
def setup_sahara_engine():
|
||||||
|
periodic.setup()
|
||||||
|
|
||||||
engine = _get_infrastructure_engine()
|
engine = _get_infrastructure_engine()
|
||||||
service_ops.setup_ops(engine)
|
service_ops.setup_ops(engine)
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class SaharaPeriodicTasks(periodic_task.PeriodicTasks):
|
|||||||
context.set_ctx(None)
|
context.set_ctx(None)
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup():
|
||||||
if CONF.periodic_enable:
|
if CONF.periodic_enable:
|
||||||
if CONF.periodic_fuzzy_delay:
|
if CONF.periodic_fuzzy_delay:
|
||||||
initial_delay = random.randint(0, CONF.periodic_fuzzy_delay)
|
initial_delay = random.randint(0, CONF.periodic_fuzzy_delay)
|
||||||
@ -111,9 +111,9 @@ def setup(app):
|
|||||||
else:
|
else:
|
||||||
initial_delay = None
|
initial_delay = None
|
||||||
|
|
||||||
app.tg = threadgroup.ThreadGroup()
|
tg = threadgroup.ThreadGroup()
|
||||||
pt = SaharaPeriodicTasks()
|
pt = SaharaPeriodicTasks()
|
||||||
app.tg.add_dynamic_timer(
|
tg.add_dynamic_timer(
|
||||||
pt.run_periodic_tasks,
|
pt.run_periodic_tasks,
|
||||||
initial_delay=initial_delay,
|
initial_delay=initial_delay,
|
||||||
periodic_interval_max=CONF.periodic_interval_max,
|
periodic_interval_max=CONF.periodic_interval_max,
|
||||||
|
Loading…
Reference in New Issue
Block a user