diff options
author | Annie Tallund <annie.tallund@arm.com> | 2023-01-31 16:20:12 +0100 |
---|---|---|
committer | Annie Tallund <annie.tallund@arm.com> | 2023-02-10 12:54:45 +0100 |
commit | b863f8eaf0b2e2627fa9c5d2a51004fd8133cc68 (patch) | |
tree | 6ac932f81de1d326477f0716b1668e9bebae332e /src/mlia/cli/main.py | |
parent | 3e3dcb9bd5abb88adcd85b4f89e8a81e7f6fa293 (diff) | |
download | mlia-b863f8eaf0b2e2627fa9c5d2a51004fd8133cc68.tar.gz |
MLIA-594 Save target profile configuration
Save the target profile file in the output directory.
Change-Id: I886e52cb922c5425e749b154bd67a5d294ce0201
Diffstat (limited to 'src/mlia/cli/main.py')
-rw-r--r-- | src/mlia/cli/main.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mlia/cli/main.py b/src/mlia/cli/main.py index 76f199e..793e155 100644 --- a/src/mlia/cli/main.py +++ b/src/mlia/cli/main.py @@ -34,6 +34,7 @@ from mlia.core.context import ExecutionContext from mlia.core.errors import ConfigurationError from mlia.core.errors import InternalError from mlia.core.logging import setup_logging +from mlia.target.config import copy_profile_file_to_output_dir from mlia.target.registry import table as target_table @@ -174,7 +175,6 @@ def setup_context( if param_name not in skipped_params and (param_name not in expected_params or param_name in func_params) } - return (ctx, func_args) @@ -191,6 +191,11 @@ def run_command(args: argparse.Namespace) -> int: logger.info( "\nThis execution of MLIA uses output directory: %s", ctx.output_dir ) + if copy_profile_file(ctx, func_args): + logger.info( + "Target profile information copied to %s/target_profile.toml", + ctx.output_dir, + ) args.func(**func_args) return 0 except KeyboardInterrupt: @@ -261,6 +266,16 @@ def init_and_run(commands: list[CommandInfo], argv: list[str] | None = None) -> return run_command(args) +def copy_profile_file(ctx: ExecutionContext, func_args: dict) -> bool: + """If present, copy the target profile file to the output directory.""" + if func_args.get("target_profile"): + return copy_profile_file_to_output_dir( + func_args["target_profile"], ctx.output_dir + ) + + return False + + def main(argv: list[str] | None = None) -> int: """Entry point of the main application.""" commands = get_commands() |