Merge "Avoid running periodic tasks on all workers"

This commit is contained in:
Jenkins 2017-09-20 09:31:50 +00:00 committed by Gerrit Code Review
commit 68abe0dd28
2 changed files with 4 additions and 1 deletions

View File

@ -42,4 +42,5 @@ def main():
server = rpc_service.Service.create(CONF.compute.topic, CONF.host,
endpoints, binary='zun-compute')
launcher = service.launch(CONF, server)
server.create_periodic_tasks()
launcher.wait()

View File

@ -60,6 +60,9 @@ class Service(service.Service):
profiler.setup(binary, CONF.host)
def start(self):
self._server.start()
def create_periodic_tasks(self):
servicegroup.setup(CONF, self.binary, self.tg)
periodic.setup(CONF, self.tg)
for endpoint in self.endpoints:
@ -68,7 +71,6 @@ class Service(service.Service):
periodic_interval_max=CONF.periodic_interval_max,
context=context.get_admin_context(all_tenants=True)
)
self._server.start()
def stop(self):
if self._server: