From 47fc50576e7040680c19e152592b2c5e5cc297f5 Mon Sep 17 00:00:00 2001 From: Ruomei Yan Date: Wed, 2 Nov 2022 16:47:56 +0000 Subject: MLIA-649 Strip mlia backend management into a new command * add entry point for mlia-backend in setup.cfg and main.py * add --force option for install from path: uninstall existing backend in ML Inference Advisor and install from given path * add uninstall and list program parameters: uninstall has backend_name as input arg, install has backend_name as a mandatory argument * add unit tests in test_cli_commands.py, test_cli_main.py, test_tools_metadata_common.py, test_tools_metadata_corstone.py * updated README.md * remove --download option for installing backend * add new lines for the display section when we do mlia-backen list * add case insensitive support for backend names in command line argument Change-Id: Icb89d8957fa6be4b767710e24fa074f26472674b --- src/mlia/cli/options.py | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'src/mlia/cli/options.py') diff --git a/src/mlia/cli/options.py b/src/mlia/cli/options.py index f6dcf75..bf2f09b 100644 --- a/src/mlia/cli/options.py +++ b/src/mlia/cli/options.py @@ -131,7 +131,7 @@ def add_custom_supported_operators_options(parser: argparse.ArgumentParser) -> N ) -def add_backend_options(parser: argparse.ArgumentParser) -> None: +def add_backend_install_options(parser: argparse.ArgumentParser) -> None: """Add options for the backends configuration.""" def valid_directory(param: str) -> Path: @@ -141,42 +141,39 @@ def add_backend_options(parser: argparse.ArgumentParser) -> None: return dir_path - subparsers = parser.add_subparsers(title="Backend actions", dest="backend_action") - subparsers.required = True - - install_subparser = subparsers.add_parser( - "install", help="Install backend", allow_abbrev=False - ) - install_type_group = install_subparser.add_mutually_exclusive_group() - install_type_group.required = True - install_type_group.add_argument( + parser.add_argument( "--path", type=valid_directory, help="Path to the installed backend" ) - install_type_group.add_argument( - "--download", + parser.add_argument( + "--i-agree-to-the-contained-eula", default=False, action="store_true", - help="Download and install backend", + help=argparse.SUPPRESS, ) - install_subparser.add_argument( - "--i-agree-to-the-contained-eula", + parser.add_argument( + "--force", default=False, action="store_true", - help=argparse.SUPPRESS, + help="Force reinstall backend in the specified path", ) - install_subparser.add_argument( + parser.add_argument( "--noninteractive", default=False, action="store_true", help="Non interactive mode with automatic confirmation of every action", ) - install_subparser.add_argument( + parser.add_argument( "name", - nargs="?", help="Name of the backend to install", ) - subparsers.add_parser("status", help="Show backends status") + +def add_backend_uninstall_options(parser: argparse.ArgumentParser) -> None: + """Add options for the backends configuration.""" + parser.add_argument( + "name", + help="Name of the installed backend", + ) def add_evaluation_options(parser: argparse.ArgumentParser) -> None: -- cgit v1.2.1