From bdcae7f505ca27569e95508007e38a83afc2b701 Mon Sep 17 00:00:00 2001 From: hasan7n <78664424+hasan7n@users.noreply.github.com> Date: Tue, 15 Aug 2023 01:32:41 +0200 Subject: [PATCH] User-friendly logging for configure, run and inspect commands (#339) --- mlcube/mlcube/__main__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mlcube/mlcube/__main__.py b/mlcube/mlcube/__main__.py index 6458fb0..696e04a 100644 --- a/mlcube/mlcube/__main__.py +++ b/mlcube/mlcube/__main__.py @@ -248,9 +248,9 @@ def configure(mlcube: t.Optional[str], platform: str, p: t.Tuple[str]) -> None: runner.configure() except MLCubeError as err: exit_code = err.context.get("code", 1) if isinstance(err, ExecutionError) else 1 - logger.exception(f"Failed to configure MLCube with error code {exit_code}.") + print(f"Failed to configure MLCube with error code {exit_code}.") if isinstance(err, ExecutionError): - print(err.describe()) + logger.exception(err.describe()) sys.exit(exit_code) logger.info( "MLCube (%s) has been successfully configured for `%s` platform.", @@ -378,9 +378,9 @@ def run( runner.run() except MLCubeError as err: exit_code = err.context.get("code", 1) if isinstance(err, ExecutionError) else 1 - logger.exception(f"run failed to run MLCube with error code {exit_code}.") + print(f"run failed to run MLCube with error code {exit_code}.") if isinstance(err, ExecutionError): - print(err.describe()) + logger.exception(err.describe()) sys.exit(exit_code) @@ -673,8 +673,8 @@ def inspect( yaml.dump(info, sys.stdout) except MLCubeError as err: + print("MLCube inspect failed") logger.exception(err) - print(str(err)) exit(1)