aboutsummaryrefslogtreecommitdiff
path: root/src/mlia/cli/commands.py
diff options
context:
space:
mode:
authorRuomei Yan <ruomei.yan@arm.com>2022-11-02 16:47:56 +0000
committerRuomei Yan <ruomei.yan@arm.com>2022-11-15 13:02:56 +0000
commit47fc50576e7040680c19e152592b2c5e5cc297f5 (patch)
treef10fc331e7bc7358c7da8cf3582d9428db4e7367 /src/mlia/cli/commands.py
parentef73bb773df214f3f33f8e4ca7d276041106cad2 (diff)
downloadmlia-47fc50576e7040680c19e152592b2c5e5cc297f5.tar.gz
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
Diffstat (limited to 'src/mlia/cli/commands.py')
-rw-r--r--src/mlia/cli/commands.py41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/mlia/cli/commands.py b/src/mlia/cli/commands.py
index 72ae4bb..4be7f3e 100644
--- a/src/mlia/cli/commands.py
+++ b/src/mlia/cli/commands.py
@@ -29,7 +29,6 @@ from mlia.api import PathOrFileLike
from mlia.cli.config import get_installation_manager
from mlia.cli.options import parse_optimization_parameters
from mlia.utils.console import create_section_header
-from mlia.utils.types import only_one_selected
logger = logging.getLogger(__name__)
@@ -243,34 +242,36 @@ def optimization(
)
-def backend(
- backend_action: str,
+def backend_install(
+ name: str,
path: Path | None = None,
- download: bool = False,
- name: str | None = None,
i_agree_to_the_contained_eula: bool = False,
noninteractive: bool = False,
+ force: bool = False,
) -> None:
- """Backends configuration."""
+ """Install configuration."""
logger.info(CONFIG)
manager = get_installation_manager(noninteractive)
- if backend_action == "status":
- manager.show_env_details()
+ install_from_path = path is not None
- if backend_action == "install":
- install_from_path = path is not None
+ if install_from_path:
+ manager.install_from(cast(Path, path), name, force)
+ else:
+ eula_agreement = not i_agree_to_the_contained_eula
+ manager.download_and_install(name, eula_agreement)
- if not only_one_selected(install_from_path, download):
- raise Exception(
- "Please select only one action: download or "
- "provide path to the backend installation"
- )
- if install_from_path:
- manager.install_from(cast(Path, path), name)
+def backend_uninstall(
+ name: str,
+) -> None:
+ """Uninstall backend(s)."""
+ manager = get_installation_manager(noninteractive=True)
+ manager.uninstall(name)
+
- if download:
- eula_agreement = not i_agree_to_the_contained_eula
- manager.download_and_install(name, eula_agreement)
+def backend_list() -> None:
+ """List backend status."""
+ manager = get_installation_manager(noninteractive=True)
+ manager.show_env_details()