Add active worker count to buildmanager logs.
This commit is contained in:
parent
37079315d2
commit
33f12c58ba
3 changed files with 10 additions and 2 deletions
|
@ -47,3 +47,9 @@ class BaseManager(object):
|
|||
one of: incomplete, error, complete. If incomplete, the job should be requeued.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def num_workers(self):
|
||||
""" Returns the number of active build workers currently registered. This includes those
|
||||
that are currently busy and awaiting more work.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
|
|
@ -70,3 +70,5 @@ class EnterpriseManager(BaseManager):
|
|||
def build_component_disposed(self, build_component, timed_out):
|
||||
self.build_components.remove(build_component)
|
||||
|
||||
def num_workers(self):
|
||||
return len(self.build_components)
|
||||
|
|
|
@ -9,7 +9,7 @@ from aiowsgi import create_server as create_wsgi_server
|
|||
from flask import Flask
|
||||
from threading import Event
|
||||
from trollius.coroutines import From
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import timedelta
|
||||
|
||||
from buildman.jobutil.buildjob import BuildJob, BuildJobLoadException
|
||||
from data.queue import WorkQueue
|
||||
|
@ -137,7 +137,7 @@ class BuilderServer(object):
|
|||
@trollius.coroutine
|
||||
def _work_checker(self):
|
||||
while self._current_status == 'running':
|
||||
logger.debug('Checking for more work')
|
||||
logger.debug('Checking for more work for %d active workers', self._lifecycle_manager.num_workers())
|
||||
job_item = self._queue.get(processing_time=self._lifecycle_manager.setup_time())
|
||||
if job_item is None:
|
||||
logger.debug('No additional work found. Going to sleep for %s seconds', WORK_CHECK_TIMEOUT)
|
||||
|
|
Reference in a new issue