oak-cli 0.3.4__tar.gz → 0.3.6__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.
Files changed (83) hide show
  1. {oak_cli-0.3.4 → oak_cli-0.3.6}/PKG-INFO +1 -1
  2. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/SLAs/projects/common.py +1 -0
  3. oak_cli-0.3.6/oak_cli/addons/flops/SLAs/projects/hierarchical_mnist_sklearn_small.SLA.json +22 -0
  4. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/SLAs/projects/mnist_sklearn_small.SLA.json +4 -3
  5. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/ansible/playbooks/install_fundamentals.yml +3 -3
  6. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/apps/SLAs/dummy_tester.SLA.json +13 -5
  7. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/installer/main.py +4 -2
  8. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/main.py +7 -0
  9. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/services/auxiliary.py +5 -1
  10. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/common.py +3 -0
  11. oak_cli-0.3.6/oak_cli/worker/main.py +28 -0
  12. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/worker/node_engine.py +38 -1
  13. {oak_cli-0.3.4 → oak_cli-0.3.6}/pyproject.toml +1 -1
  14. oak_cli-0.3.4/oak_cli/worker/main.py +0 -32
  15. {oak_cli-0.3.4 → oak_cli-0.3.6}/README.md +0 -0
  16. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/__init__.py +0 -0
  17. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/__init__.py +0 -0
  18. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/SLAs/__init__.py +0 -0
  19. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/SLAs/common.py +0 -0
  20. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/SLAs/mocks/__init__.py +0 -0
  21. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/SLAs/mocks/cifar10_simple.SLA.json +0 -0
  22. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/SLAs/mocks/common.py +0 -0
  23. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/SLAs/mocks/mnist_multi.SLA.json +0 -0
  24. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/SLAs/mocks/mnist_simple.SLA.json +0 -0
  25. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/SLAs/projects/__init__.py +0 -0
  26. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/SLAs/projects/cifar10_keras.SLA.json +0 -0
  27. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/SLAs/projects/cifar10_pytorch.SLA.json +0 -0
  28. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/SLAs/projects/mnist_sklearn_large.SLA.json +0 -0
  29. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/__init__.py +0 -0
  30. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/flops/main.py +0 -0
  31. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/addons/main.py +0 -0
  32. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/ansible/__init__.py +0 -0
  33. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/ansible/ansible.cfg +0 -0
  34. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/ansible/hostfile +0 -0
  35. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/ansible/python_utils.py +0 -0
  36. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/apps/SLAs/__init__.py +0 -0
  37. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/apps/SLAs/blank_app_without_services.SLA.json +0 -0
  38. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/apps/SLAs/common.py +0 -0
  39. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/apps/SLAs/default_app_with_services.SLA.json +0 -0
  40. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/apps/SLAs/inference_tester_mnist_sklearn.SLA.json +0 -0
  41. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/apps/SLAs/python.SLA.json +0 -0
  42. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/apps/__init__.py +0 -0
  43. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/apps/auxiliary.py +0 -0
  44. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/apps/common.py +0 -0
  45. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/apps/main.py +0 -0
  46. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/configuration/__init__.py +0 -0
  47. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/configuration/addon_repos.py +0 -0
  48. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/configuration/auxiliary.py +0 -0
  49. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/configuration/common.py +0 -0
  50. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/configuration/local_machine_purpose.py +0 -0
  51. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/configuration/main.py +0 -0
  52. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/configuration/main_oak_repo.py +0 -0
  53. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/docker/__init__.py +0 -0
  54. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/docker/aux.py +0 -0
  55. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/docker/aux_dockers/node_engine_log_observer.docker-compose.yml +0 -0
  56. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/docker/cluster_orchestrator.py +0 -0
  57. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/docker/common.py +0 -0
  58. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/docker/enums.py +0 -0
  59. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/docker/main.py +0 -0
  60. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/docker/root_orchestrator.py +0 -0
  61. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/installer/__init__.py +0 -0
  62. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/services/__init__.py +0 -0
  63. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/services/_future_ideas.py +0 -0
  64. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/services/common.py +0 -0
  65. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/services/main.py +0 -0
  66. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/__init__.py +0 -0
  67. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/api/__init__.py +0 -0
  68. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/api/common.py +0 -0
  69. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/api/custom_http.py +0 -0
  70. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/api/custom_requests.py +0 -0
  71. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/api/login.py +0 -0
  72. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/exceptions/__init__.py +0 -0
  73. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/exceptions/main.py +0 -0
  74. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/exceptions/types.py +0 -0
  75. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/exceptions.py +0 -0
  76. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/logging.py +0 -0
  77. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/styling.py +0 -0
  78. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/typer_augmentations.py +0 -0
  79. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/utils/types.py +0 -0
  80. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/worker/__init__.py +0 -0
  81. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/worker/common.py +0 -0
  82. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/worker/ctr.py +0 -0
  83. {oak_cli-0.3.4 → oak_cli-0.3.6}/oak_cli/worker/net_manager.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oak_cli
3
- Version: 0.3.4
3
+ Version: 0.3.6
4
4
  Summary:
5
5
  Author: Alexander Malyuk
6
6
  Author-email: malyuk.alexander1999@gmail.com
@@ -7,6 +7,7 @@ class FLOpsProjectSLAs(FLOpsSLAs):
7
7
  CIFAR10_KERAS = "cifar10_keras"
8
8
  CIFAR10_PYTORCH = "cifar10_pytorch"
9
9
  MNIST_SKLEARN_SMALL = "mnist_sklearn_small"
10
+ HIERARCHICAL_MNIST_SKLEARN_SMALL = "hierarchical_mnist_sklearn_small"
10
11
  MNIST_SKLEARN_LARGE = "mnist_sklearn_large"
11
12
 
12
13
  # Note: This should be refactored and placed in the common parent class.
@@ -0,0 +1,22 @@
1
+ {
2
+ "verbose": true,
3
+ "customerID": "Admin",
4
+ "ml_repo_url": "https://github.com/Malyuk-A/flops_ml_repo_mnist_sklearn",
5
+ "ml_model_flavor": "sklearn",
6
+ "use_devel_base_images": true,
7
+ "training_configuration": {
8
+ "mode": "hierarchical",
9
+ "data_tags": ["mnist"],
10
+ "training_cycles": 2,
11
+ "training_rounds": 3,
12
+ "min_available_learners":2,
13
+ "min_fit_learners": 2,
14
+ "min_evaluate_learners": 2
15
+ },
16
+ "post_training_steps": ["build_image_for_trained_model", "deploy_trained_model_image"],
17
+ "resource_constraints": {
18
+ "memory": 100,
19
+ "vcpus": 1,
20
+ "storage": 0
21
+ }
22
+ }
@@ -5,11 +5,12 @@
5
5
  "ml_model_flavor": "sklearn",
6
6
  "use_devel_base_images": true,
7
7
  "training_configuration": {
8
+ "mode": "classic",
8
9
  "data_tags": ["mnist"],
9
10
  "training_rounds": 2,
10
- "min_available_clients":2,
11
- "min_fit_clients": 2,
12
- "min_evaluate_clients": 2
11
+ "min_available_learners":2,
12
+ "min_fit_learners": 2,
13
+ "min_evaluate_learners": 2
13
14
  },
14
15
  "post_training_steps": ["build_image_for_trained_model", "deploy_trained_model_image"],
15
16
  "resource_constraints": {
@@ -1,4 +1,4 @@
1
- - name: Install Fundamental non-python dependencies for Oakestra, including Git, Docker, and Docker Compose, etc.
1
+ - name: Install Fundamental non-python dependencies for Oakestra, including Git, Docker (with Compose), and Go, etc.
2
2
  hosts: localhost
3
3
  become: yes
4
4
 
@@ -22,5 +22,5 @@
22
22
  - role: geerlingguy.docker
23
23
  vars:
24
24
  docker_install_compose: true
25
-
26
- # TODO / Future Work: Add Golang installation role/task
25
+ # Install Go
26
+ - role: gantsign.golang
@@ -10,7 +10,7 @@
10
10
  "microservices": [
11
11
  {
12
12
  "microserviceID": "",
13
- "microservice_name": "curl",
13
+ "microservice_name": "curl2",
14
14
  "microservice_namespace": "test",
15
15
  "virtualization": "container",
16
16
  "cmd": [
@@ -28,7 +28,15 @@
28
28
  "code": "docker.io/curlimages/curl:7.82.0",
29
29
  "state": "",
30
30
  "port": "9080",
31
- "added_files": []
31
+ "added_files": [],
32
+ "constraints":[
33
+ {
34
+ "type":"clusters",
35
+ "allowed": [
36
+ "fictional_cluster"
37
+ ]
38
+ }
39
+ ]
32
40
  },
33
41
  {
34
42
  "microserviceID": "",
@@ -52,9 +60,9 @@
52
60
  "added_files": [],
53
61
  "constraints":[
54
62
  {
55
- "type":"addons",
56
- "needs": [
57
- "FLOps-learner"
63
+ "type":"clusters",
64
+ "allowed": [
65
+ "alex_cluster"
58
66
  ]
59
67
  }
60
68
  ]
@@ -4,6 +4,8 @@ import typer
4
4
  from oak_cli.ansible.python_utils import CliPlaybook
5
5
  from oak_cli.utils.common import run_in_shell
6
6
 
7
+ ANSIBLE_GALAXY_ROLES = " ".join(("geerlingguy.docker", "gantsign.golang"))
8
+
7
9
  app = typer.Typer()
8
10
 
9
11
 
@@ -15,7 +17,7 @@ app = typer.Typer()
15
17
  """,
16
18
  )
17
19
  def install_fundamentals() -> None:
18
- # NOTE: The following playbook requires a ansible-galaxy role to be installed on the machine.
20
+ # NOTE: The following playbook requires ansible-galaxy roles to be installed on the machine.
19
21
  # Installing it via a dedicated playbook does not work due to ansible-access right issues.
20
- run_in_shell(shell_cmd="ansible-galaxy install geerlingguy.docker")
22
+ run_in_shell(shell_cmd=f"ansible-galaxy install {ANSIBLE_GALAXY_ROLES}")
21
23
  ansible_runner.run(playbook=CliPlaybook.INSTALL_FUNDAMENTALS.get_path())
@@ -16,6 +16,7 @@ from oak_cli.configuration.local_machine_purpose import (
16
16
  LocalMachinePurpose,
17
17
  check_if_local_machine_has_required_purposes,
18
18
  )
19
+ from oak_cli.utils.common import get_env_var
19
20
  from oak_cli.utils.logging import logger
20
21
  from oak_cli.utils.typer_augmentations import AliasGroup, typer_help_text
21
22
 
@@ -99,6 +100,12 @@ def show_version():
99
100
  logger.info(f"OAK-CLI version: '{version('oak_cli')}'")
100
101
 
101
102
 
103
+ @app.command("api-docs", help="Shows a links to the Swagger api-docs for Oakestra.")
104
+ def show_api_docs():
105
+ api_docs_link = f"http://{get_env_var('SYSTEM_MANAGER_URL')}:1000/api/docs"
106
+ logger.info(f"Oakestra root API docs: '{api_docs_link}'")
107
+
108
+
102
109
  def main():
103
110
  app()
104
111
 
@@ -85,7 +85,11 @@ def generate_current_services_table(
85
85
  caption += f" of app: '{app_name} - {app_id}'"
86
86
  table = create_table(caption=caption, verbosity=verbosity, live=live)
87
87
  add_column(table, column_name="Service Name", style=OAK_GREEN)
88
- add_column(table, column_name="Service ID")
88
+ add_column(
89
+ table,
90
+ column_name="Service ID",
91
+ no_wrap=(verbosity == Verbosity.SIMPLE),
92
+ )
89
93
  if verbosity == Verbosity.DETAILED:
90
94
  add_column(table, column_name="Status", style=OAK_WHITE)
91
95
  add_column(table, column_name="Instances", style=OAK_WHITE, no_wrap=True)
@@ -18,6 +18,9 @@ def run_in_shell(
18
18
  capture_output: bool = True,
19
19
  check: bool = True,
20
20
  text: bool = False,
21
+ # NOTE: subprocess.run usually expects an array of strings as the cmd.
22
+ # It is not able to handle pipes ("|"), etc.
23
+ # If shell=True is enabled then it expects a single string as cmd and can handle pipes, etc.
21
24
  pure_shell: bool = False,
22
25
  ) -> subprocess.CompletedProcess[bytes]:
23
26
  return subprocess.run(
@@ -0,0 +1,28 @@
1
+ import typer
2
+
3
+ import oak_cli.worker.ctr
4
+ import oak_cli.worker.net_manager
5
+ import oak_cli.worker.node_engine
6
+ from oak_cli.utils.typer_augmentations import typer_help_text
7
+ from oak_cli.worker.net_manager import NET_MANAGER_NAME
8
+ from oak_cli.worker.node_engine import NODE_ENGINE_NAME
9
+
10
+ app = typer.Typer()
11
+
12
+ app.add_typer(
13
+ typer_instance=oak_cli.worker.ctr.app,
14
+ name="ctr",
15
+ help=typer_help_text("ctr"),
16
+ )
17
+
18
+ app.add_typer(
19
+ typer_instance=oak_cli.worker.net_manager.app,
20
+ name="net-manager",
21
+ help=typer_help_text(NET_MANAGER_NAME),
22
+ )
23
+
24
+ app.add_typer(
25
+ typer_instance=oak_cli.worker.node_engine.app,
26
+ name="node-engine",
27
+ help=typer_help_text(NODE_ENGINE_NAME),
28
+ )
@@ -1,20 +1,33 @@
1
+ import enum
2
+ import os
1
3
  from typing import Optional
2
4
 
3
5
  import typer
4
6
  from typing_extensions import Annotated
5
7
 
8
+ from oak_cli.configuration.local_machine_purpose import (
9
+ LocalMachinePurpose,
10
+ check_if_local_machine_has_required_purposes,
11
+ )
12
+ from oak_cli.configuration.main_oak_repo import get_main_oak_repo_path_from_config
6
13
  from oak_cli.utils.common import get_env_var, run_in_shell
7
14
  from oak_cli.utils.logging import logger
8
15
  from oak_cli.utils.typer_augmentations import AliasGroup
9
16
  from oak_cli.worker.common import ProcessStatus, get_process_status, stop_process
10
17
 
11
- app = typer.Typer(cls=AliasGroup)
18
+
19
+ class Architecture(enum.Enum):
20
+ AMD64 = "amd64"
21
+ ARM64 = "arm64"
12
22
 
13
23
 
14
24
  NODE_ENGINE_NAME = "NodeEngine"
15
25
  NODE_ENGINE_CMD_PREFIX = f"sudo {NODE_ENGINE_NAME}"
16
26
 
17
27
 
28
+ app = typer.Typer(cls=AliasGroup)
29
+
30
+
18
31
  @app.command("start", help=f"Starts the {NODE_ENGINE_NAME}.")
19
32
  def start_node_engine(
20
33
  use_ml_data_server_for_flops_addon_learner: Annotated[
@@ -43,3 +56,27 @@ def get_node_engine_status(print_status: bool = True) -> ProcessStatus:
43
56
  @app.command("stop", help=f"stops the {NODE_ENGINE_NAME}.")
44
57
  def stop_node_engine() -> None:
45
58
  stop_process(process_cmd=NODE_ENGINE_CMD_PREFIX, process_name=NODE_ENGINE_NAME)
59
+
60
+
61
+ if check_if_local_machine_has_required_purposes(
62
+ required_purposes=[LocalMachinePurpose.DEVELOPMENT]
63
+ ):
64
+ # TODO: Figure out architecture automatically.
65
+ @app.command(
66
+ "rebuild",
67
+ help=f"rebuilds (and restarts) the {NODE_ENGINE_NAME}.",
68
+ )
69
+ def rebuild_node_engine(
70
+ architecture: Architecture = Architecture.AMD64, restart: bool = True
71
+ ) -> None:
72
+ if restart:
73
+ stop_node_engine()
74
+
75
+ node_engine_build_path = get_main_oak_repo_path_from_config() / "go_node_engine" / "build"
76
+ os.chdir(node_engine_build_path)
77
+ run_in_shell(shell_cmd="./build.sh")
78
+ run_in_shell(shell_cmd=f". install.sh {architecture.value}")
79
+ logger.info("Successfully rebuild the NodeEngine.")
80
+
81
+ if restart:
82
+ start_node_engine()
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "oak_cli"
3
- version = "0.3.4"
3
+ version = "0.3.6"
4
4
  description = ""
5
5
  authors = ["Alexander Malyuk <malyuk.alexander1999@gmail.com>"]
6
6
  readme = "README.md"
@@ -1,32 +0,0 @@
1
- import typer
2
-
3
- import oak_cli.worker.ctr
4
- import oak_cli.worker.net_manager
5
- import oak_cli.worker.node_engine
6
- from oak_cli.utils.typer_augmentations import typer_help_text
7
-
8
- # from oak_cli.worker.net_manager import NET_MANAGER_NAME
9
- # from oak_cli.worker.node_engine import NODE_ENGINE_NAME
10
-
11
- app = typer.Typer()
12
-
13
- app.add_typer(
14
- typer_instance=oak_cli.worker.ctr.app,
15
- name="ctr",
16
- help=typer_help_text("ctr"),
17
- )
18
-
19
- # TODO Both work but are very flaky for what-ever reason.
20
- # So to avoid flaky/buggy commands they are commented out for now.
21
-
22
- # app.add_typer(
23
- # typer_instance=oak_cli.worker.net_manager.app,
24
- # name="net-manager",
25
- # help=typer_help_text(NET_MANAGER_NAME),
26
- # )
27
-
28
- # app.add_typer(
29
- # typer_instance=oak_cli.worker.node_engine.app,
30
- # name="node-engine",
31
- # help=typer_help_text(NODE_ENGINE_NAME),
32
- # )
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