Commit bcbfcf3a authored by Samuel GAIST's avatar Samuel GAIST Committed by Flavio TARSETTI

[logging] Logger cleanup

Update all logger.warn calls to logger.warning as warn is obsolete.

Also removes all unused logger instances.
parent e4a2e9af
......@@ -85,7 +85,7 @@ class BeatComputationClient(object):
request = [b"", BCP.BCPC_CLIENT, service] + request
if self.verbose:
logger.warn("I: send request to '%s' service: ", service)
logger.warning("I: send request to '%s' service: ", service)
dump(request)
self.client.send_multipart(request)
......
......@@ -210,7 +210,7 @@ class BeatComputationWorker(object):
self.liveness -= 1
if self.liveness == 0:
if self.verbose:
logger.warn("W: disconnected from broker - retrying…")
logger.warning("W: disconnected from broker - retrying…")
try:
time.sleep(1e-3 * self.reconnect)
except KeyboardInterrupt:
......@@ -222,7 +222,7 @@ class BeatComputationWorker(object):
self.send_to_broker(BCP.BCPW_HEARTBEAT)
self.heartbeat_at = time.time() + 1e-3 * self.heartbeat
logger.warn("W: interrupt received, killing worker…")
logger.warning("W: interrupt received, killing worker…")
return None
def destroy(self):
......
......@@ -192,14 +192,14 @@ class Host(object):
Host.images_cache[image] = infos
return infos
except Exception as e:
logger.warn(
logger.warning(
"Ignoring potential environment at `%s' since "
"`describe' output cannot be parsed: %s",
image,
str(e),
)
else:
logger.warn(
logger.warning(
"Execution failed with status {}: \n"
"stdout: '{}'\n"
"stderr: '{}'".format(status, stdout, stderr)
......@@ -278,7 +278,7 @@ class Host(object):
)
return False
else:
logger.warn(
logger.warning(
"Overriding **existing** environment '%s' image "
"with '%s'. To avoid this warning make "
"sure your docker images do not contain environments "
......@@ -347,7 +347,7 @@ class Host(object):
def _must_replace(key, image, environments):
environment = environments[key]
if environment["image"] not in image.tags:
logger.warn(
logger.warning(
"Different images providing the same environment: {} VS {}".format(
environment["image"], image.tags
)
......@@ -396,7 +396,7 @@ class Host(object):
for image in image_list:
if not len(image.tags):
logger.warn("Untagged image, skipping")
logger.warning("Untagged image, skipping")
continue
image_info = _parse_image_info(image)
......@@ -661,7 +661,7 @@ class Host(object):
status = self.status(container)
if status not in ("created", "exited"):
logger.warn(
logger.warning(
"Killing container '%s' which is on state '%s'", container.id, status
)
self._exec(["docker", "container", "stop", container.id])
......
......@@ -542,7 +542,7 @@ class DockerExecutor(RemoteExecutor):
status = self.host.wait(algorithm_container, timeout)
except requests.exceptions.ReadTimeout:
logger.warn(
logger.warning(
"user process has timed out after %d minutes", timeout_in_minutes
)
timed_out = True
......
......@@ -42,18 +42,12 @@ remote
Execution utilities
"""
import logging
from .base import BaseExecutor
from beat.backend.python.helpers import create_inputs_from_configuration
from beat.backend.python.helpers import create_outputs_from_configuration
logger = logging.getLogger(__name__)
class RemoteExecutor(BaseExecutor):
"""Base class for Executors that communicate with a message handler
......
......@@ -38,7 +38,6 @@
import os
import sys
import logging
import unittest
import simplejson as json
import tempfile
......@@ -53,7 +52,6 @@ from ..utils import find_free_port
from . import prefix
logger = logging.getLogger(__name__)
# ----------------------------------------------------------
......
......@@ -194,14 +194,16 @@ class BaseExecutionMixIn(object):
nose.tools.assert_true("system_error" in result)
nose.tools.assert_true("user_error" in result)
if result["status"] != 0:
logger.warn("status: %i", result["status"])
logger.warn("(eventual) system errors: %s", result["system_error"])
logger.warn("(eventual) user errors: %s", result["user_error"])
logger.warn("stdout: %s", result["stdout"])
logger.warn("stderr: %s", result["stderr"])
logger.warning("status: %i", result["status"])
logger.warning(
"(eventual) system errors: %s", result["system_error"]
)
logger.warning("(eventual) user errors: %s", result["user_error"])
logger.warning("stdout: %s", result["stdout"])
logger.warning("stderr: %s", result["stderr"])
return result
if result["system_error"]:
logger.warn("system errors: %s", result["system_error"])
logger.warning("system errors: %s", result["system_error"])
return result
nose.tools.eq_(result["status"], 0)
......
......@@ -37,7 +37,6 @@
# Tests for experiment execution
import os
import logging
import unittest
import simplejson as json
import multiprocessing
......@@ -57,8 +56,6 @@ from ..utils import find_free_port
from . import prefix, tmp_prefix
logger = logging.getLogger(__name__)
# ----------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment