mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-08 10:34:06 +00:00
Error logs on error/warn in logs
This commit is contained in:
@@ -94,16 +94,24 @@ class TrackedContainer:
|
|||||||
assert self.container is not None
|
assert self.container is not None
|
||||||
rv = self.container.wait(timeout=timeout)
|
rv = self.container.wait(timeout=timeout)
|
||||||
logs = self.get_logs()
|
logs = self.get_logs()
|
||||||
failed = rv["StatusCode"] != 0
|
rc_success = rv["StatusCode"] == 0
|
||||||
|
should_report = not (
|
||||||
|
no_failure == rc_success
|
||||||
|
and no_warnings == (not self.get_warnings(logs))
|
||||||
|
and no_errors == (not self.get_errors(logs))
|
||||||
|
)
|
||||||
|
|
||||||
if failed:
|
if not rc_success or should_report:
|
||||||
LOGGER.error(f"Command output:\n{logs}")
|
LOGGER.error(f"Command output:\n{logs}")
|
||||||
else:
|
else:
|
||||||
LOGGER.debug(f"Command output:\n{logs}")
|
LOGGER.debug(f"Command output:\n{logs}")
|
||||||
assert no_failure != failed
|
self.remove()
|
||||||
|
|
||||||
|
# To see the reason, we run assert statements separately
|
||||||
|
assert no_failure == rc_success
|
||||||
assert no_warnings == (not self.get_warnings(logs))
|
assert no_warnings == (not self.get_warnings(logs))
|
||||||
assert no_errors == (not self.get_errors(logs))
|
assert no_errors == (not self.get_errors(logs))
|
||||||
self.remove()
|
|
||||||
return logs
|
return logs
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Reference in New Issue
Block a user