Skip to content

Commit

Permalink
User-friendly logging for configure, run and inspect commands (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
hasan7n authored Aug 14, 2023
1 parent fb371c9 commit bdcae7f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mlcube/mlcube/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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)


Expand Down

0 comments on commit bdcae7f

Please sign in to comment.