oak-cli 0.3.7__tar.gz → 0.3.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {oak_cli-0.3.7 → oak_cli-0.3.9}/PKG-INFO +1 -1
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/configuration/auxiliary.py +7 -12
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/configuration/common.py +24 -21
- oak_cli-0.3.9/oak_cli/configuration/keys/enums.py +31 -0
- oak_cli-0.3.9/oak_cli/configuration/keys/main.py +20 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/configuration/local_machine_purpose.py +8 -12
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/configuration/main.py +4 -10
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/docker/common.py +3 -3
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/main.py +6 -2
- oak_cli-0.3.9/oak_cli/worker/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/worker/common.py +2 -2
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/worker/node_engine.py +18 -7
- {oak_cli-0.3.7 → oak_cli-0.3.9}/pyproject.toml +1 -1
- oak_cli-0.3.7/oak_cli/configuration/addon_repos.py +0 -38
- oak_cli-0.3.7/oak_cli/configuration/main_oak_repo.py +0 -38
- {oak_cli-0.3.7 → oak_cli-0.3.9}/README.md +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/common.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/mocks/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/mocks/cifar10_simple.SLA.json +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/mocks/common.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/mocks/mnist_multi.SLA.json +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/mocks/mnist_simple.SLA.json +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/projects/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/projects/cifar10_keras.SLA.json +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/projects/cifar10_pytorch.SLA.json +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/projects/common.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/projects/hierarchical_mnist_sklearn_small.SLA.json +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/projects/mnist_sklearn_large.SLA.json +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/projects/mnist_sklearn_small.SLA.json +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/main.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/main.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/ansible/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/ansible/ansible.cfg +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/ansible/hostfile +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/ansible/playbooks/install_fundamentals.yml +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/ansible/python_utils.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/apps/SLAs/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/apps/SLAs/blank_app_without_services.SLA.json +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/apps/SLAs/common.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/apps/SLAs/default_app_with_services.SLA.json +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/apps/SLAs/dummy_tester.SLA.json +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/apps/SLAs/inference_tester_mnist_sklearn.SLA.json +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/apps/SLAs/python.SLA.json +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/apps/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/apps/auxiliary.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/apps/common.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/apps/main.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/configuration/__init__.py +0 -0
- {oak_cli-0.3.7/oak_cli/docker → oak_cli-0.3.9/oak_cli/configuration/keys}/__init__.py +0 -0
- {oak_cli-0.3.7/oak_cli/installer → oak_cli-0.3.9/oak_cli/docker}/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/docker/aux.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/docker/aux_dockers/node_engine_log_observer.docker-compose.yml +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/docker/cluster_orchestrator.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/docker/enums.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/docker/main.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/docker/root_orchestrator.py +0 -0
- {oak_cli-0.3.7/oak_cli/services → oak_cli-0.3.9/oak_cli/installer}/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/installer/main.py +0 -0
- {oak_cli-0.3.7/oak_cli/utils → oak_cli-0.3.9/oak_cli/services}/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/services/_future_ideas.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/services/auxiliary.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/services/common.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/services/main.py +0 -0
- {oak_cli-0.3.7/oak_cli/utils/api → oak_cli-0.3.9/oak_cli/utils}/__init__.py +0 -0
- {oak_cli-0.3.7/oak_cli/utils/exceptions → oak_cli-0.3.9/oak_cli/utils/api}/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/utils/api/common.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/utils/api/custom_http.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/utils/api/custom_requests.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/utils/api/login.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/utils/common.py +0 -0
- {oak_cli-0.3.7/oak_cli/worker → oak_cli-0.3.9/oak_cli/utils/exceptions}/__init__.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/utils/exceptions/main.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/utils/exceptions/types.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/utils/exceptions.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/utils/logging.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/utils/styling.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/utils/typer_augmentations.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/utils/types.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/worker/ctr.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/worker/main.py +0 -0
- {oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/worker/net_manager.py +0 -0
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import pathlib
|
|
2
2
|
import readline
|
|
3
3
|
|
|
4
|
+
from oak_cli.configuration.common import get_config_value
|
|
5
|
+
from oak_cli.configuration.keys.enums import ConfigurableConfigKey
|
|
4
6
|
from oak_cli.utils.logging import logger
|
|
5
|
-
from oak_cli.utils.types import CustomEnum
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class ConfigKey(CustomEnum):
|
|
9
|
-
CONFIG_MAIN_KEY = "OAK_CLI"
|
|
10
|
-
CONFIG_VERSION_KEY = "config_version"
|
|
11
|
-
|
|
12
|
-
LOCAL_MACHINE_PURPOSE_KEY = "local_machine_purpose"
|
|
13
|
-
|
|
14
|
-
MAIN_OAK_REPO_PATH_KEY = "main_oak_repo_path"
|
|
15
|
-
FLOPS_REPO_PATH_KEY = "flops_repo_path"
|
|
16
7
|
|
|
17
8
|
|
|
18
9
|
def prompt_for_path(path_name: str) -> pathlib.Path:
|
|
19
10
|
while True:
|
|
20
|
-
logger.info(f"Please provide the
|
|
11
|
+
logger.info(f"Please provide the '{path_name}'")
|
|
21
12
|
# https://stackoverflow.com/questions/56119177/how-to-make-a-python-script-tab-complete-directories-in-terminal/56119373#56119373
|
|
22
13
|
readline.set_completer_delims(" \t\n=")
|
|
23
14
|
readline.parse_and_bind("tab: complete")
|
|
@@ -27,3 +18,7 @@ def prompt_for_path(path_name: str) -> pathlib.Path:
|
|
|
27
18
|
continue
|
|
28
19
|
break
|
|
29
20
|
return user_typed_path
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def get_main_oak_repo_path() -> pathlib.Path:
|
|
24
|
+
return pathlib.Path(get_config_value(ConfigurableConfigKey.MAIN_OAK_REPO_PATH))
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import configparser
|
|
2
4
|
import pathlib
|
|
3
5
|
import sys
|
|
4
6
|
from typing import Any, Optional
|
|
5
7
|
|
|
6
|
-
from oak_cli.configuration.
|
|
8
|
+
from oak_cli.configuration.keys.enums import ConfigKey, InternalConfigKey
|
|
7
9
|
from oak_cli.utils.logging import logger
|
|
8
10
|
|
|
9
11
|
OAK_CLI_CONFIG_PATH = pathlib.Path.home() / ".oak_cli_config"
|
|
@@ -17,12 +19,12 @@ def _check_local_config_valid() -> bool:
|
|
|
17
19
|
return False
|
|
18
20
|
|
|
19
21
|
config = open_local_config()
|
|
20
|
-
all_config_key_value_pairs = config.items(
|
|
22
|
+
all_config_key_value_pairs = config.items(InternalConfigKey.CONFIG_MAIN_KEY.value)
|
|
21
23
|
all_config_elements = [elem for sublist in all_config_key_value_pairs for elem in sublist]
|
|
22
|
-
if
|
|
24
|
+
if InternalConfigKey.CONFIG_VERSION.value not in all_config_elements:
|
|
23
25
|
return False
|
|
24
26
|
|
|
25
|
-
local_config_version = get_config_value(
|
|
27
|
+
local_config_version = get_config_value(InternalConfigKey.CONFIG_VERSION)
|
|
26
28
|
return local_config_version == CONFIG_VERSION
|
|
27
29
|
|
|
28
30
|
|
|
@@ -34,12 +36,17 @@ def open_local_config() -> configparser.ConfigParser:
|
|
|
34
36
|
|
|
35
37
|
def update_config_value(key: ConfigKey, value: Any) -> None:
|
|
36
38
|
config = open_local_config()
|
|
37
|
-
config[
|
|
39
|
+
config[InternalConfigKey.CONFIG_MAIN_KEY.value][key.value] = value
|
|
38
40
|
_update_config(config)
|
|
39
41
|
|
|
40
42
|
|
|
41
|
-
def get_config_value(
|
|
42
|
-
|
|
43
|
+
def get_config_value(
|
|
44
|
+
key: ConfigKey, terminate_if_key_is_missing_from_conf: bool = True
|
|
45
|
+
) -> Optional[str]:
|
|
46
|
+
value_from_config = open_local_config()[InternalConfigKey.CONFIG_MAIN_KEY.value].get(key.value)
|
|
47
|
+
if not value_from_config and terminate_if_key_is_missing_from_conf:
|
|
48
|
+
_handle_missing_key_access_attempt(key)
|
|
49
|
+
return value_from_config
|
|
43
50
|
|
|
44
51
|
|
|
45
52
|
def _update_config(config: configparser.ConfigParser) -> None:
|
|
@@ -52,9 +59,9 @@ def _create_initial_unconfigured_config_file() -> None:
|
|
|
52
59
|
OAK_CLI_CONFIG_PATH.touch()
|
|
53
60
|
|
|
54
61
|
config = configparser.ConfigParser()
|
|
55
|
-
config[
|
|
62
|
+
config[InternalConfigKey.CONFIG_MAIN_KEY.value] = {}
|
|
56
63
|
_update_config(config=config)
|
|
57
|
-
update_config_value(key=
|
|
64
|
+
update_config_value(key=InternalConfigKey.CONFIG_VERSION, value=CONFIG_VERSION)
|
|
58
65
|
logger.info(
|
|
59
66
|
"\n".join(
|
|
60
67
|
(
|
|
@@ -73,17 +80,13 @@ def check_and_handle_config_file() -> None:
|
|
|
73
80
|
_create_initial_unconfigured_config_file()
|
|
74
81
|
|
|
75
82
|
|
|
76
|
-
def
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"\n".join(
|
|
83
|
-
(
|
|
84
|
-
f"The '{what_should_be_found}' was not found in your oak-CLI config.",
|
|
85
|
-
"Please first configure it by running the matching oak-cli configuration cmd.",
|
|
86
|
-
)
|
|
83
|
+
def _handle_missing_key_access_attempt(key: ConfigKey) -> None:
|
|
84
|
+
logger.error(
|
|
85
|
+
"\n".join(
|
|
86
|
+
(
|
|
87
|
+
f"The '{key.value.replace('_', ' ')}' was not found in your oak-CLI config.",
|
|
88
|
+
"Please first configure it by running the matching oak-cli configuration cmd.",
|
|
87
89
|
)
|
|
88
90
|
)
|
|
89
|
-
|
|
91
|
+
)
|
|
92
|
+
sys.exit(1)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ConfigKey:
|
|
5
|
+
pass
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class InternalConfigKey(ConfigKey, enum.Enum):
|
|
9
|
+
"""Interal Config Keys are not configurable by the user of the CLI."""
|
|
10
|
+
|
|
11
|
+
CONFIG_MAIN_KEY = "OAK_CLI"
|
|
12
|
+
CONFIG_VERSION = "config_version"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ConfigurableConfigKey(ConfigKey, enum.Enum):
|
|
16
|
+
LOCAL_MACHINE_PURPOSE = "local_machine_purpose"
|
|
17
|
+
|
|
18
|
+
MAIN_OAK_REPO_PATH = "main_oak_repo_path"
|
|
19
|
+
FLOPS_REPO_PATH = "flops_repo_path"
|
|
20
|
+
|
|
21
|
+
SYSTEM_MANAGER_IP = "system_manager_ip"
|
|
22
|
+
|
|
23
|
+
CLUSTER_MANAGER_IP = "cluster_manager_ip"
|
|
24
|
+
CLUSTER_NAME = "cluster_name"
|
|
25
|
+
CLUSTER_LOCATION = "cluster_location"
|
|
26
|
+
|
|
27
|
+
def is_path(self) -> bool:
|
|
28
|
+
return self.value.endswith("_path")
|
|
29
|
+
|
|
30
|
+
def get_pleasant_name(self) -> str:
|
|
31
|
+
return self.value.replace("_", " ")
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
from oak_cli.configuration.auxiliary import prompt_for_path
|
|
6
|
+
from oak_cli.configuration.common import check_and_handle_config_file, update_config_value
|
|
7
|
+
from oak_cli.configuration.keys.enums import ConfigurableConfigKey
|
|
8
|
+
|
|
9
|
+
app = typer.Typer()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@app.command("configure", help="Configure a core variable.")
|
|
13
|
+
def configure_config_key(key: ConfigurableConfigKey, value: Optional[str] = None) -> None:
|
|
14
|
+
check_and_handle_config_file()
|
|
15
|
+
if not value:
|
|
16
|
+
if key.is_path():
|
|
17
|
+
value = str(prompt_for_path(key.get_pleasant_name()))
|
|
18
|
+
else:
|
|
19
|
+
value = typer.prompt(f"What values should '{key.get_pleasant_name()}' have?")
|
|
20
|
+
update_config_value(key=key, value=value)
|
|
@@ -3,13 +3,12 @@ from typing import List, Optional
|
|
|
3
3
|
|
|
4
4
|
import typer
|
|
5
5
|
|
|
6
|
-
from oak_cli.configuration.auxiliary import ConfigKey
|
|
7
6
|
from oak_cli.configuration.common import (
|
|
8
7
|
check_and_handle_config_file,
|
|
9
8
|
get_config_value,
|
|
10
|
-
handle_missing_key_access_attempt,
|
|
11
9
|
update_config_value,
|
|
12
10
|
)
|
|
11
|
+
from oak_cli.configuration.keys.enums import ConfigurableConfigKey
|
|
13
12
|
from oak_cli.utils.typer_augmentations import AliasGroup
|
|
14
13
|
from oak_cli.utils.types import CustomEnum
|
|
15
14
|
|
|
@@ -34,15 +33,12 @@ def get_local_machine_purposes_from_config(
|
|
|
34
33
|
terminate_if_key_is_missing_from_conf: bool = True,
|
|
35
34
|
) -> Optional[List[LocalMachinePurpose]]:
|
|
36
35
|
check_and_handle_config_file()
|
|
37
|
-
config_json_string = get_config_value(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
else:
|
|
44
|
-
if not config_json_string:
|
|
45
|
-
return
|
|
36
|
+
config_json_string = get_config_value(
|
|
37
|
+
ConfigurableConfigKey.LOCAL_MACHINE_PURPOSE,
|
|
38
|
+
terminate_if_key_is_missing_from_conf,
|
|
39
|
+
)
|
|
40
|
+
if not config_json_string:
|
|
41
|
+
return None
|
|
46
42
|
config_list = json.loads(config_json_string)
|
|
47
43
|
return [LocalMachinePurpose(purpose_name) for purpose_name in config_list]
|
|
48
44
|
|
|
@@ -78,7 +74,7 @@ def configure_local_machine_purpose(
|
|
|
78
74
|
local_machine_purposes = [LocalMachinePurpose.EVERYTHING]
|
|
79
75
|
check_and_handle_config_file()
|
|
80
76
|
update_config_value(
|
|
81
|
-
key=
|
|
77
|
+
key=ConfigurableConfigKey.LOCAL_MACHINE_PURPOSE,
|
|
82
78
|
# NOTE: The config only supports strings.
|
|
83
79
|
value=json.dumps([purpose.value for purpose in local_machine_purposes]),
|
|
84
80
|
)
|
|
@@ -2,9 +2,8 @@ import pprint
|
|
|
2
2
|
|
|
3
3
|
import typer
|
|
4
4
|
|
|
5
|
-
import oak_cli.configuration.
|
|
5
|
+
import oak_cli.configuration.keys.main
|
|
6
6
|
import oak_cli.configuration.local_machine_purpose
|
|
7
|
-
import oak_cli.configuration.main_oak_repo
|
|
8
7
|
import oak_cli.docker.cluster_orchestrator
|
|
9
8
|
import oak_cli.docker.root_orchestrator
|
|
10
9
|
from oak_cli.configuration.common import check_and_handle_config_file, open_local_config
|
|
@@ -19,14 +18,9 @@ app.add_typer(
|
|
|
19
18
|
)
|
|
20
19
|
|
|
21
20
|
app.add_typer(
|
|
22
|
-
typer_instance=oak_cli.configuration.
|
|
23
|
-
name="
|
|
24
|
-
help="Configure
|
|
25
|
-
)
|
|
26
|
-
app.add_typer(
|
|
27
|
-
typer_instance=oak_cli.configuration.addon_repos.app,
|
|
28
|
-
name="addon-repos",
|
|
29
|
-
help="Configure addon repositories",
|
|
21
|
+
typer_instance=oak_cli.configuration.keys.main.app,
|
|
22
|
+
name="key-vars",
|
|
23
|
+
help="Configure OAK-CLI Key Variables",
|
|
30
24
|
)
|
|
31
25
|
|
|
32
26
|
|
|
@@ -2,7 +2,7 @@ import json
|
|
|
2
2
|
import pathlib
|
|
3
3
|
import sys
|
|
4
4
|
|
|
5
|
-
from oak_cli.configuration.
|
|
5
|
+
from oak_cli.configuration.auxiliary import get_main_oak_repo_path
|
|
6
6
|
from oak_cli.docker.enums import OakestraDockerComposeService, RootOrchestratorService
|
|
7
7
|
from oak_cli.utils.common import run_in_shell
|
|
8
8
|
from oak_cli.utils.logging import logger
|
|
@@ -10,11 +10,11 @@ from oak_cli.utils.styling import create_spinner
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def get_root_orchestrator_docker_compose_file_path() -> pathlib.Path:
|
|
13
|
-
return
|
|
13
|
+
return get_main_oak_repo_path() / "root_orchestrator" / "docker-compose.yml"
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def get_cluster_orchestrator_docker_compose_file_path() -> pathlib.Path:
|
|
17
|
-
return
|
|
17
|
+
return get_main_oak_repo_path() / "cluster_orchestrator" / "docker-compose.yml"
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def check_docker_service_status(
|
|
@@ -12,11 +12,12 @@ import oak_cli.docker.main as oak_docker
|
|
|
12
12
|
import oak_cli.installer.main as oak_installer
|
|
13
13
|
import oak_cli.services.main as oak_services
|
|
14
14
|
import oak_cli.worker.main as oak_worker
|
|
15
|
+
from oak_cli.configuration.common import check_and_handle_config_file, get_config_value
|
|
16
|
+
from oak_cli.configuration.keys.enums import ConfigurableConfigKey
|
|
15
17
|
from oak_cli.configuration.local_machine_purpose import (
|
|
16
18
|
LocalMachinePurpose,
|
|
17
19
|
check_if_local_machine_has_required_purposes,
|
|
18
20
|
)
|
|
19
|
-
from oak_cli.utils.common import get_env_var
|
|
20
21
|
from oak_cli.utils.logging import logger
|
|
21
22
|
from oak_cli.utils.typer_augmentations import AliasGroup, typer_help_text
|
|
22
23
|
|
|
@@ -102,7 +103,10 @@ def show_version():
|
|
|
102
103
|
|
|
103
104
|
@app.command("api-docs", help="Shows a links to the Swagger api-docs for Oakestra.")
|
|
104
105
|
def show_api_docs():
|
|
105
|
-
|
|
106
|
+
check_and_handle_config_file()
|
|
107
|
+
api_docs_link = (
|
|
108
|
+
f"http://{get_config_value(ConfigurableConfigKey.SYSTEM_MANAGER_IP)}:1000/api/docs"
|
|
109
|
+
)
|
|
106
110
|
logger.info(f"Oakestra root API docs: '{api_docs_link}'")
|
|
107
111
|
|
|
108
112
|
|
|
File without changes
|
|
@@ -44,13 +44,13 @@ def stop_process(process_cmd: str, process_name: str) -> None:
|
|
|
44
44
|
return
|
|
45
45
|
|
|
46
46
|
cmd_res = run_in_shell(
|
|
47
|
-
shell_cmd=f"ps -aux | grep '{process_cmd}' | awk '{{print $2}}'",
|
|
47
|
+
shell_cmd=f"ps -aux | grep '{process_cmd}' | grep -v 'grep' | awk '{{print $2}}'",
|
|
48
48
|
pure_shell=True,
|
|
49
49
|
text=True,
|
|
50
50
|
)
|
|
51
51
|
pids = [line for line in cmd_res.stdout.split("\n") if line != ""]
|
|
52
52
|
# NOTE: The grep cmd and the python subprocess call count as 2 processes in the list.
|
|
53
|
-
if len(pids) >
|
|
53
|
+
if len(pids) > 0:
|
|
54
54
|
# NOTE: Killing the first PID in the list should stop the main process.
|
|
55
55
|
# Thus, triggering a chain of events to remove all connected processes too.
|
|
56
56
|
run_in_shell(shell_cmd=f"sudo kill {pids[0]}")
|
|
@@ -5,12 +5,14 @@ from typing import Optional
|
|
|
5
5
|
import typer
|
|
6
6
|
from typing_extensions import Annotated
|
|
7
7
|
|
|
8
|
+
from oak_cli.configuration.auxiliary import get_main_oak_repo_path
|
|
9
|
+
from oak_cli.configuration.common import get_config_value
|
|
10
|
+
from oak_cli.configuration.keys.enums import ConfigurableConfigKey
|
|
8
11
|
from oak_cli.configuration.local_machine_purpose import (
|
|
9
12
|
LocalMachinePurpose,
|
|
10
13
|
check_if_local_machine_has_required_purposes,
|
|
11
14
|
)
|
|
12
|
-
from oak_cli.
|
|
13
|
-
from oak_cli.utils.common import get_env_var, run_in_shell
|
|
15
|
+
from oak_cli.utils.common import run_in_shell
|
|
14
16
|
from oak_cli.utils.logging import logger
|
|
15
17
|
from oak_cli.utils.typer_augmentations import AliasGroup
|
|
16
18
|
from oak_cli.worker.common import ProcessStatus, get_process_status, stop_process
|
|
@@ -38,7 +40,14 @@ def start_node_engine(
|
|
|
38
40
|
logger.info("The NodeEngine is already running.")
|
|
39
41
|
return
|
|
40
42
|
|
|
41
|
-
cmd =
|
|
43
|
+
cmd = " ".join(
|
|
44
|
+
(
|
|
45
|
+
NODE_ENGINE_CMD_PREFIX,
|
|
46
|
+
"-p 6000 -p 10100",
|
|
47
|
+
"-a",
|
|
48
|
+
get_config_value(ConfigurableConfigKey.CLUSTER_MANAGER_IP),
|
|
49
|
+
)
|
|
50
|
+
)
|
|
42
51
|
if use_ml_data_server_for_flops_addon_learner:
|
|
43
52
|
cmd += " -l"
|
|
44
53
|
run_in_shell(shell_cmd=cmd, capture_output=False, check=False)
|
|
@@ -67,15 +76,17 @@ if check_if_local_machine_has_required_purposes(
|
|
|
67
76
|
help=f"rebuilds (and restarts) the {NODE_ENGINE_NAME}.",
|
|
68
77
|
)
|
|
69
78
|
def rebuild_node_engine(
|
|
70
|
-
|
|
79
|
+
# NOTE: Theoretically this is wrong but it only works like this - typer is WIP after all.
|
|
80
|
+
architecture: Architecture = Architecture.AMD64.value,
|
|
81
|
+
restart: bool = True,
|
|
71
82
|
) -> None:
|
|
72
83
|
if restart:
|
|
73
84
|
stop_node_engine()
|
|
74
85
|
|
|
75
|
-
node_engine_build_path =
|
|
86
|
+
node_engine_build_path = get_main_oak_repo_path() / "go_node_engine" / "build"
|
|
76
87
|
os.chdir(node_engine_build_path)
|
|
77
|
-
run_in_shell(shell_cmd="
|
|
78
|
-
run_in_shell(shell_cmd=f"
|
|
88
|
+
run_in_shell(shell_cmd="bash build.sh")
|
|
89
|
+
run_in_shell(shell_cmd=f"bash install.sh {architecture.value}")
|
|
79
90
|
logger.info("Successfully rebuild the NodeEngine.")
|
|
80
91
|
|
|
81
92
|
if restart:
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import pathlib
|
|
2
|
-
|
|
3
|
-
import typer
|
|
4
|
-
|
|
5
|
-
from oak_cli.configuration.auxiliary import ConfigKey, prompt_for_path
|
|
6
|
-
from oak_cli.configuration.common import (
|
|
7
|
-
check_and_handle_config_file,
|
|
8
|
-
get_config_value,
|
|
9
|
-
handle_missing_key_access_attempt,
|
|
10
|
-
update_config_value,
|
|
11
|
-
)
|
|
12
|
-
from oak_cli.utils.typer_augmentations import AliasGroup
|
|
13
|
-
|
|
14
|
-
app = typer.Typer(cls=AliasGroup)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def get_flops_repo_path_from_config() -> pathlib.Path:
|
|
18
|
-
check_and_handle_config_file()
|
|
19
|
-
config_string = get_config_value(ConfigKey.FLOPS_REPO_PATH_KEY)
|
|
20
|
-
handle_missing_key_access_attempt(
|
|
21
|
-
config_string_key=config_string,
|
|
22
|
-
what_should_be_found="FLOps addon repository path",
|
|
23
|
-
)
|
|
24
|
-
return pathlib.Path(config_string)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@app.command(
|
|
28
|
-
"configure",
|
|
29
|
-
help="Configure the path to the FLOps addon repo.",
|
|
30
|
-
)
|
|
31
|
-
def configure_main_oak_repo_path() -> None:
|
|
32
|
-
# NOTE: There is no support for paths as input params with proper autocomplete.
|
|
33
|
-
flops_repo = prompt_for_path(path_name="the main oakestra repository")
|
|
34
|
-
check_and_handle_config_file()
|
|
35
|
-
update_config_value(
|
|
36
|
-
key=ConfigKey.FLOPS_REPO_PATH_KEY,
|
|
37
|
-
value=str(flops_repo),
|
|
38
|
-
)
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import pathlib
|
|
2
|
-
|
|
3
|
-
import typer
|
|
4
|
-
|
|
5
|
-
from oak_cli.configuration.auxiliary import ConfigKey, prompt_for_path
|
|
6
|
-
from oak_cli.configuration.common import (
|
|
7
|
-
check_and_handle_config_file,
|
|
8
|
-
get_config_value,
|
|
9
|
-
handle_missing_key_access_attempt,
|
|
10
|
-
update_config_value,
|
|
11
|
-
)
|
|
12
|
-
from oak_cli.utils.typer_augmentations import AliasGroup
|
|
13
|
-
|
|
14
|
-
app = typer.Typer(cls=AliasGroup)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def get_main_oak_repo_path_from_config() -> pathlib.Path:
|
|
18
|
-
check_and_handle_config_file()
|
|
19
|
-
config_string = get_config_value(ConfigKey.MAIN_OAK_REPO_PATH_KEY)
|
|
20
|
-
handle_missing_key_access_attempt(
|
|
21
|
-
config_string_key=config_string,
|
|
22
|
-
what_should_be_found="main oakestra repository path",
|
|
23
|
-
)
|
|
24
|
-
return pathlib.Path(config_string)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@app.command(
|
|
28
|
-
"configure",
|
|
29
|
-
help="Configure the path to the main oakestra repo.",
|
|
30
|
-
)
|
|
31
|
-
def configure_main_oak_repo_path() -> None:
|
|
32
|
-
# NOTE: There is no support for paths as input params with proper autocomplete.
|
|
33
|
-
main_oak_repo = prompt_for_path(path_name="the main oakestra repository")
|
|
34
|
-
check_and_handle_config_file()
|
|
35
|
-
update_config_value(
|
|
36
|
-
key=ConfigKey.MAIN_OAK_REPO_PATH_KEY,
|
|
37
|
-
value=str(main_oak_repo),
|
|
38
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/projects/mnist_sklearn_large.SLA.json
RENAMED
|
File without changes
|
{oak_cli-0.3.7 → oak_cli-0.3.9}/oak_cli/addons/flops/SLAs/projects/mnist_sklearn_small.SLA.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|