Skip to content

Commit

Permalink
Added container-loglevel param that defines LOGLEVEL env for running …
Browse files Browse the repository at this point in the history
…mlcubes
  • Loading branch information
VukW committed Jan 25, 2024
1 parent c483929 commit 4ff06b4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cli/medperf/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
statistics_timeout = None
infer_timeout = None
evaluate_timeout = None
container_loglevel = None
mlcube_configure_timeout = None
mlcube_inspect_timeout = None

Expand All @@ -184,6 +185,7 @@
"platform",
"gpus",
"cleanup",
"container_loglevel"
]
configurable_parameters = inline_parameters + [
"server",
Expand Down
12 changes: 11 additions & 1 deletion cli/medperf/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ def wrapper(
"--evaluate_timeout",
help="Maximum time in seconds before interrupting evaluate task",
),
container_loglevel: str = typer.Option(
config.container_loglevel,
"--container-loglevel",
help="Logging level for containers to be run [debug | info | warning | error]",
),
platform: str = typer.Option(
config.platform,
"--platform",
Expand Down Expand Up @@ -188,6 +193,11 @@ def wrapper(
"--evaluate_timeout",
help="Maximum time in seconds before interrupting evaluate task",
),
container_loglevel: str = typer.Option(
config.container_loglevel,
"--container-loglevel",
help="Logging level for containers to be run [debug | info | warning | error]",
),
platform: str = typer.Option(
config.platform,
"--platform",
Expand All @@ -205,7 +215,7 @@ def wrapper(
cleanup: bool = typer.Option(
config.cleanup,
"--cleanup/--no-cleanup",
help="Wether to clean up temporary medperf storage after execution",
help="Whether to clean up temporary medperf storage after execution",
),
**kwargs,
):
Expand Down
5 changes: 4 additions & 1 deletion cli/medperf/entities/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ def run(
kwargs (dict): additional arguments that are passed directly to the mlcube command
"""
kwargs.update(string_params)
# TODO: re-use `loglevel=critical` or figure out a clean MLCube logging
cmd = "mlcube run"
cmd += f" --mlcube={self.cube_path} --task={task} --platform={config.platform} --network=none"
if config.gpus is not None:
Expand All @@ -308,6 +307,10 @@ def run(
cmd += f' -Pdocker.cpu_args="{cpu_args}"'
cmd += f' -Pdocker.gpu_args="{gpu_args}"'

container_loglevel = config.container_loglevel
if container_loglevel:
cmd += f' -Pdocker.env_args="-e LOGLEVEL={container_loglevel}"'

logging.info(f"Running MLCube command: {cmd}")
proc = pexpect.spawn(cmd, timeout=timeout)
proc_out = combine_proc_sp_text(proc)
Expand Down

0 comments on commit 4ff06b4

Please sign in to comment.