Commit d9d61d3a authored by Flavio TARSETTI's avatar Flavio TARSETTI

Merge branch 'logger_cleanup' into 'master'

Logger cleanup

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