LOGGER -> logger.
While logger may be a global variable, it is not constant. Let the linters complain!
This commit is contained in:
parent
a8473db87f
commit
09cc4ba4c1
4 changed files with 35 additions and 35 deletions
|
@ -20,7 +20,7 @@ HEARTBEAT_DELTA = datetime.timedelta(seconds=30)
|
|||
HEARTBEAT_TIMEOUT = 10
|
||||
INITIAL_TIMEOUT = 25
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class ComponentStatus(object):
|
||||
""" ComponentStatus represents the possible states of a component. """
|
||||
|
@ -51,7 +51,7 @@ class BuildComponent(BaseComponent):
|
|||
self.join(self.builder_realm)
|
||||
|
||||
def onJoin(self, details):
|
||||
LOGGER.debug('Registering methods and listeners for component %s', self.builder_realm)
|
||||
logger.debug('Registering methods and listeners for component %s', self.builder_realm)
|
||||
yield From(self.register(self._on_ready, u'io.quay.buildworker.ready'))
|
||||
yield From(self.register(self._ping, u'io.quay.buildworker.ping'))
|
||||
yield From(self.subscribe(self._on_heartbeat, 'io.quay.builder.heartbeat'))
|
||||
|
@ -75,7 +75,7 @@ class BuildComponent(BaseComponent):
|
|||
buildpack_url = self.user_files.get_file_url(build_job.repo_build().resource_key,
|
||||
requires_cors=False)
|
||||
|
||||
LOGGER.debug('Retreiving build package: %s', buildpack_url)
|
||||
logger.debug('Retreiving build package: %s', buildpack_url)
|
||||
buildpack = None
|
||||
try:
|
||||
buildpack = BuildPackage.from_url(buildpack_url)
|
||||
|
@ -85,7 +85,7 @@ class BuildComponent(BaseComponent):
|
|||
|
||||
# Extract the base image information from the Dockerfile.
|
||||
parsed_dockerfile = None
|
||||
LOGGER.debug('Parsing dockerfile')
|
||||
logger.debug('Parsing dockerfile')
|
||||
|
||||
build_config = build_job.build_config()
|
||||
try:
|
||||
|
@ -143,8 +143,8 @@ class BuildComponent(BaseComponent):
|
|||
}
|
||||
|
||||
# Invoke the build.
|
||||
LOGGER.debug('Invoking build: %s', self.builder_realm)
|
||||
LOGGER.debug('With Arguments: %s', build_arguments)
|
||||
logger.debug('Invoking build: %s', self.builder_realm)
|
||||
logger.debug('With Arguments: %s', build_arguments)
|
||||
|
||||
return (self
|
||||
.call("io.quay.builder.build", **build_arguments)
|
||||
|
@ -217,7 +217,7 @@ class BuildComponent(BaseComponent):
|
|||
# the pull/push progress, as well as the current step index.
|
||||
with self._build_status as status_dict:
|
||||
if self._build_status.set_phase(phase):
|
||||
LOGGER.debug('Build %s has entered a new phase: %s', self.builder_realm, phase)
|
||||
logger.debug('Build %s has entered a new phase: %s', self.builder_realm, phase)
|
||||
|
||||
BuildComponent._process_pushpull_status(status_dict, phase, docker_data, self._image_info)
|
||||
|
||||
|
@ -243,7 +243,7 @@ class BuildComponent(BaseComponent):
|
|||
})
|
||||
|
||||
build_id = self._current_job.repo_build().uuid
|
||||
LOGGER.warning('Build %s failed with message: %s', build_id, error_message)
|
||||
logger.warning('Build %s failed with message: %s', build_id, error_message)
|
||||
|
||||
# Mark that the build has finished (in an error state)
|
||||
self._build_finished(BuildJobResult.ERROR)
|
||||
|
@ -283,11 +283,11 @@ class BuildComponent(BaseComponent):
|
|||
|
||||
def _on_ready(self, token):
|
||||
if self._component_status != 'waiting':
|
||||
LOGGER.warning('Build component (token "%s") is already connected', self.expected_token)
|
||||
logger.warning('Build component (token "%s") is already connected', self.expected_token)
|
||||
return
|
||||
|
||||
if token != self.expected_token:
|
||||
LOGGER.warning('Builder token mismatch. Expected: "%s". Found: "%s"', self.expected_token, token)
|
||||
logger.warning('Builder token mismatch. Expected: "%s". Found: "%s"', self.expected_token, token)
|
||||
return
|
||||
|
||||
self._set_status(ComponentStatus.RUNNING)
|
||||
|
@ -295,7 +295,7 @@ class BuildComponent(BaseComponent):
|
|||
# Start the heartbeat check and updating loop.
|
||||
loop = trollius.get_event_loop()
|
||||
loop.create_task(self._heartbeat())
|
||||
LOGGER.debug('Build worker %s is connected and ready', self.builder_realm)
|
||||
logger.debug('Build worker %s is connected and ready', self.builder_realm)
|
||||
return True
|
||||
|
||||
def _set_status(self, phase):
|
||||
|
@ -332,7 +332,7 @@ class BuildComponent(BaseComponent):
|
|||
self.parent_manager.job_heartbeat(current_job)
|
||||
|
||||
# Check the heartbeat from the worker.
|
||||
LOGGER.debug('Checking heartbeat on realm %s', self.builder_realm)
|
||||
logger.debug('Checking heartbeat on realm %s', self.builder_realm)
|
||||
if self._last_heartbeat and self._last_heartbeat < datetime.datetime.now() - HEARTBEAT_DELTA:
|
||||
self._timeout()
|
||||
return
|
||||
|
@ -341,7 +341,7 @@ class BuildComponent(BaseComponent):
|
|||
|
||||
def _timeout(self):
|
||||
self._set_status(ComponentStatus.TIMED_OUT)
|
||||
LOGGER.warning('Build component with realm %s has timed out', self.builder_realm)
|
||||
logger.warning('Build component with realm %s has timed out', self.builder_realm)
|
||||
self._dispose(timed_out=True)
|
||||
|
||||
def _dispose(self, timed_out=False):
|
||||
|
|
Reference in a new issue