-
Notifications
You must be signed in to change notification settings - Fork 3k
Improve logs around running docker #2261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -22,11 +22,10 @@ def __init__( | |||
self.docker_client: docker.DockerClient = docker_client | |||
|
|||
def __enter__(self) -> Container: | |||
LOGGER.info(f"Creating container for image {self.image_name} ...") | |||
LOGGER.info(f"Creating a container for the image: {self.image_name} ...") | |||
default_kwargs = {"detach": True, "tty": True} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is more-or-less like TrackedContainer, so let's have same options here
@@ -48,6 +47,6 @@ def exec_cmd(container: Container, cmd: str) -> str: | |||
exec_result = container.exec_run(cmd) | |||
output = exec_result.output.decode().rstrip() | |||
assert isinstance(output, str) | |||
LOGGER.info(f"Command output: {output}") | |||
LOGGER.debug(f"Command output: {output}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes the output is huge, and in most cases it is not useful
@@ -1,7 +1,7 @@ | |||
[pytest] | |||
addopts = -ra --color=yes | |||
log_cli = 1 | |||
log_cli_level = DEBUG | |||
log_cli_level = INFO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One can always use DEBUG if needed
@@ -41,8 +41,6 @@ class CondaPackageHelper: | |||
|
|||
def __init__(self, container: TrackedContainer): | |||
self.container = container | |||
|
|||
LOGGER.info(f"Starting container {self.container.image_name} ...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.container.run_detached
is going to log the same thing
@@ -101,7 +99,7 @@ def available_packages(self) -> dict[str, set[str]]: | |||
) | |||
# Keeping command line output since `mamba search --outdated --json` is way too long ... | |||
self.available = CondaPackageHelper._extract_available( | |||
self.container.exec_cmd("mamba search --outdated --quiet") | |||
self.container.exec_cmd("conda search --outdated --quiet") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mamba search --outdated --quiet
doesn't work at all :(
Describe your changes
Issue ticket if applicable
Checklist (especially for first-time contributors)