vantage6 5.0.0a33__tar.gz → 5.0.0a35__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.

Potentially problematic release.


This version of vantage6 might be problematic. Click here for more details.

Files changed (100) hide show
  1. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/PKG-INFO +4 -4
  2. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/pyproject.toml +4 -4
  3. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/tests_cli/test_node_cli.py +13 -51
  4. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/tests_cli/test_server_cli.py +1 -1
  5. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/tests_cli/test_wizard.py +1 -1
  6. vantage6-5.0.0a35/vantage6/cli/algostore/new.py +120 -0
  7. vantage6-5.0.0a35/vantage6/cli/algostore/remove.py +36 -0
  8. vantage6-5.0.0a35/vantage6/cli/algostore/start.py +76 -0
  9. vantage6-5.0.0a35/vantage6/cli/algostore/stop.py +58 -0
  10. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/cli.py +31 -33
  11. {vantage6-5.0.0a33/vantage6/cli/server → vantage6-5.0.0a35/vantage6/cli/common}/new.py +32 -26
  12. vantage6-5.0.0a35/vantage6/cli/common/remove.py +54 -0
  13. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/common/start.py +36 -213
  14. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/common/stop.py +78 -0
  15. vantage6-5.0.0a35/vantage6/cli/common/utils.py +414 -0
  16. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/configuration_manager.py +90 -12
  17. vantage6-5.0.0a35/vantage6/cli/configuration_wizard.py +222 -0
  18. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/context/algorithm_store.py +7 -6
  19. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/context/base_server.py +22 -30
  20. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/context/node.py +14 -17
  21. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/context/server.py +16 -7
  22. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/globals.py +29 -8
  23. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/node/attach.py +1 -0
  24. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/node/common/__init__.py +1 -1
  25. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/node/create_private_key.py +9 -6
  26. vantage6-5.0.0a35/vantage6/cli/node/files.py +29 -0
  27. vantage6-5.0.0a35/vantage6/cli/node/new.py +380 -0
  28. vantage6-5.0.0a35/vantage6/cli/node/remove.py +37 -0
  29. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/node/restart.py +30 -51
  30. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/node/set_api_key.py +7 -4
  31. vantage6-5.0.0a35/vantage6/cli/node/start.py +111 -0
  32. vantage6-5.0.0a35/vantage6/cli/node/stop.py +71 -0
  33. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/server/import_.py +1 -2
  34. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/server/list.py +0 -3
  35. vantage6-5.0.0a35/vantage6/cli/server/new.py +109 -0
  36. vantage6-5.0.0a35/vantage6/cli/server/remove.py +31 -0
  37. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/server/shell.py +1 -1
  38. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/server/start.py +22 -20
  39. vantage6-5.0.0a35/vantage6/cli/server/stop.py +70 -0
  40. vantage6-5.0.0a35/vantage6/cli/template/algo_store_config.j2 +195 -0
  41. vantage6-5.0.0a35/vantage6/cli/template/node_config.j2 +336 -0
  42. vantage6-5.0.0a35/vantage6/cli/template/server_config.j2 +256 -0
  43. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/utils.py +0 -2
  44. vantage6-5.0.0a33/vantage6/cli/algostore/new.py +0 -61
  45. vantage6-5.0.0a33/vantage6/cli/algostore/remove.py +0 -52
  46. vantage6-5.0.0a33/vantage6/cli/algostore/start.py +0 -107
  47. vantage6-5.0.0a33/vantage6/cli/algostore/stop.py +0 -61
  48. vantage6-5.0.0a33/vantage6/cli/common/utils.py +0 -177
  49. vantage6-5.0.0a33/vantage6/cli/configuration_wizard.py +0 -587
  50. vantage6-5.0.0a33/vantage6/cli/node/clean.py +0 -46
  51. vantage6-5.0.0a33/vantage6/cli/node/files.py +0 -42
  52. vantage6-5.0.0a33/vantage6/cli/node/new.py +0 -60
  53. vantage6-5.0.0a33/vantage6/cli/node/remove.py +0 -113
  54. vantage6-5.0.0a33/vantage6/cli/node/start.py +0 -334
  55. vantage6-5.0.0a33/vantage6/cli/node/stop.py +0 -131
  56. vantage6-5.0.0a33/vantage6/cli/server/remove.py +0 -52
  57. vantage6-5.0.0a33/vantage6/cli/server/stop.py +0 -50
  58. vantage6-5.0.0a33/vantage6/cli/template/algo_store_config.j2 +0 -22
  59. vantage6-5.0.0a33/vantage6/cli/template/node_config.j2 +0 -33
  60. vantage6-5.0.0a33/vantage6/cli/template/server_config.j2 +0 -34
  61. vantage6-5.0.0a33/vantage6/cli/template/server_import_config.j2 +0 -31
  62. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/.gitignore +0 -0
  63. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/Makefile +0 -0
  64. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/README.md +0 -0
  65. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/tests_cli/__init__.py +0 -0
  66. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/tests_cli/test_client_script.py +0 -0
  67. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/tests_cli/test_example.py +0 -0
  68. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/__init__.py +0 -0
  69. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/algorithm/create.py +0 -0
  70. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/algorithm/generate_algorithm_json.py +0 -0
  71. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/algorithm/update.py +0 -0
  72. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/algostore/attach.py +0 -0
  73. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/algostore/files.py +0 -0
  74. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/algostore/list.py +0 -0
  75. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/common/decorator.py +0 -0
  76. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/config.py +0 -0
  77. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/context/__init__.py +0 -0
  78. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/dev/create.py +0 -0
  79. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/dev/data/km_dataset.csv +0 -0
  80. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/dev/remove.py +0 -0
  81. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/node/list.py +0 -0
  82. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/node/version.py +0 -0
  83. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/prometheus/monitoring_manager.py +0 -0
  84. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/prometheus/prometheus.yml +0 -0
  85. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/rabbitmq/__init__.py +0 -0
  86. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/rabbitmq/definitions.py +0 -0
  87. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/rabbitmq/queue_manager.py +0 -0
  88. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/rabbitmq/rabbitmq.config +0 -0
  89. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/server/attach.py +0 -0
  90. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/server/common/__init__.py +0 -0
  91. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/server/files.py +0 -0
  92. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/server/version.py +0 -0
  93. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/test/algo_test_scripts/algo_test_arguments.py +0 -0
  94. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/test/algo_test_scripts/algo_test_script.py +0 -0
  95. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/test/client_script.py +0 -0
  96. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/test/common/diagnostic_runner.py +0 -0
  97. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/test/feature_tester.py +0 -0
  98. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/test/integration_test.py +0 -0
  99. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/use/context.py +0 -0
  100. {vantage6-5.0.0a33 → vantage6-5.0.0a35}/vantage6/cli/use/namespace.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vantage6
3
- Version: 5.0.0a33
3
+ Version: 5.0.0a35
4
4
  Summary: vantage6 command line interface
5
5
  Author: Vantage6 Team
6
6
  Maintainer-email: Frank Martin <f.martin@iknl.nl>, Bart van Beusekom <b.vanbeusekom@iknl.nl>
@@ -8,7 +8,7 @@ License: MIT
8
8
  Requires-Python: >=3.13
9
9
  Requires-Dist: click==8.1.3
10
10
  Requires-Dist: colorama==0.4.6
11
- Requires-Dist: copier==9.2.0
11
+ Requires-Dist: copier==9.9.1
12
12
  Requires-Dist: docker==7.1.0
13
13
  Requires-Dist: ipython==8.10.0
14
14
  Requires-Dist: jinja2==3.1.6
@@ -18,8 +18,8 @@ Requires-Dist: questionary==1.10.0
18
18
  Requires-Dist: rich==13.5.2
19
19
  Requires-Dist: schema==0.7.5
20
20
  Requires-Dist: sqlalchemy==2.0.37
21
- Requires-Dist: vantage6-client==5.0.0a33
22
- Requires-Dist: vantage6-common==5.0.0a33
21
+ Requires-Dist: vantage6-client==5.0.0a35
22
+ Requires-Dist: vantage6-common==5.0.0a35
23
23
  Provides-Extra: dev
24
24
  Requires-Dist: black; extra == 'dev'
25
25
  Requires-Dist: coverage==7.10.2; extra == 'dev'
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "vantage6"
7
- version = "5.0.0a33"
7
+ version = "5.0.0a35"
8
8
  description = "vantage6 command line interface"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -19,7 +19,7 @@ requires-python = ">=3.13"
19
19
  dependencies = [
20
20
  "click==8.1.3",
21
21
  "colorama==0.4.6",
22
- "copier==9.2.0",
22
+ "copier==9.9.1",
23
23
  "docker==7.1.0",
24
24
  "ipython==8.10.0",
25
25
  "jinja2==3.1.6",
@@ -29,8 +29,8 @@ dependencies = [
29
29
  "rich==13.5.2",
30
30
  "schema==0.7.5",
31
31
  "sqlalchemy==2.0.37",
32
- "vantage6-common==5.0.0a33",
33
- "vantage6-client==5.0.0a33",
32
+ "vantage6-common==5.0.0a35",
33
+ "vantage6-client==5.0.0a35",
34
34
  ]
35
35
 
36
36
  [project.optional-dependencies]
@@ -1,28 +1,27 @@
1
- import unittest
1
+ import contextlib
2
2
  import logging
3
3
  import os
4
- import contextlib
5
-
6
- from unittest.mock import MagicMock, patch
7
- from pathlib import Path
4
+ import unittest
8
5
  from io import BytesIO, StringIO
6
+ from pathlib import Path
7
+ from unittest.mock import MagicMock, patch
8
+
9
9
  from click.testing import CliRunner
10
- from docker.errors import APIError
11
10
 
12
- from vantage6.common.globals import Ports
13
- from vantage6.cli.globals import APPNAME
14
11
  from vantage6.common import STRING_ENCODING
12
+ from vantage6.common.globals import Ports
13
+
15
14
  from vantage6.cli.common.utils import print_log_worker
15
+ from vantage6.cli.globals import APPNAME
16
+ from vantage6.cli.node.attach import cli_node_attach
17
+ from vantage6.cli.node.common import create_client_and_authenticate
18
+ from vantage6.cli.node.create_private_key import cli_node_create_private_key
19
+ from vantage6.cli.node.files import cli_node_files
16
20
  from vantage6.cli.node.list import cli_node_list
17
21
  from vantage6.cli.node.new import cli_node_new_configuration
18
- from vantage6.cli.node.files import cli_node_files
19
- from vantage6.cli.node.start import cli_node_start
20
22
  from vantage6.cli.node.restart import cli_node_restart
23
+ from vantage6.cli.node.start import cli_node_start
21
24
  from vantage6.cli.node.stop import cli_node_stop
22
- from vantage6.cli.node.attach import cli_node_attach
23
- from vantage6.cli.node.create_private_key import cli_node_create_private_key
24
- from vantage6.cli.node.clean import cli_node_clean
25
- from vantage6.cli.node.common import create_client_and_authenticate
26
25
 
27
26
 
28
27
  class NodeCLITest(unittest.TestCase):
@@ -302,25 +301,6 @@ class NodeCLITest(unittest.TestCase):
302
301
  runner.invoke(cli_node_attach)
303
302
  attach_logs.assert_called_once_with("app=node")
304
303
 
305
- @patch("vantage6.cli.node.clean.q")
306
- @patch("docker.DockerClient.volumes")
307
- @patch("vantage6.cli.node.clean.check_docker_running", return_value=True)
308
- def test_clean(self, check_docker, volumes, q):
309
- """Clean Docker volumes without errors."""
310
- volume1 = MagicMock()
311
- volume1.name = "some-name-tmpvol"
312
- volumes.list.return_value = [volume1]
313
-
314
- question = MagicMock(name="pop-the-question")
315
- question.ask.return_value = True
316
- q.confirm.return_value = question
317
-
318
- runner = CliRunner()
319
- result = runner.invoke(cli_node_clean)
320
-
321
- # check exit code
322
- self.assertEqual(result.exit_code, 0)
323
-
324
304
  @patch("vantage6.cli.node.create_private_key.create_client_and_authenticate")
325
305
  @patch("vantage6.cli.node.common.NodeContext")
326
306
  @patch("vantage6.cli.node.create_private_key.NodeContext")
@@ -387,24 +367,6 @@ class NodeCLITest(unittest.TestCase):
387
367
 
388
368
  self.assertEqual(result.exit_code, 1)
389
369
 
390
- @patch("vantage6.cli.node.clean.q")
391
- @patch("docker.DockerClient.volumes")
392
- @patch("vantage6.common.docker.addons.check_docker_running")
393
- def test_clean_docker_error(self, check_docker, volumes, q):
394
- volume1 = MagicMock()
395
- volume1.name = "some-name-tmpvol"
396
- volume1.remove.side_effect = APIError("Testing")
397
- volumes.list.return_value = [volume1]
398
- question = MagicMock(name="pop-the-question")
399
- question.ask.return_value = True
400
- q.confirm.return_value = question
401
-
402
- runner = CliRunner()
403
- result = runner.invoke(cli_node_clean)
404
-
405
- # check exit code
406
- self.assertEqual(result.exit_code, 1)
407
-
408
370
  def test_print_log_worker(self):
409
371
  stream = BytesIO("Hello!".encode(STRING_ENCODING))
410
372
  temp_stdout = StringIO()
@@ -134,7 +134,7 @@ class ServerCLITest(unittest.TestCase):
134
134
  """Stop server without errors."""
135
135
 
136
136
  container1 = MagicMock()
137
- container1.name = f"{APPNAME}-iknl-system-{InstanceType.SERVER}"
137
+ container1.name = f"{APPNAME}-iknl-system-{InstanceType.SERVER.value}"
138
138
  containers.containers.list.return_value = [container1]
139
139
 
140
140
  runner = CliRunner()
@@ -92,7 +92,7 @@ class WizardTest(unittest.TestCase):
92
92
  False,
93
93
  ]
94
94
 
95
- config = server_configuration_questionaire("vantage6")
95
+ config = server_configuration_questionaire()
96
96
 
97
97
  keys = [
98
98
  "description",
@@ -0,0 +1,120 @@
1
+ import click
2
+ import questionary as q
3
+
4
+ from vantage6.common.globals import (
5
+ DEFAULT_API_PATH,
6
+ InstanceType,
7
+ Ports,
8
+ )
9
+
10
+ from vantage6.cli.common.new import new
11
+ from vantage6.cli.configuration_wizard import add_common_server_config
12
+ from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS
13
+
14
+
15
+ @click.command()
16
+ @click.option(
17
+ "-n", "--name", default=None, help="Name of the configuration you want to use."
18
+ )
19
+ @click.option(
20
+ "--system",
21
+ "system_folders",
22
+ flag_value=True,
23
+ help="Use system folders instead of user folders. This is the default",
24
+ )
25
+ @click.option(
26
+ "--user",
27
+ "system_folders",
28
+ flag_value=False,
29
+ default=DEFAULT_SERVER_SYSTEM_FOLDERS,
30
+ help="Use user folders instead of system folders",
31
+ )
32
+ @click.option("--context", default=None, help="Kubernetes context to use")
33
+ @click.option(
34
+ "--namespace",
35
+ default=None,
36
+ help="Kubernetes namespace to use",
37
+ )
38
+ def cli_algo_store_new(
39
+ name: str, system_folders: bool, namespace: str, context: str
40
+ ) -> None:
41
+ """
42
+ Create a new server configuration.
43
+ """
44
+
45
+ new(
46
+ questionnaire_function=algo_store_configuration_questionaire,
47
+ name=name,
48
+ system_folders=system_folders,
49
+ namespace=namespace,
50
+ context=context,
51
+ type_=InstanceType.ALGORITHM_STORE,
52
+ )
53
+
54
+
55
+ def algo_store_configuration_questionaire(instance_name: str) -> dict:
56
+ """
57
+ Questionary to generate a config file for the algorithm store server
58
+ instance.
59
+
60
+ Parameters
61
+ ----------
62
+ instance_name : str
63
+ Name of the server instance.
64
+
65
+ Returns
66
+ -------
67
+ dict
68
+ Dictionary with the new server configuration
69
+ """
70
+ config = {"store": {}, "database": {}}
71
+
72
+ config, is_production = add_common_server_config(
73
+ config, InstanceType.ALGORITHM_STORE, instance_name
74
+ )
75
+ if not is_production:
76
+ config["store"]["dev"] = {
77
+ "host_uri": "host.docker.internal",
78
+ "disable_review": True,
79
+ "review_own_algorithm": True,
80
+ }
81
+
82
+ default_v6_server_uri = f"http://localhost:{Ports.DEV_SERVER}{DEFAULT_API_PATH}"
83
+ default_root_username = "admin"
84
+
85
+ v6_server_uri = q.text(
86
+ "What is the Vantage6 server linked to the algorithm store? "
87
+ "Provide the link to the server endpoint.",
88
+ default=default_v6_server_uri,
89
+ ).unsafe_ask()
90
+
91
+ root_username = q.text(
92
+ "What is the username of the root user?",
93
+ default=default_root_username,
94
+ ).unsafe_ask()
95
+
96
+ config["root_user"] = {
97
+ "v6_server_uri": v6_server_uri,
98
+ "username": root_username,
99
+ }
100
+
101
+ # ask about openness of the algorithm store
102
+ config["policies"] = {}
103
+ is_open = q.confirm(
104
+ "Do you want to open the algorithm store to the public? This will allow anyone "
105
+ "to view the algorithms, but they cannot modify them.",
106
+ default=False,
107
+ ).unsafe_ask()
108
+ if is_open:
109
+ open_algos_policy = "public"
110
+ else:
111
+ is_open_to_whitelist = q.confirm(
112
+ "Do you want to allow all authenticated users to access "
113
+ "the algorithms in the store? If not allowing this, you will have to assign"
114
+ " the appropriate permissions to each user individually.",
115
+ default=True,
116
+ ).unsafe_ask()
117
+ open_algos_policy = "authenticated" if is_open_to_whitelist else "private"
118
+ config["policies"]["algorithm_view"] = open_algos_policy
119
+
120
+ return config
@@ -0,0 +1,36 @@
1
+ import click
2
+
3
+ from vantage6.common.globals import InstanceType
4
+
5
+ from vantage6.cli.common.decorator import click_insert_context
6
+ from vantage6.cli.common.remove import execute_remove
7
+ from vantage6.cli.context import AlgorithmStoreContext
8
+ from vantage6.cli.globals import InfraComponentName
9
+
10
+
11
+ @click.command()
12
+ @click_insert_context(
13
+ type_=InstanceType.ALGORITHM_STORE, include_name=True, include_system_folders=True
14
+ )
15
+ @click.option("-f", "--force", "force", flag_value=True)
16
+ def cli_algo_store_remove(
17
+ ctx: AlgorithmStoreContext, name: str, system_folders: bool, force: bool
18
+ ) -> None:
19
+ """
20
+ Function to remove an algorithm store.
21
+
22
+ Parameters
23
+ ----------
24
+ ctx : AlgorithmStoreContext
25
+ Algorithm store context object
26
+ force : bool
27
+ Whether to ask for confirmation before removing or not
28
+ """
29
+ execute_remove(
30
+ ctx,
31
+ InstanceType.ALGORITHM_STORE,
32
+ InfraComponentName.ALGORITHM_STORE,
33
+ name,
34
+ system_folders,
35
+ force,
36
+ )
@@ -0,0 +1,76 @@
1
+ import click
2
+
3
+ from vantage6.common import info
4
+ from vantage6.common.globals import (
5
+ InstanceType,
6
+ Ports,
7
+ )
8
+
9
+ from vantage6.cli.common.decorator import click_insert_context
10
+ from vantage6.cli.common.start import (
11
+ helm_install,
12
+ prestart_checks,
13
+ start_port_forward,
14
+ )
15
+ from vantage6.cli.common.utils import (
16
+ attach_logs,
17
+ create_directory_if_not_exists,
18
+ )
19
+ from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
20
+ from vantage6.cli.globals import ChartName
21
+
22
+
23
+ @click.command()
24
+ @click.option("--context", default=None, help="Kubernetes context to use")
25
+ @click.option("--namespace", default=None, help="Kubernetes namespace to use")
26
+ @click.option("--ip", default=None, help="IP address to listen on")
27
+ @click.option("-p", "--port", default=None, type=int, help="Port to listen on")
28
+ @click.option(
29
+ "--attach/--detach",
30
+ default=False,
31
+ help="Print server logs to the console after start",
32
+ )
33
+ @click_insert_context(
34
+ InstanceType.ALGORITHM_STORE, include_name=True, include_system_folders=True
35
+ )
36
+ def cli_algo_store_start(
37
+ ctx: AlgorithmStoreContext,
38
+ name: str,
39
+ system_folders: bool,
40
+ context: str,
41
+ namespace: str,
42
+ ip: str,
43
+ port: int,
44
+ attach: bool,
45
+ ) -> None:
46
+ """
47
+ Start the algorithm store.
48
+ """
49
+ info("Starting algorithm store...")
50
+
51
+ prestart_checks(
52
+ ctx, InstanceType.ALGORITHM_STORE, name, system_folders, context, namespace
53
+ )
54
+
55
+ create_directory_if_not_exists(ctx.log_dir)
56
+
57
+ helm_install(
58
+ release_name=ctx.helm_release_name,
59
+ chart_name=ChartName.ALGORITHM_STORE,
60
+ values_file=ctx.config_file,
61
+ context=context,
62
+ namespace=namespace,
63
+ )
64
+
65
+ info("Port forwarding for algorithm store")
66
+ start_port_forward(
67
+ service_name=f"{ctx.helm_release_name}-store-service",
68
+ service_port=ctx.config["store"].get("port", Ports.DEV_ALGO_STORE.value),
69
+ port=port or ctx.config["store"].get("port", Ports.DEV_ALGO_STORE.value),
70
+ ip=ip,
71
+ context=context,
72
+ namespace=namespace,
73
+ )
74
+
75
+ if attach:
76
+ attach_logs("app=store", "component=store-server")
@@ -0,0 +1,58 @@
1
+ import click
2
+
3
+ from vantage6.common import info
4
+ from vantage6.common.globals import InstanceType
5
+
6
+ from vantage6.cli.common.stop import execute_stop, helm_uninstall, stop_port_forward
7
+ from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS, InfraComponentName
8
+
9
+
10
+ @click.command()
11
+ @click.option("-n", "--name", default=None, help="Configuration name")
12
+ @click.option("--context", default=None, help="Kubernetes context to use")
13
+ @click.option("--namespace", default=None, help="Kubernetes namespace to use")
14
+ @click.option(
15
+ "--system",
16
+ "system_folders",
17
+ flag_value=True,
18
+ default=DEFAULT_SERVER_SYSTEM_FOLDERS,
19
+ help="Search for configuration in system folders instead of user folders. "
20
+ "This is the default.",
21
+ )
22
+ @click.option(
23
+ "--user",
24
+ "system_folders",
25
+ flag_value=False,
26
+ help="Search for configuration in the user folders instead of system folders.",
27
+ )
28
+ @click.option("--all", "all_stores", flag_value=True, help="Stop all algorithm stores")
29
+ def cli_algo_store_stop(
30
+ name: str,
31
+ context: str,
32
+ namespace: str,
33
+ system_folders: bool,
34
+ all_stores: bool,
35
+ ):
36
+ """
37
+ Stop one or all running algorithm store(s).
38
+ """
39
+ execute_stop(
40
+ stop_function=_stop_store,
41
+ instance_type=InstanceType.ALGORITHM_STORE,
42
+ infra_component=InfraComponentName.ALGORITHM_STORE,
43
+ stop_all=all_stores,
44
+ to_stop=name,
45
+ namespace=namespace,
46
+ context=context,
47
+ system_folders=system_folders,
48
+ )
49
+
50
+
51
+ def _stop_store(store_name: str, namespace: str, context: str) -> None:
52
+ info(f"Stopping store {store_name}...")
53
+
54
+ helm_uninstall(release_name=store_name, context=context, namespace=namespace)
55
+
56
+ stop_port_forward(service_name=f"{store_name}-store-service")
57
+
58
+ info(f"Store {store_name} stopped successfully.")
@@ -1,17 +1,19 @@
1
1
  import click
2
2
 
3
- from vantage6.cli.server.attach import cli_server_attach
4
- from vantage6.cli.server.files import cli_server_files
5
- from vantage6.cli.server.import_ import cli_server_import
6
- from vantage6.cli.server.list import cli_server_configuration_list
7
- from vantage6.cli.server.new import cli_server_new
8
- from vantage6.cli.server.remove import cli_server_remove
9
- from vantage6.cli.server.shell import cli_server_shell
10
- from vantage6.cli.server.start import cli_server_start
11
- from vantage6.cli.server.stop import cli_server_stop
12
- from vantage6.cli.server.version import cli_server_version
3
+ from vantage6.cli.algorithm.create import cli_algorithm_create
4
+ from vantage6.cli.algorithm.generate_algorithm_json import (
5
+ cli_algorithm_generate_algorithm_json,
6
+ )
7
+ from vantage6.cli.algorithm.update import cli_algorithm_update
8
+ from vantage6.cli.algostore.attach import cli_algo_store_attach
9
+ from vantage6.cli.algostore.files import cli_algo_store_files
10
+ from vantage6.cli.algostore.list import cli_algo_store_configuration_list
11
+ from vantage6.cli.algostore.new import cli_algo_store_new
12
+ from vantage6.cli.algostore.remove import cli_algo_store_remove
13
+ from vantage6.cli.algostore.start import cli_algo_store_start
14
+ from vantage6.cli.algostore.stop import cli_algo_store_stop
15
+ from vantage6.cli.globals import CLICommandName
13
16
  from vantage6.cli.node.attach import cli_node_attach
14
- from vantage6.cli.node.clean import cli_node_clean
15
17
  from vantage6.cli.node.create_private_key import cli_node_create_private_key
16
18
  from vantage6.cli.node.files import cli_node_files
17
19
  from vantage6.cli.node.list import cli_node_list
@@ -22,29 +24,26 @@ from vantage6.cli.node.set_api_key import cli_node_set_api_key
22
24
  from vantage6.cli.node.start import cli_node_start
23
25
  from vantage6.cli.node.stop import cli_node_stop
24
26
  from vantage6.cli.node.version import cli_node_version
25
- from vantage6.cli.algorithm.create import cli_algorithm_create
26
- from vantage6.cli.algorithm.update import cli_algorithm_update
27
- from vantage6.cli.algorithm.generate_algorithm_json import (
28
- cli_algorithm_generate_algorithm_json,
29
- )
27
+ from vantage6.cli.server.attach import cli_server_attach
28
+ from vantage6.cli.server.files import cli_server_files
29
+ from vantage6.cli.server.import_ import cli_server_import
30
+ from vantage6.cli.server.list import cli_server_configuration_list
31
+ from vantage6.cli.server.new import cli_server_new
32
+ from vantage6.cli.server.remove import cli_server_remove
33
+ from vantage6.cli.server.shell import cli_server_shell
34
+ from vantage6.cli.server.start import cli_server_start
35
+ from vantage6.cli.server.stop import cli_server_stop
36
+ from vantage6.cli.server.version import cli_server_version
30
37
 
31
38
  # from vantage6.cli.test.client_script import cli_test_client_script
32
- from vantage6.cli.test.feature_tester import cli_test_features
33
-
34
39
  # from vantage6.cli.test.integration_test import cli_test_integration
35
- from vantage6.cli.algostore.attach import cli_algo_store_attach
36
- from vantage6.cli.algostore.new import cli_algo_store_new
37
- from vantage6.cli.algostore.start import cli_algo_store_start
38
- from vantage6.cli.algostore.stop import cli_algo_store_stop
39
- from vantage6.cli.algostore.files import cli_algo_store_files
40
- from vantage6.cli.algostore.list import cli_algo_store_configuration_list
41
- from vantage6.cli.algostore.remove import cli_algo_store_remove
40
+ from vantage6.cli.test.feature_tester import cli_test_features
42
41
  from vantage6.cli.use.context import cli_use_context
43
42
  from vantage6.cli.use.namespace import cli_use_namespace
44
43
 
45
44
 
46
45
  # Define the server group
47
- @click.group(name="server")
46
+ @click.group(name=CLICommandName.SERVER.value)
48
47
  def cli_server() -> None:
49
48
  """
50
49
  Manage your vantage6 server instances.
@@ -65,7 +64,7 @@ cli_server.add_command(cli_server_version, name="version")
65
64
 
66
65
 
67
66
  # Define the node group
68
- @click.group(name="node")
67
+ @click.group(name=CLICommandName.NODE.value)
69
68
  def cli_node() -> None:
70
69
  """
71
70
  Manage your vantage6 node instances.
@@ -74,7 +73,6 @@ def cli_node() -> None:
74
73
 
75
74
  # Define the commands for the node group
76
75
  cli_node.add_command(cli_node_attach, name="attach")
77
- cli_node.add_command(cli_node_clean, name="clean")
78
76
  cli_node.add_command(cli_node_create_private_key, name="create-private-key")
79
77
  cli_node.add_command(cli_node_files, name="files")
80
78
  cli_node.add_command(cli_node_list, name="list")
@@ -88,7 +86,7 @@ cli_node.add_command(cli_node_version, name="version")
88
86
 
89
87
 
90
88
  # Define the dev group
91
- @click.group(name="dev")
89
+ @click.group(name=CLICommandName.DEV.value)
92
90
  def cli_dev() -> None:
93
91
  """
94
92
  Quickly manage a test network with a server and several nodes.
@@ -101,7 +99,7 @@ def cli_dev() -> None:
101
99
 
102
100
 
103
101
  # Define the algorithm group
104
- @click.group(name="algorithm")
102
+ @click.group(name=CLICommandName.ALGORITHM.value)
105
103
  def cli_algorithm() -> None:
106
104
  """
107
105
  Manage your vantage6 algorithms.
@@ -117,7 +115,7 @@ cli_algorithm.add_command(
117
115
 
118
116
 
119
117
  # Define the test group
120
- @click.group(name="test")
118
+ @click.group(name=CLICommandName.TEST.value)
121
119
  def cli_test() -> None:
122
120
  """
123
121
  Execute tests on your vantage6 infrastructure.
@@ -131,7 +129,7 @@ cli_test.add_command(cli_test_features, name="feature-test")
131
129
 
132
130
 
133
131
  # Define the algorithm-store group
134
- @click.group(name="algorithm-store")
132
+ @click.group(name=CLICommandName.ALGORITHM_STORE.value)
135
133
  def cli_algo_store() -> None:
136
134
  """
137
135
  Manage your vantage6 algorithm store server instances.
@@ -149,7 +147,7 @@ cli_algo_store.add_command(cli_algo_store_remove, name="remove")
149
147
 
150
148
 
151
149
  # Add the use group
152
- @click.group(name="use")
150
+ @click.group(name=CLICommandName.USE.value)
153
151
  def cli_use() -> None:
154
152
  """
155
153
  Manage Kubernetes context and namespace.