LOGGER -> logger.

While logger may be a global variable, it is not constant. Let the
linters complain!
This commit is contained in:
Jimmy Zelinskie 2014-11-30 17:48:02 -05:00
parent a8473db87f
commit 09cc4ba4c1
4 changed files with 35 additions and 35 deletions

View file

@ -14,7 +14,7 @@ from datetime import datetime, timedelta
from buildman.jobutil.buildjob import BuildJob, BuildJobLoadException
from data.queue import WorkQueue
LOGGER = logging.getLogger(__name__)
logger = logging.getLogger(__name__)
WORK_CHECK_TIMEOUT = 10
TIMEOUT_PERIOD_MINUTES = 20
@ -68,14 +68,14 @@ class BuilderServer(object):
self._controller_app = controller_app
def run(self, host, ssl=None):
LOGGER.debug('Initializing the lifecycle manager')
logger.debug('Initializing the lifecycle manager')
self._lifecycle_manager.initialize()
LOGGER.debug('Initializing all members of the event loop')
logger.debug('Initializing all members of the event loop')
loop = trollius.get_event_loop()
trollius.Task(self._initialize(loop, host, ssl))
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)
try:
loop.run_forever()
@ -85,17 +85,17 @@ class BuilderServer(object):
loop.close()
def close(self):
LOGGER.debug('Requested server shutdown')
logger.debug('Requested server shutdown')
self._current_status = 'shutting_down'
self._lifecycle_manager.shutdown()
self._shutdown_event.wait()
LOGGER.debug('Shutting down server')
logger.debug('Shutting down server')
def _register_component(self, realm, component_klass, **kwargs):
""" Registers a component with the server. The component_klass must derive from
BaseComponent.
"""
LOGGER.debug('Registering component with realm %s', realm)
logger.debug('Registering component with realm %s', realm)
component = component_klass(types.ComponentConfig(realm=realm), realm=realm, **kwargs)
component.server = self
@ -109,7 +109,7 @@ class BuilderServer(object):
return component
def _unregister_component(self, component):
LOGGER.debug('Unregistering component with realm %s and token %s',
logger.debug('Unregistering component with realm %s and token %s',
component.builder_realm, component.expected_token)
self._current_components.remove(component)
@ -137,25 +137,25 @@ 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')
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)
logger.debug('No additional work found. Going to sleep for %s seconds', WORK_CHECK_TIMEOUT)
yield From(trollius.sleep(WORK_CHECK_TIMEOUT))
continue
try:
build_job = BuildJob(job_item)
except BuildJobLoadException as irbe:
LOGGER.exception(irbe)
logger.exception(irbe)
self._queue.incomplete(job_item, restore_retry=False)
LOGGER.debug('Build job found. Checking for an avaliable worker.')
logger.debug('Build job found. Checking for an avaliable worker.')
if self._lifecycle_manager.schedule(build_job, self._loop):
self._job_count = self._job_count + 1
LOGGER.debug('Build job scheduled. Running: %s', self._job_count)
logger.debug('Build job scheduled. Running: %s', self._job_count)
else:
LOGGER.debug('All workers are busy. Requeuing.')
logger.debug('All workers are busy. Requeuing.')
self._queue.incomplete(job_item, restore_retry=True, retry_after=0)
yield From(trollius.sleep(WORK_CHECK_TIMEOUT))