@@ -44,12 +44,15 @@ def run_detached(self, **kwargs: Any) -> None:
44
44
Keyword arguments to pass to docker.DockerClient.containers.run
45
45
extending and/or overriding key/value pairs passed to the constructor
46
46
"""
47
- LOGGER .info (f"Running { self .image_name } with args { kwargs } ..." )
47
+ LOGGER .info (
48
+ f"Creating a container for the image: { self .image_name } with args: { kwargs } ..."
49
+ )
48
50
default_kwargs = {"detach" : True , "tty" : True }
49
51
final_kwargs = default_kwargs | kwargs
50
52
self .container = self .docker_client .containers .run (
51
53
self .image_name , ** final_kwargs
52
54
)
55
+ LOGGER .info (f"Container { self .container .name } created" )
53
56
54
57
def get_logs (self ) -> str :
55
58
assert self .container is not None
@@ -65,13 +68,14 @@ def get_health(self) -> str:
65
68
def exec_cmd (self , cmd : str , ** kwargs : Any ) -> str :
66
69
assert self .container is not None
67
70
container = self .container
71
+
68
72
LOGGER .info (f"Running cmd: `{ cmd } ` on container: { container .name } " )
69
73
default_kwargs = {"tty" : True }
70
74
final_kwargs = default_kwargs | kwargs
71
75
exec_result = container .exec_run (cmd , ** final_kwargs )
72
76
output = exec_result .output .decode ().rstrip ()
73
77
assert isinstance (output , str )
74
- LOGGER .info (f"Command output: { output } " )
78
+ LOGGER .debug (f"Command output: { output } " )
75
79
assert exec_result .exit_code == 0 , f"Command: `{ cmd } ` failed"
76
80
return output
77
81
@@ -109,7 +113,7 @@ def _lines_starting_with(logs: str, pattern: str) -> list[str]:
109
113
def remove (self ) -> None :
110
114
"""Kills and removes the tracked docker container."""
111
115
if self .container is None :
112
- LOGGER .info ("No container to remove" )
116
+ LOGGER .debug ("No container to remove" )
113
117
else :
114
118
LOGGER .info (f"Removing container { self .container .name } ..." )
115
119
self .container .remove (force = True )
0 commit comments