buildman: initialize queuemetrics asynchronously
This commit is contained in:
parent
b4b06ec8c8
commit
346d6b933a
1 changed files with 5 additions and 6 deletions
|
@ -93,13 +93,8 @@ class BuilderServer(object):
|
||||||
logger.debug('Starting server on port %s, with controller on port %s', websocket_port,
|
logger.debug('Starting server on port %s, with controller on port %s', websocket_port,
|
||||||
controller_port)
|
controller_port)
|
||||||
|
|
||||||
TASKS = [
|
|
||||||
Task(self._initialize(loop, host, websocket_port, controller_port, ssl)),
|
|
||||||
Task(self._queue_metrics_updater()),
|
|
||||||
]
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
loop.run_until_complete(trollius.wait(TASKS))
|
loop.run_until_complete(self._initialize(loop, host, websocket_port, controller_port, ssl))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
|
@ -195,6 +190,7 @@ class BuilderServer(object):
|
||||||
|
|
||||||
@trollius.coroutine
|
@trollius.coroutine
|
||||||
def _queue_metrics_updater(self):
|
def _queue_metrics_updater(self):
|
||||||
|
logger.debug('Initializing queue metrics updater')
|
||||||
while self._current_status == BuildServerStatus.RUNNING:
|
while self._current_status == BuildServerStatus.RUNNING:
|
||||||
yield From(trollius.sleep(30))
|
yield From(trollius.sleep(30))
|
||||||
logger.debug('Writing metrics')
|
logger.debug('Writing metrics')
|
||||||
|
@ -212,5 +208,8 @@ class BuilderServer(object):
|
||||||
create_wsgi_server(self._controller_app, loop=loop, host=host, port=controller_port, ssl=ssl)
|
create_wsgi_server(self._controller_app, loop=loop, host=host, port=controller_port, ssl=ssl)
|
||||||
yield From(loop.create_server(transport_factory, host, websocket_port, ssl=ssl))
|
yield From(loop.create_server(transport_factory, host, websocket_port, ssl=ssl))
|
||||||
|
|
||||||
|
# Initialize the metrics updater
|
||||||
|
trollius.async(self._queue_metrics_updater())
|
||||||
|
|
||||||
# Initialize the work queue checker.
|
# Initialize the work queue checker.
|
||||||
yield From(self._work_checker())
|
yield From(self._work_checker())
|
||||||
|
|
Reference in a new issue