vantage6 5.0.0a29__tar.gz → 5.0.0a34__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 (102) hide show
  1. vantage6-5.0.0a34/.gitignore +33 -0
  2. vantage6-5.0.0a34/Makefile +22 -0
  3. vantage6-5.0.0a34/PKG-INFO +54 -0
  4. vantage6-5.0.0a34/README.md +26 -0
  5. vantage6-5.0.0a34/pyproject.toml +65 -0
  6. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/tests_cli/test_server_cli.py +1 -1
  7. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/tests_cli/test_wizard.py +1 -1
  8. vantage6-5.0.0a34/vantage6/cli/__init__.py +7 -0
  9. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/algorithm/generate_algorithm_json.py +3 -11
  10. vantage6-5.0.0a34/vantage6/cli/algostore/new.py +39 -0
  11. vantage6-5.0.0a34/vantage6/cli/algostore/start.py +73 -0
  12. vantage6-5.0.0a34/vantage6/cli/algostore/stop.py +96 -0
  13. {vantage6-5.0.0a29/vantage6/cli/server → vantage6-5.0.0a34/vantage6/cli/common}/new.py +14 -33
  14. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/common/start.py +17 -223
  15. vantage6-5.0.0a34/vantage6/cli/common/utils.py +373 -0
  16. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/configuration_manager.py +65 -0
  17. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/configuration_wizard.py +95 -76
  18. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/context/algorithm_store.py +8 -7
  19. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/context/base_server.py +22 -30
  20. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/context/node.py +11 -2
  21. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/context/server.py +17 -8
  22. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/globals.py +12 -11
  23. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/node/common/__init__.py +1 -1
  24. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/node/create_private_key.py +9 -6
  25. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/node/set_api_key.py +7 -4
  26. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/node/start.py +1 -1
  27. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/node/stop.py +7 -7
  28. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/server/import_.py +1 -2
  29. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/server/list.py +0 -3
  30. vantage6-5.0.0a34/vantage6/cli/server/new.py +41 -0
  31. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/server/shell.py +1 -1
  32. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/server/start.py +17 -17
  33. vantage6-5.0.0a34/vantage6/cli/server/stop.py +99 -0
  34. vantage6-5.0.0a34/vantage6/cli/template/algo_store_config.j2 +195 -0
  35. vantage6-5.0.0a34/vantage6/cli/template/server_config.j2 +256 -0
  36. vantage6-5.0.0a29/PKG-INFO +0 -238
  37. vantage6-5.0.0a29/setup.cfg +0 -4
  38. vantage6-5.0.0a29/setup.py +0 -80
  39. vantage6-5.0.0a29/vantage6/cli/__build__ +0 -1
  40. vantage6-5.0.0a29/vantage6/cli/__init__.py +0 -3
  41. vantage6-5.0.0a29/vantage6/cli/_version.py +0 -23
  42. vantage6-5.0.0a29/vantage6/cli/algostore/new.py +0 -61
  43. vantage6-5.0.0a29/vantage6/cli/algostore/start.py +0 -107
  44. vantage6-5.0.0a29/vantage6/cli/algostore/stop.py +0 -61
  45. vantage6-5.0.0a29/vantage6/cli/common/utils.py +0 -177
  46. vantage6-5.0.0a29/vantage6/cli/server/stop.py +0 -50
  47. vantage6-5.0.0a29/vantage6/cli/template/algo_store_config.j2 +0 -22
  48. vantage6-5.0.0a29/vantage6/cli/template/server_config.j2 +0 -34
  49. vantage6-5.0.0a29/vantage6/cli/template/server_import_config.j2 +0 -31
  50. vantage6-5.0.0a29/vantage6.egg-info/PKG-INFO +0 -238
  51. vantage6-5.0.0a29/vantage6.egg-info/SOURCES.txt +0 -86
  52. vantage6-5.0.0a29/vantage6.egg-info/dependency_links.txt +0 -1
  53. vantage6-5.0.0a29/vantage6.egg-info/entry_points.txt +0 -5
  54. vantage6-5.0.0a29/vantage6.egg-info/requires.txt +0 -19
  55. vantage6-5.0.0a29/vantage6.egg-info/top_level.txt +0 -2
  56. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/tests_cli/__init__.py +0 -0
  57. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/tests_cli/test_client_script.py +0 -0
  58. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/tests_cli/test_example.py +0 -0
  59. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/tests_cli/test_node_cli.py +0 -0
  60. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/algorithm/create.py +0 -0
  61. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/algorithm/update.py +0 -0
  62. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/algostore/attach.py +0 -0
  63. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/algostore/files.py +0 -0
  64. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/algostore/list.py +0 -0
  65. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/algostore/remove.py +0 -0
  66. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/cli.py +0 -0
  67. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/common/decorator.py +0 -0
  68. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/common/stop.py +1 -1
  69. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/config.py +0 -0
  70. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/context/__init__.py +0 -0
  71. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/dev/create.py +0 -0
  72. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/dev/data/km_dataset.csv +0 -0
  73. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/dev/remove.py +0 -0
  74. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/node/attach.py +0 -0
  75. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/node/clean.py +0 -0
  76. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/node/files.py +0 -0
  77. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/node/list.py +0 -0
  78. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/node/new.py +0 -0
  79. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/node/remove.py +0 -0
  80. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/node/restart.py +0 -0
  81. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/node/version.py +0 -0
  82. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/prometheus/monitoring_manager.py +0 -0
  83. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/prometheus/prometheus.yml +0 -0
  84. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/rabbitmq/__init__.py +0 -0
  85. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/rabbitmq/definitions.py +0 -0
  86. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/rabbitmq/queue_manager.py +0 -0
  87. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/rabbitmq/rabbitmq.config +0 -0
  88. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/server/attach.py +0 -0
  89. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/server/common/__init__.py +0 -0
  90. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/server/files.py +0 -0
  91. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/server/remove.py +0 -0
  92. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/server/version.py +0 -0
  93. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/template/node_config.j2 +0 -0
  94. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/test/algo_test_scripts/algo_test_arguments.py +0 -0
  95. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/test/algo_test_scripts/algo_test_script.py +0 -0
  96. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/test/client_script.py +0 -0
  97. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/test/common/diagnostic_runner.py +0 -0
  98. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/test/feature_tester.py +0 -0
  99. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/test/integration_test.py +0 -0
  100. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/use/context.py +0 -0
  101. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/use/namespace.py +0 -0
  102. {vantage6-5.0.0a29 → vantage6-5.0.0a34}/vantage6/cli/utils.py +0 -0
@@ -0,0 +1,33 @@
1
+
2
+ # documentation
3
+ docs/_build
4
+ docs/api-docs/_autosummary
5
+
6
+ # Python
7
+ .ipynb_checkpoints
8
+ **/__pycache__
9
+ **/.coverage
10
+
11
+ # IDE's
12
+ .idea/
13
+ *.sublime-project
14
+ *.sublime-workspace
15
+ .vscode/
16
+
17
+ # build files
18
+ **/build/
19
+ **/dist/
20
+ *.egg-info
21
+ *.code-workspace
22
+
23
+ # UI build files
24
+ **/node_modules/
25
+
26
+ # Ignore DevSpace cache and log folder
27
+ .devspace/
28
+ dev/.data/
29
+ dev/.tasks/
30
+ dev/.db/
31
+
32
+ # Helm
33
+ charts/**/*.tgz
@@ -0,0 +1,22 @@
1
+ # `make` is expected to be called from the directory that contains
2
+ # this Makefile
3
+
4
+ TAG ?= latest
5
+
6
+ rebuild: clean build-dist
7
+
8
+ build-dist:
9
+ # Build the PyPI package
10
+ uv build
11
+
12
+ publish:
13
+ # Uploading to pypi.org
14
+ twine upload --repository pypi dist/*
15
+
16
+ test:
17
+ coverage run --source=vantage6 --omit="utest.py" ./utest.py
18
+
19
+ clean:
20
+ # Cleaning ...
21
+ -rm -r build
22
+ -rm dist/*
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: vantage6
3
+ Version: 5.0.0a34
4
+ Summary: vantage6 command line interface
5
+ Author: Vantage6 Team
6
+ Maintainer-email: Frank Martin <f.martin@iknl.nl>, Bart van Beusekom <b.vanbeusekom@iknl.nl>
7
+ License: MIT
8
+ Requires-Python: >=3.13
9
+ Requires-Dist: click==8.1.3
10
+ Requires-Dist: colorama==0.4.6
11
+ Requires-Dist: copier==9.9.1
12
+ Requires-Dist: docker==7.1.0
13
+ Requires-Dist: ipython==8.10.0
14
+ Requires-Dist: jinja2==3.1.6
15
+ Requires-Dist: kubernetes==28.1.0
16
+ Requires-Dist: pandas>=2.2.3
17
+ Requires-Dist: questionary==1.10.0
18
+ Requires-Dist: rich==13.5.2
19
+ Requires-Dist: schema==0.7.5
20
+ Requires-Dist: sqlalchemy==2.0.37
21
+ Requires-Dist: vantage6-client==5.0.0a34
22
+ Requires-Dist: vantage6-common==5.0.0a34
23
+ Provides-Extra: dev
24
+ Requires-Dist: black; extra == 'dev'
25
+ Requires-Dist: coverage==7.10.2; extra == 'dev'
26
+ Requires-Dist: pre-commit; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ <h1 align="center">
30
+ <br>
31
+ <a href="https://vantage6.ai"><img src="https://github.com/IKNL/guidelines/blob/master/resources/logos/vantage6.png?raw=true" alt="vantage6" width="350"></a>
32
+ </h1>
33
+
34
+ <h3 align=center> A Privacy Enhancing Technology (PET) Operations platform</h3>
35
+
36
+ ---
37
+
38
+ # Vantage6 CLI
39
+
40
+ This package provides the command-line interface (CLI) for managing vantage6
41
+ infrastructure instances, such as servers and nodes.
42
+
43
+ ## Documentation
44
+
45
+ For complete documentation, installation instructions, and usage examples, please see
46
+ the **[main Vantage6 README](https://github.com/vantage6/vantage6/blob/main/README.md)**
47
+ .
48
+
49
+ ## About Vantage6
50
+
51
+ Vantage6 is a Privacy Enhancing Technology (PET) Operations platform that enables
52
+ federated learning and multi-party computation. For more information, visit
53
+ [vantage6.ai](https://vantage6.ai) or join our
54
+ [Discord community](https://discord.gg/yAyFf6Y).
@@ -0,0 +1,26 @@
1
+ <h1 align="center">
2
+ <br>
3
+ <a href="https://vantage6.ai"><img src="https://github.com/IKNL/guidelines/blob/master/resources/logos/vantage6.png?raw=true" alt="vantage6" width="350"></a>
4
+ </h1>
5
+
6
+ <h3 align=center> A Privacy Enhancing Technology (PET) Operations platform</h3>
7
+
8
+ ---
9
+
10
+ # Vantage6 CLI
11
+
12
+ This package provides the command-line interface (CLI) for managing vantage6
13
+ infrastructure instances, such as servers and nodes.
14
+
15
+ ## Documentation
16
+
17
+ For complete documentation, installation instructions, and usage examples, please see
18
+ the **[main Vantage6 README](https://github.com/vantage6/vantage6/blob/main/README.md)**
19
+ .
20
+
21
+ ## About Vantage6
22
+
23
+ Vantage6 is a Privacy Enhancing Technology (PET) Operations platform that enables
24
+ federated learning and multi-party computation. For more information, visit
25
+ [vantage6.ai](https://vantage6.ai) or join our
26
+ [Discord community](https://discord.gg/yAyFf6Y).
@@ -0,0 +1,65 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "vantage6"
7
+ version = "5.0.0a34"
8
+ description = "vantage6 command line interface"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "Vantage6 Team"}
13
+ ]
14
+ maintainers = [
15
+ {name = "Frank Martin", email = "f.martin@iknl.nl"},
16
+ {name = "Bart van Beusekom", email = "b.vanbeusekom@iknl.nl"}
17
+ ]
18
+ requires-python = ">=3.13"
19
+ dependencies = [
20
+ "click==8.1.3",
21
+ "colorama==0.4.6",
22
+ "copier==9.9.1",
23
+ "docker==7.1.0",
24
+ "ipython==8.10.0",
25
+ "jinja2==3.1.6",
26
+ "kubernetes==28.1.0",
27
+ "pandas>=2.2.3",
28
+ "questionary==1.10.0",
29
+ "rich==13.5.2",
30
+ "schema==0.7.5",
31
+ "sqlalchemy==2.0.37",
32
+ "vantage6-common==5.0.0a34",
33
+ "vantage6-client==5.0.0a34",
34
+ ]
35
+
36
+ [project.optional-dependencies]
37
+ dev = [
38
+ "coverage==7.10.2",
39
+ "black",
40
+ "pre-commit",
41
+ ]
42
+
43
+ [project.scripts]
44
+ v6 = "vantage6.cli.cli:cli_complete"
45
+
46
+ [tool.hatch.build.targets.wheel]
47
+ packages = ["vantage6"]
48
+
49
+ [tool.hatch.build.targets.wheel.sources]
50
+ "vantage6" = "vantage6"
51
+
52
+ [tool.setuptools.packages.find]
53
+ where = ["vantage6/cli"]
54
+
55
+ [tool.setuptools.package-data]
56
+ "vantage6/cli/" = [
57
+ "rabbimq/rabbitmq.config",
58
+ "template/node_config.j2",
59
+ "template/server_config.j2",
60
+ "template/server_import_config.j2",
61
+ "template/algo_store_config.j2",
62
+ "dev/data/olympic_athletes_2016.csv",
63
+ "dev/data/km_dataset.csv",
64
+ "prometheus/prometheus.yml",
65
+ ]
@@ -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,7 @@
1
+ """Command line interface for the vantage6 infrastructure."""
2
+
3
+ import importlib.metadata
4
+
5
+ # note that here we cannot use __package__ because __package__ resolves to vantage6.cli
6
+ # whereas the PyPi package is called vantage6
7
+ __version__ = importlib.metadata.version("vantage6")
@@ -19,8 +19,6 @@ from vantage6.common.algorithm_function import (
19
19
  )
20
20
  from vantage6.common.enum import AlgorithmArgumentType, AlgorithmStepType, StrEnumBase
21
21
 
22
- from vantage6.algorithm.tools import DecoratorStepType
23
-
24
22
  from vantage6.algorithm.client import AlgorithmClient
25
23
  from vantage6.algorithm.preprocessing.algorithm_json_data import (
26
24
  PREPROCESSING_FUNCTIONS_JSON_DATA,
@@ -120,7 +118,7 @@ class Function:
120
118
  # infrastructure-defined function
121
119
  if (
122
120
  not self.func.__module__.startswith("vantage6.algorithm.")
123
- or not self.json["name"] in PREPROCESSING_FUNCTIONS_JSON_DATA
121
+ or self.json["name"] not in PREPROCESSING_FUNCTIONS_JSON_DATA
124
122
  ):
125
123
  return
126
124
 
@@ -327,14 +325,8 @@ class Function:
327
325
  def _get_step_type(self) -> AlgorithmStepType | None:
328
326
  """Get the step type of the function"""
329
327
  decorator_type = get_vantage6_decorator_type(self.func)
330
- if decorator_type == DecoratorStepType.FEDERATED:
331
- return AlgorithmStepType.FEDERATED_COMPUTE
332
- elif decorator_type == DecoratorStepType.CENTRAL:
333
- return AlgorithmStepType.CENTRAL_COMPUTE
334
- elif decorator_type == DecoratorStepType.PREPROCESSING:
335
- return AlgorithmStepType.PREPROCESSING
336
- elif decorator_type == DecoratorStepType.DATA_EXTRACTION:
337
- return AlgorithmStepType.DATA_EXTRACTION
328
+ if decorator_type in AlgorithmStepType.list():
329
+ return decorator_type
338
330
  else:
339
331
  warning(
340
332
  f"Unsupported decorator type: {decorator_type} for function {self.name}"
@@ -0,0 +1,39 @@
1
+ import click
2
+
3
+ from vantage6.common.globals import InstanceType
4
+
5
+ from vantage6.cli.common.new import new
6
+ from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS
7
+
8
+
9
+ @click.command()
10
+ @click.option(
11
+ "-n", "--name", default=None, help="Name of the configuration you want to use."
12
+ )
13
+ @click.option(
14
+ "--system",
15
+ "system_folders",
16
+ flag_value=True,
17
+ help="Use system folders instead of user folders. This is the default",
18
+ )
19
+ @click.option(
20
+ "--user",
21
+ "system_folders",
22
+ flag_value=False,
23
+ default=DEFAULT_SERVER_SYSTEM_FOLDERS,
24
+ help="Use user folders instead of system folders",
25
+ )
26
+ @click.option("--context", default=None, help="Kubernetes context to use")
27
+ @click.option(
28
+ "--namespace",
29
+ default=None,
30
+ help="Kubernetes namespace to use",
31
+ )
32
+ def cli_algo_store_new(
33
+ name: str, system_folders: bool, namespace: str, context: str
34
+ ) -> None:
35
+ """
36
+ Create a new server configuration.
37
+ """
38
+
39
+ new(name, system_folders, namespace, context, InstanceType.ALGORITHM_STORE)
@@ -0,0 +1,73 @@
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
+ start_port_forward,
13
+ )
14
+ from vantage6.cli.common.utils import (
15
+ attach_logs,
16
+ create_directory_if_not_exists,
17
+ select_context_and_namespace,
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(InstanceType.ALGORITHM_STORE)
34
+ def cli_algo_store_start(
35
+ ctx: AlgorithmStoreContext,
36
+ context: str,
37
+ namespace: str,
38
+ ip: str,
39
+ port: int,
40
+ attach: bool,
41
+ ) -> None:
42
+ """
43
+ Start the algorithm store.
44
+ """
45
+ info("Starting algorithm store...")
46
+ context, namespace = select_context_and_namespace(
47
+ context=context,
48
+ namespace=namespace,
49
+ )
50
+
51
+ create_directory_if_not_exists(ctx.log_dir)
52
+
53
+ helm_install(
54
+ release_name=ctx.helm_release_name,
55
+ chart_name=ChartName.ALGORITHM_STORE,
56
+ values_file=ctx.config_file,
57
+ context=context,
58
+ namespace=namespace,
59
+ )
60
+
61
+ # port forward for server
62
+ info("Port forwarding for algorithm store")
63
+ start_port_forward(
64
+ service_name=f"{ctx.helm_release_name}-vantage6-algorithm-store-service",
65
+ service_port=ctx.config["store"].get("port", Ports.DEV_ALGO_STORE.value),
66
+ port=port or ctx.config["store"].get("port", Ports.DEV_ALGO_STORE.value),
67
+ ip=ip,
68
+ context=context,
69
+ namespace=namespace,
70
+ )
71
+
72
+ if attach:
73
+ attach_logs("app=store", "component=store-server")
@@ -0,0 +1,96 @@
1
+ import click
2
+ from colorama import Fore, Style
3
+
4
+ from vantage6.common import error, info
5
+ from vantage6.common.globals import InstanceType
6
+
7
+ from vantage6.cli.common.stop import helm_uninstall, stop_port_forward
8
+ from vantage6.cli.common.utils import (
9
+ find_running_service_names,
10
+ select_context_and_namespace,
11
+ select_running_service,
12
+ )
13
+ from vantage6.cli.context import get_context
14
+ from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS
15
+
16
+
17
+ @click.command()
18
+ @click.option("-n", "--name", default=None, help="Configuration name")
19
+ @click.option("--context", default=None, help="Kubernetes context to use")
20
+ @click.option("--namespace", default=None, help="Kubernetes namespace to use")
21
+ @click.option(
22
+ "--system",
23
+ "system_folders",
24
+ flag_value=True,
25
+ default=DEFAULT_SERVER_SYSTEM_FOLDERS,
26
+ help="Search for configuration in system folders instead of user folders. "
27
+ "This is the default.",
28
+ )
29
+ @click.option(
30
+ "--user",
31
+ "system_folders",
32
+ flag_value=False,
33
+ help="Search for configuration in the user folders instead of system folders.",
34
+ )
35
+ @click.option("--all", "all_stores", flag_value=True, help="Stop all algorithm stores")
36
+ def cli_algo_store_stop(
37
+ name: str,
38
+ context: str,
39
+ namespace: str,
40
+ system_folders: bool,
41
+ all_stores: bool,
42
+ ):
43
+ """
44
+ Stop one or all running algorithm store(s).
45
+ """
46
+ context, namespace = select_context_and_namespace(
47
+ context=context,
48
+ namespace=namespace,
49
+ )
50
+
51
+ running_stores = find_running_service_names(
52
+ instance_type=InstanceType.ALGORITHM_STORE,
53
+ only_system_folders=system_folders,
54
+ only_user_folders=not system_folders,
55
+ context=context,
56
+ namespace=namespace,
57
+ )
58
+
59
+ if not running_stores:
60
+ error("No running algorithm stores found.")
61
+ return
62
+
63
+ if all_stores:
64
+ for store in running_stores:
65
+ _stop_store(store["name"], namespace, context)
66
+ else:
67
+ if not name:
68
+ store_name = select_running_service(
69
+ running_stores, InstanceType.ALGORITHM_STORE
70
+ )
71
+ else:
72
+ ctx = get_context(InstanceType.ALGORITHM_STORE, name, system_folders)
73
+ store_name = ctx.helm_release_name
74
+
75
+ if store_name in running_stores:
76
+ _stop_store(store_name, namespace, context)
77
+ info(f"Stopped the {Fore.GREEN}{store_name}{Style.RESET_ALL} store.")
78
+ else:
79
+ error(f"{Fore.RED}{name}{Style.RESET_ALL} is not running?!")
80
+
81
+
82
+ def _stop_store(store_name: str, namespace: str, context: str) -> None:
83
+ info(f"Stopping store {store_name}...")
84
+
85
+ # uninstall the helm release
86
+ helm_uninstall(
87
+ release_name=store_name,
88
+ context=context,
89
+ namespace=namespace,
90
+ )
91
+
92
+ stop_port_forward(
93
+ service_name=f"{store_name}-vantage6-algorithm-store-service",
94
+ )
95
+
96
+ info(f"Store {store_name} stopped successfully.")
@@ -1,39 +1,18 @@
1
- import click
2
1
  from colorama import Fore, Style
3
2
 
4
3
  from vantage6.common import ensure_config_dir_writable, error, info
5
4
  from vantage6.common.globals import InstanceType
6
5
 
6
+ from vantage6.cli.common.utils import get_main_cli_command_name
7
7
  from vantage6.cli.config import CliConfig
8
8
  from vantage6.cli.configuration_wizard import configuration_wizard
9
- from vantage6.cli.context.server import ServerContext
10
- from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS
9
+ from vantage6.cli.context import select_context_class
11
10
  from vantage6.cli.utils import check_config_name_allowed, prompt_config_name
12
11
 
13
12
 
14
- @click.command()
15
- @click.option(
16
- "-n", "--name", default=None, help="name of the configuration you want to use."
17
- )
18
- @click.option("--system", "system_folders", flag_value=True)
19
- @click.option(
20
- "--user", "system_folders", flag_value=False, default=DEFAULT_SERVER_SYSTEM_FOLDERS
21
- )
22
- @click.option("--context", default=None, help="Kubernetes context to use")
23
- @click.option(
24
- "--namespace",
25
- default=None,
26
- help="Kubernetes namespace to use",
27
- )
28
- def cli_server_new(
29
- name: str,
30
- system_folders: bool,
31
- namespace: str,
32
- context: str,
33
- ) -> None:
34
- """
35
- Create a new server configuration.
36
- """
13
+ def new(
14
+ name: str, system_folders: bool, namespace: str, context: str, type_: InstanceType
15
+ ):
37
16
  cli_config = CliConfig()
38
17
  context, namespace = cli_config.compare_changes_config(
39
18
  context=context,
@@ -46,34 +25,36 @@ def cli_server_new(
46
25
  check_config_name_allowed(name)
47
26
 
48
27
  # check that this config does not exist
28
+ ctx_class = select_context_class(type_)
49
29
  try:
50
- if ServerContext.config_exists(name, system_folders):
51
- error(f"Configuration {Fore.RED}{name}{Style.RESET_ALL} already " "exists!")
30
+ if ctx_class.config_exists(name, system_folders):
31
+ error(f"Configuration {Fore.RED}{name}{Style.RESET_ALL} already exists!")
52
32
  exit(1)
53
33
  except Exception as e:
54
34
  error(e)
55
35
  exit(1)
56
36
 
37
+ command_name = get_main_cli_command_name(type_)
38
+
57
39
  # Check that we can write in this folder
58
40
  if not ensure_config_dir_writable(system_folders):
59
41
  error("Your user does not have write access to all folders. Exiting")
60
42
  info(
61
- f"Create a new server using '{Fore.GREEN}v6 server new "
43
+ f"Create a new {command_name} using '{Fore.GREEN}v6 {command_name} new "
62
44
  f"--user{Style.RESET_ALL}' instead!"
63
45
  )
64
46
  exit(1)
65
47
 
66
48
  # create config in ctx location
67
49
  try:
68
- cfg_file = configuration_wizard(InstanceType.SERVER, name, system_folders)
50
+ cfg_file = configuration_wizard(type_, name, system_folders)
69
51
  except KeyboardInterrupt:
70
52
  error("Configuration creation aborted.")
71
53
  exit(1)
72
54
  info(f"New configuration created: {Fore.GREEN}{cfg_file}{Style.RESET_ALL}")
73
55
 
74
- # info(f"root user created.")
75
56
  flag = "" if system_folders else "--user"
76
57
  info(
77
- f"You can start the server by running {Fore.GREEN}v6 server start "
78
- f"{flag}{Style.RESET_ALL}"
58
+ f"You can start the {command_name} by running {Fore.GREEN}v6 {command_name} "
59
+ f"start {flag}{Style.RESET_ALL}"
79
60
  )