vantage6 5.0.0a34__tar.gz → 5.0.0a36__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 (109) hide show
  1. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/PKG-INFO +3 -3
  2. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/pyproject.toml +5 -4
  3. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/tests_cli/test_node_cli.py +13 -51
  4. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/algorithm/generate_algorithm_json.py +9 -9
  5. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/algostore/attach.py +1 -0
  6. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/algostore/files.py +3 -2
  7. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/algostore/list.py +0 -3
  8. vantage6-5.0.0a36/vantage6/cli/algostore/new.py +120 -0
  9. vantage6-5.0.0a36/vantage6/cli/algostore/remove.py +36 -0
  10. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/algostore/start.py +10 -7
  11. vantage6-5.0.0a36/vantage6/cli/algostore/stop.py +58 -0
  12. vantage6-5.0.0a36/vantage6/cli/auth/attach.py +60 -0
  13. vantage6-5.0.0a36/vantage6/cli/auth/files.py +16 -0
  14. vantage6-5.0.0a36/vantage6/cli/auth/list.py +13 -0
  15. vantage6-5.0.0a36/vantage6/cli/auth/new.py +80 -0
  16. vantage6-5.0.0a36/vantage6/cli/auth/remove.py +31 -0
  17. vantage6-5.0.0a36/vantage6/cli/auth/start.py +80 -0
  18. vantage6-5.0.0a36/vantage6/cli/auth/stop.py +64 -0
  19. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/cli.py +67 -37
  20. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/common/new.py +28 -3
  21. vantage6-5.0.0a36/vantage6/cli/common/remove.py +54 -0
  22. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/common/start.py +31 -2
  23. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/common/stop.py +79 -1
  24. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/common/utils.py +47 -4
  25. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/configuration_manager.py +57 -13
  26. vantage6-5.0.0a36/vantage6/cli/configuration_wizard.py +227 -0
  27. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/context/__init__.py +3 -0
  28. vantage6-5.0.0a36/vantage6/cli/context/auth.py +107 -0
  29. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/context/base_server.py +0 -4
  30. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/context/node.py +10 -17
  31. vantage6-5.0.0a36/vantage6/cli/dev/clean.py +28 -0
  32. vantage6-5.0.0a36/vantage6/cli/dev/common.py +34 -0
  33. vantage6-5.0.0a36/vantage6/cli/dev/rebuild.py +39 -0
  34. vantage6-5.0.0a36/vantage6/cli/dev/start.py +36 -0
  35. vantage6-5.0.0a36/vantage6/cli/dev/stop.py +23 -0
  36. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/globals.py +24 -1
  37. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/node/attach.py +1 -0
  38. vantage6-5.0.0a36/vantage6/cli/node/files.py +29 -0
  39. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/node/list.py +5 -4
  40. vantage6-5.0.0a36/vantage6/cli/node/new.py +380 -0
  41. vantage6-5.0.0a36/vantage6/cli/node/remove.py +37 -0
  42. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/node/restart.py +30 -51
  43. vantage6-5.0.0a36/vantage6/cli/node/start.py +111 -0
  44. vantage6-5.0.0a36/vantage6/cli/node/stop.py +71 -0
  45. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/node/version.py +5 -4
  46. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/prometheus/monitoring_manager.py +5 -3
  47. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/rabbitmq/queue_manager.py +13 -11
  48. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/server/attach.py +1 -0
  49. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/server/common/__init__.py +1 -27
  50. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/server/import_.py +1 -1
  51. vantage6-5.0.0a36/vantage6/cli/server/new.py +122 -0
  52. vantage6-5.0.0a36/vantage6/cli/server/remove.py +31 -0
  53. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/server/start.py +8 -6
  54. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/server/stop.py +10 -39
  55. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/template/algo_store_config.j2 +1 -1
  56. vantage6-5.0.0a36/vantage6/cli/template/auth_config.j2 +230 -0
  57. vantage6-5.0.0a36/vantage6/cli/template/node_config.j2 +336 -0
  58. vantage6-5.0.0a34/vantage6/cli/template/node_config.j2 → vantage6-5.0.0a36/vantage6/cli/template/node_config_nonk8s.j2 +1 -1
  59. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/test/common/diagnostic_runner.py +5 -3
  60. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/use/namespace.py +2 -1
  61. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/utils.py +0 -2
  62. vantage6-5.0.0a34/vantage6/cli/algostore/new.py +0 -39
  63. vantage6-5.0.0a34/vantage6/cli/algostore/remove.py +0 -52
  64. vantage6-5.0.0a34/vantage6/cli/algostore/stop.py +0 -96
  65. vantage6-5.0.0a34/vantage6/cli/configuration_wizard.py +0 -606
  66. vantage6-5.0.0a34/vantage6/cli/dev/create.py +0 -693
  67. vantage6-5.0.0a34/vantage6/cli/dev/data/km_dataset.csv +0 -2401
  68. vantage6-5.0.0a34/vantage6/cli/dev/remove.py +0 -112
  69. vantage6-5.0.0a34/vantage6/cli/node/clean.py +0 -46
  70. vantage6-5.0.0a34/vantage6/cli/node/files.py +0 -42
  71. vantage6-5.0.0a34/vantage6/cli/node/new.py +0 -60
  72. vantage6-5.0.0a34/vantage6/cli/node/remove.py +0 -113
  73. vantage6-5.0.0a34/vantage6/cli/node/start.py +0 -334
  74. vantage6-5.0.0a34/vantage6/cli/node/stop.py +0 -131
  75. vantage6-5.0.0a34/vantage6/cli/server/new.py +0 -41
  76. vantage6-5.0.0a34/vantage6/cli/server/remove.py +0 -52
  77. vantage6-5.0.0a34/vantage6/cli/server/shell.py +0 -54
  78. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/.gitignore +0 -0
  79. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/Makefile +0 -0
  80. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/README.md +0 -0
  81. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/tests_cli/__init__.py +0 -0
  82. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/tests_cli/test_client_script.py +0 -0
  83. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/tests_cli/test_example.py +0 -0
  84. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/tests_cli/test_server_cli.py +0 -0
  85. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/tests_cli/test_wizard.py +0 -0
  86. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/__init__.py +0 -0
  87. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/algorithm/create.py +0 -0
  88. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/algorithm/update.py +1 -1
  89. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/common/decorator.py +0 -0
  90. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/config.py +0 -0
  91. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/context/algorithm_store.py +0 -0
  92. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/context/server.py +0 -0
  93. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/node/common/__init__.py +0 -0
  94. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/node/create_private_key.py +0 -0
  95. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/node/set_api_key.py +0 -0
  96. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/prometheus/prometheus.yml +0 -0
  97. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/rabbitmq/__init__.py +0 -0
  98. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/rabbitmq/definitions.py +0 -0
  99. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/rabbitmq/rabbitmq.config +0 -0
  100. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/server/files.py +0 -0
  101. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/server/list.py +0 -0
  102. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/server/version.py +0 -0
  103. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/template/server_config.j2 +0 -0
  104. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/test/algo_test_scripts/algo_test_arguments.py +0 -0
  105. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/test/algo_test_scripts/algo_test_script.py +0 -0
  106. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/test/client_script.py +0 -0
  107. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/test/feature_tester.py +0 -0
  108. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/test/integration_test.py +0 -0
  109. {vantage6-5.0.0a34 → vantage6-5.0.0a36}/vantage6/cli/use/context.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vantage6
3
- Version: 5.0.0a34
3
+ Version: 5.0.0a36
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>
@@ -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.0a34
22
- Requires-Dist: vantage6-common==5.0.0a34
21
+ Requires-Dist: vantage6-client==5.0.0a36
22
+ Requires-Dist: vantage6-common==5.0.0a36
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.0a34"
7
+ version = "5.0.0a36"
8
8
  description = "vantage6 command line interface"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -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.0a34",
33
- "vantage6-client==5.0.0a34",
32
+ "vantage6-common==5.0.0a36",
33
+ "vantage6-client==5.0.0a36",
34
34
  ]
35
35
 
36
36
  [project.optional-dependencies]
@@ -56,9 +56,10 @@ where = ["vantage6/cli"]
56
56
  "vantage6/cli/" = [
57
57
  "rabbimq/rabbitmq.config",
58
58
  "template/node_config.j2",
59
+ "template/node_config_nonk8s.j2",
59
60
  "template/server_config.j2",
60
- "template/server_import_config.j2",
61
61
  "template/algo_store_config.j2",
62
+ "template/auth_config.j2",
62
63
  "dev/data/olympic_athletes_2016.csv",
63
64
  "dev/data/km_dataset.csv",
64
65
  "prometheus/prometheus.yml",
@@ -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()
@@ -276,23 +276,23 @@ class Function:
276
276
  else:
277
277
  type_ = param.annotation
278
278
 
279
- if type_ == str:
279
+ if type_ is str:
280
280
  return AlgorithmArgumentType.STRING
281
- elif type_ == dict:
281
+ elif type_ is dict:
282
282
  return AlgorithmArgumentType.JSON
283
- elif type_ == int:
283
+ elif type_ is int:
284
284
  return AlgorithmArgumentType.INTEGER
285
- elif type_ == float:
285
+ elif type_ is float:
286
286
  return AlgorithmArgumentType.FLOAT
287
- elif type_ == bool:
287
+ elif type_ is bool:
288
288
  return AlgorithmArgumentType.BOOLEAN
289
- elif type_ == list:
289
+ elif type_ is list:
290
290
  return AlgorithmArgumentType.STRINGS
291
- elif type_ == list[str]:
291
+ elif type_ is list[str]:
292
292
  return AlgorithmArgumentType.STRINGS
293
- elif type_ == list[int]:
293
+ elif type_ is list[int]:
294
294
  return AlgorithmArgumentType.INTEGERS
295
- elif type_ == list[float]:
295
+ elif type_ is list[float]:
296
296
  return AlgorithmArgumentType.FLOATS
297
297
  else:
298
298
  warning(
@@ -1,6 +1,7 @@
1
1
  import click
2
2
 
3
3
  from vantage6.common import info
4
+
4
5
  from vantage6.cli.common.utils import attach_logs
5
6
 
6
7
 
@@ -1,10 +1,11 @@
1
1
  import click
2
2
 
3
3
  from vantage6.common import info
4
- from vantage6.cli.context.server import ServerContext
5
- from vantage6.cli.common.decorator import click_insert_context
6
4
  from vantage6.common.globals import InstanceType
7
5
 
6
+ from vantage6.cli.common.decorator import click_insert_context
7
+ from vantage6.cli.context.server import ServerContext
8
+
8
9
 
9
10
  @click.command()
10
11
  @click_insert_context(type_=InstanceType.ALGORITHM_STORE)
@@ -1,6 +1,5 @@
1
1
  import click
2
2
 
3
- from vantage6.common.docker.addons import check_docker_running
4
3
  from vantage6.common.globals import InstanceType
5
4
 
6
5
  from vantage6.cli.common.utils import get_server_configuration_list
@@ -11,6 +10,4 @@ def cli_algo_store_configuration_list() -> None:
11
10
  """
12
11
  Print the available server configurations.
13
12
  """
14
- check_docker_running()
15
-
16
13
  get_server_configuration_list(InstanceType.ALGORITHM_STORE)
@@ -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
+ )
@@ -9,12 +9,12 @@ from vantage6.common.globals import (
9
9
  from vantage6.cli.common.decorator import click_insert_context
10
10
  from vantage6.cli.common.start import (
11
11
  helm_install,
12
+ prestart_checks,
12
13
  start_port_forward,
13
14
  )
14
15
  from vantage6.cli.common.utils import (
15
16
  attach_logs,
16
17
  create_directory_if_not_exists,
17
- select_context_and_namespace,
18
18
  )
19
19
  from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
20
20
  from vantage6.cli.globals import ChartName
@@ -30,9 +30,13 @@ from vantage6.cli.globals import ChartName
30
30
  default=False,
31
31
  help="Print server logs to the console after start",
32
32
  )
33
- @click_insert_context(InstanceType.ALGORITHM_STORE)
33
+ @click_insert_context(
34
+ InstanceType.ALGORITHM_STORE, include_name=True, include_system_folders=True
35
+ )
34
36
  def cli_algo_store_start(
35
37
  ctx: AlgorithmStoreContext,
38
+ name: str,
39
+ system_folders: bool,
36
40
  context: str,
37
41
  namespace: str,
38
42
  ip: str,
@@ -43,9 +47,9 @@ def cli_algo_store_start(
43
47
  Start the algorithm store.
44
48
  """
45
49
  info("Starting algorithm store...")
46
- context, namespace = select_context_and_namespace(
47
- context=context,
48
- namespace=namespace,
50
+
51
+ prestart_checks(
52
+ ctx, InstanceType.ALGORITHM_STORE, name, system_folders, context, namespace
49
53
  )
50
54
 
51
55
  create_directory_if_not_exists(ctx.log_dir)
@@ -58,10 +62,9 @@ def cli_algo_store_start(
58
62
  namespace=namespace,
59
63
  )
60
64
 
61
- # port forward for server
62
65
  info("Port forwarding for algorithm store")
63
66
  start_port_forward(
64
- service_name=f"{ctx.helm_release_name}-vantage6-algorithm-store-service",
67
+ service_name=f"{ctx.helm_release_name}-store-service",
65
68
  service_port=ctx.config["store"].get("port", Ports.DEV_ALGO_STORE.value),
66
69
  port=port or ctx.config["store"].get("port", Ports.DEV_ALGO_STORE.value),
67
70
  ip=ip,
@@ -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.")
@@ -0,0 +1,60 @@
1
+ import click
2
+
3
+ from vantage6.common import error, info
4
+ from vantage6.common.globals import InstanceType
5
+
6
+ from vantage6.cli.common.utils import (
7
+ attach_logs,
8
+ find_running_service_names,
9
+ select_context_and_namespace,
10
+ select_running_service,
11
+ )
12
+
13
+
14
+ @click.command()
15
+ @click.option("--context", default=None, help="Kubernetes context to use")
16
+ @click.option("--namespace", default=None, help="Kubernetes namespace to use")
17
+ @click.option(
18
+ "-n", "--name", default=None, help="Name of the auth service to attach to"
19
+ )
20
+ def cli_auth_attach(context: str, namespace: str, name: str) -> None:
21
+ """
22
+ Show the server logs in the current console.
23
+ """
24
+ info("Attaching to auth logs...")
25
+
26
+ context, namespace = select_context_and_namespace(
27
+ context=context,
28
+ namespace=namespace,
29
+ )
30
+
31
+ running_services = find_running_service_names(
32
+ instance_type=InstanceType.AUTH,
33
+ only_system_folders=False,
34
+ only_user_folders=False,
35
+ context=context,
36
+ namespace=namespace,
37
+ )
38
+
39
+ if not running_services:
40
+ error("No running auth services found.")
41
+ return
42
+
43
+ if name:
44
+ # search for a running auth service started up either in user or system folders
45
+ svc_name_options = [
46
+ f"vantage6-{name}-user-auth",
47
+ f"vantage6-{name}-system-auth",
48
+ ]
49
+ helm_name = next(
50
+ (svc for svc in svc_name_options if svc in running_services), None
51
+ )
52
+ if not helm_name:
53
+ error(f"No running auth service found for {name}.")
54
+ return
55
+ else:
56
+ helm_name = select_running_service(running_services, InstanceType.AUTH)
57
+
58
+ attach_logs(
59
+ f"app.kubernetes.io/instance={helm_name}",
60
+ )
@@ -0,0 +1,16 @@
1
+ import click
2
+
3
+ from vantage6.common import info
4
+ from vantage6.common.globals import InstanceType
5
+
6
+ from vantage6.cli.common.decorator import click_insert_context
7
+ from vantage6.cli.context.auth import AuthContext
8
+
9
+
10
+ @click.command()
11
+ @click_insert_context(type_=InstanceType.AUTH)
12
+ def cli_auth_files(ctx: AuthContext) -> None:
13
+ """
14
+ List files that belong to a particular auth instance.
15
+ """
16
+ info(f"Configuration file = {ctx.config_file}")
@@ -0,0 +1,13 @@
1
+ import click
2
+
3
+ from vantage6.common.globals import InstanceType
4
+
5
+ from vantage6.cli.common.utils import get_server_configuration_list
6
+
7
+
8
+ @click.command()
9
+ def cli_auth_configuration_list() -> None:
10
+ """
11
+ Print the available auth configurations.
12
+ """
13
+ get_server_configuration_list(InstanceType.AUTH)
@@ -0,0 +1,80 @@
1
+ from typing import Any
2
+
3
+ import click
4
+ import questionary as q
5
+
6
+ from vantage6.common.globals import (
7
+ InstanceType,
8
+ )
9
+
10
+ from vantage6.cli.common.new import new
11
+ from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS
12
+
13
+
14
+ @click.command()
15
+ @click.option(
16
+ "-n", "--name", default=None, help="name of the configuration you want to use."
17
+ )
18
+ @click.option(
19
+ "--system",
20
+ "system_folders",
21
+ flag_value=True,
22
+ help="Use system folders instead of user folders. This is the default",
23
+ )
24
+ @click.option(
25
+ "--user",
26
+ "system_folders",
27
+ flag_value=False,
28
+ default=DEFAULT_SERVER_SYSTEM_FOLDERS,
29
+ help="Use user folders instead of system folders",
30
+ )
31
+ @click.option("--context", default=None, help="Kubernetes context to use")
32
+ @click.option(
33
+ "--namespace",
34
+ default=None,
35
+ help="Kubernetes namespace to use",
36
+ )
37
+ def cli_auth_new(
38
+ name: str,
39
+ system_folders: bool,
40
+ namespace: str,
41
+ context: str,
42
+ ) -> None:
43
+ """
44
+ Create a new server configuration.
45
+ """
46
+ new(
47
+ questionnaire_function=auth_configuration_questionaire,
48
+ name=name,
49
+ system_folders=system_folders,
50
+ namespace=namespace,
51
+ context=context,
52
+ type_=InstanceType.AUTH,
53
+ )
54
+
55
+
56
+ def auth_configuration_questionaire(instance_name: str) -> dict[str, Any]:
57
+ """
58
+ Kubernetes-specific questionnaire to generate Helm values for the Keycloak helm
59
+ chart.
60
+ """
61
+ config = {"keycloak": {}}
62
+
63
+ is_production = q.confirm(
64
+ "Do you want to use production settings? If not, the service will be configured"
65
+ " to be more suitable for development or testing purposes.",
66
+ default=True,
67
+ ).unsafe_ask()
68
+
69
+ config["keycloak"]["production"] = is_production
70
+
71
+ if is_production:
72
+ ui_url = q.text(
73
+ "Please provide the URL of the UI. This is the URL that users will use to "
74
+ "log in to the service.",
75
+ default="https://ui.vantage6.ai",
76
+ ).unsafe_ask()
77
+ # add http://localhost:7681 as that is used by the Python client
78
+ config["keycloak"]["redirectUris"] = [ui_url, "http://localhost:7681"]
79
+
80
+ return config
@@ -0,0 +1,31 @@
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.auth import AuthContext
8
+ from vantage6.cli.globals import InfraComponentName
9
+
10
+
11
+ @click.command()
12
+ @click_insert_context(
13
+ type_=InstanceType.AUTH, include_name=True, include_system_folders=True
14
+ )
15
+ @click.option("-f", "--force", "force", flag_value=True)
16
+ def cli_auth_remove(
17
+ ctx: AuthContext, name: str, system_folders: bool, force: bool
18
+ ) -> None:
19
+ """
20
+ Function to remove a server.
21
+
22
+ Parameters
23
+ ----------
24
+ ctx : ServerContext
25
+ Server context object
26
+ force : bool
27
+ Whether to ask for confirmation before removing or not
28
+ """
29
+ execute_remove(
30
+ ctx, InstanceType.AUTH, InfraComponentName.AUTH, name, system_folders, force
31
+ )