vantage6 5.0.0a26__py3-none-any.whl → 5.0.0a29__py3-none-any.whl

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 (36) hide show
  1. tests_cli/test_server_cli.py +7 -6
  2. tests_cli/test_wizard.py +7 -7
  3. vantage6/cli/__build__ +1 -1
  4. vantage6/cli/algorithm/generate_algorithm_json.py +31 -29
  5. vantage6/cli/algostore/list.py +2 -1
  6. vantage6/cli/algostore/start.py +6 -6
  7. vantage6/cli/algostore/stop.py +3 -2
  8. vantage6/cli/common/decorator.py +3 -1
  9. vantage6/cli/common/start.py +2 -4
  10. vantage6/cli/common/utils.py +7 -13
  11. vantage6/cli/configuration_manager.py +5 -3
  12. vantage6/cli/configuration_wizard.py +6 -10
  13. vantage6/cli/context/__init__.py +2 -1
  14. vantage6/cli/context/algorithm_store.py +10 -7
  15. vantage6/cli/context/node.py +4 -9
  16. vantage6/cli/context/server.py +10 -5
  17. vantage6/cli/dev/create.py +11 -13
  18. vantage6/cli/dev/remove.py +2 -2
  19. vantage6/cli/globals.py +5 -5
  20. vantage6/cli/node/common/__init__.py +6 -5
  21. vantage6/cli/node/start.py +18 -24
  22. vantage6/cli/server/files.py +4 -2
  23. vantage6/cli/server/import_.py +7 -7
  24. vantage6/cli/server/list.py +2 -1
  25. vantage6/cli/server/shell.py +5 -4
  26. vantage6/cli/server/start.py +2 -1
  27. vantage6/cli/server/stop.py +3 -2
  28. vantage6/cli/server/version.py +5 -4
  29. vantage6/cli/template/node_config.j2 +2 -0
  30. vantage6/cli/test/algo_test_scripts/algo_test_script.py +6 -5
  31. vantage6/cli/test/feature_tester.py +5 -2
  32. {vantage6-5.0.0a26.dist-info → vantage6-5.0.0a29.dist-info}/METADATA +13 -6
  33. {vantage6-5.0.0a26.dist-info → vantage6-5.0.0a29.dist-info}/RECORD +36 -36
  34. {vantage6-5.0.0a26.dist-info → vantage6-5.0.0a29.dist-info}/WHEEL +1 -1
  35. {vantage6-5.0.0a26.dist-info → vantage6-5.0.0a29.dist-info}/entry_points.txt +0 -0
  36. {vantage6-5.0.0a26.dist-info → vantage6-5.0.0a29.dist-info}/top_level.txt +0 -0
@@ -1,18 +1,19 @@
1
1
  import unittest
2
-
3
- from unittest.mock import MagicMock, patch
4
2
  from pathlib import Path
3
+ from unittest.mock import MagicMock, patch
4
+
5
5
  from click.testing import CliRunner
6
6
 
7
7
  from vantage6.common.globals import APPNAME, InstanceType
8
+
8
9
  from vantage6.cli.common.utils import attach_logs
9
- from vantage6.cli.server.start import cli_server_start
10
- from vantage6.cli.server.list import cli_server_configuration_list
10
+ from vantage6.cli.server.attach import cli_server_attach
11
11
  from vantage6.cli.server.files import cli_server_files
12
12
  from vantage6.cli.server.import_ import cli_server_import
13
+ from vantage6.cli.server.list import cli_server_configuration_list
13
14
  from vantage6.cli.server.new import cli_server_new
15
+ from vantage6.cli.server.start import cli_server_start
14
16
  from vantage6.cli.server.stop import cli_server_stop
15
- from vantage6.cli.server.attach import cli_server_attach
16
17
 
17
18
 
18
19
  class ServerCLITest(unittest.TestCase):
@@ -133,7 +134,7 @@ class ServerCLITest(unittest.TestCase):
133
134
  """Stop server without errors."""
134
135
 
135
136
  container1 = MagicMock()
136
- container1.name = f"{APPNAME}-iknl-system-{InstanceType.SERVER.value}"
137
+ container1.name = f"{APPNAME}-iknl-system-{InstanceType.SERVER}"
137
138
  containers.containers.list.return_value = [container1]
138
139
 
139
140
  runner = CliRunner()
tests_cli/test_wizard.py CHANGED
@@ -1,15 +1,15 @@
1
1
  import unittest
2
-
3
2
  from pathlib import Path
4
- from unittest.mock import patch, MagicMock
3
+ from unittest.mock import MagicMock, patch
4
+
5
+ from vantage6.common.globals import InstanceType, NodePolicy
5
6
 
6
7
  from vantage6.cli.configuration_wizard import (
7
- node_configuration_questionaire,
8
- server_configuration_questionaire,
9
8
  configuration_wizard,
9
+ node_configuration_questionaire,
10
10
  select_configuration_questionaire,
11
+ server_configuration_questionaire,
11
12
  )
12
- from vantage6.common.globals import InstanceType, NodePolicy
13
13
 
14
14
  module_path = "vantage6.cli.configuration_wizard"
15
15
 
@@ -70,8 +70,8 @@ class WizardTest(unittest.TestCase):
70
70
  for key in keys:
71
71
  self.assertIn(key, config)
72
72
  nested_keys = [
73
- ["policies", NodePolicy.ALLOWED_ALGORITHMS],
74
- ["policies", NodePolicy.ALLOWED_ALGORITHM_STORES],
73
+ ["policies", NodePolicy.ALLOWED_ALGORITHMS.value],
74
+ ["policies", NodePolicy.ALLOWED_ALGORITHM_STORES.value],
75
75
  ]
76
76
  for nesting in nested_keys:
77
77
  current_config = config
vantage6/cli/__build__ CHANGED
@@ -1 +1 @@
1
- 26
1
+ 29
@@ -1,27 +1,27 @@
1
- import os
2
- import sys
3
1
  import importlib
4
2
  import inspect
5
3
  import json
6
-
7
- from enum import Enum
4
+ import os
5
+ import sys
8
6
  from inspect import getmembers, isfunction, ismodule, signature
9
7
  from pathlib import Path
10
8
  from types import ModuleType, UnionType
11
9
  from typing import Any, OrderedDict
12
10
 
13
11
  import click
14
- import questionary as q
15
12
  import pandas as pd
13
+ import questionary as q
16
14
 
17
- from vantage6.algorithm.client import AlgorithmClient
18
- from vantage6.algorithm.tools import DecoratorStepType
19
15
  from vantage6.common import error, info, warning
20
- from vantage6.common.enum import AlgorithmArgumentType, AlgorithmStepType
21
16
  from vantage6.common.algorithm_function import (
22
17
  get_vantage6_decorator_type,
23
18
  is_vantage6_algorithm_func,
24
19
  )
20
+ from vantage6.common.enum import AlgorithmArgumentType, AlgorithmStepType, StrEnumBase
21
+
22
+ from vantage6.algorithm.tools import DecoratorStepType
23
+
24
+ from vantage6.algorithm.client import AlgorithmClient
25
25
  from vantage6.algorithm.preprocessing.algorithm_json_data import (
26
26
  PREPROCESSING_FUNCTIONS_JSON_DATA,
27
27
  )
@@ -54,7 +54,7 @@ class MergePreference:
54
54
  cls._prefer_existing = None
55
55
 
56
56
 
57
- class FunctionArgumentType(Enum):
57
+ class FunctionArgumentType(StrEnumBase):
58
58
  """Type of the function argument"""
59
59
 
60
60
  PARAMETER = "parameter"
@@ -80,7 +80,7 @@ class Function:
80
80
  "display_name": self._pretty_print_name(self.name),
81
81
  "standalone": True,
82
82
  "description": self._extract_headline_of_docstring(),
83
- "step_type": self.step_type,
83
+ "step_type": self.step_type.value if self.step_type else None,
84
84
  "ui_visualizations": [],
85
85
  "arguments": [],
86
86
  "databases": [],
@@ -91,7 +91,7 @@ class Function:
91
91
  # if the function is a data extraction function, the first argument is a dict
92
92
  # with database connection details. This argument should not be added to the
93
93
  # function json. Instead, a database should be added to the function json.
94
- if self.step_type == AlgorithmStepType.DATA_EXTRACTION.value:
94
+ if self.step_type == AlgorithmStepType.DATA_EXTRACTION:
95
95
  function_json["databases"].append(
96
96
  {
97
97
  "name": "Database",
@@ -211,11 +211,12 @@ class Function:
211
211
  }, FunctionArgumentType.DATAFRAME
212
212
  else:
213
213
  # This is a regular function parameter
214
+ type_ = self._get_argument_type(param, name)
214
215
  arg_json = {
215
216
  "name": name,
216
217
  "display_name": self._pretty_print_name(name),
217
218
  "description": self._extract_parameter_description(name),
218
- "type": self.get_argument_type(param, name),
219
+ "type": type_.value if type_ else None,
219
220
  "required": param.default == inspect.Parameter.empty,
220
221
  "has_default_value": param.default != inspect.Parameter.empty,
221
222
  "is_frontend_only": False,
@@ -247,7 +248,9 @@ class Function:
247
248
  "will not be added."
248
249
  )
249
250
 
250
- def get_argument_type(self, param: inspect.Parameter, name: str) -> str:
251
+ def _get_argument_type(
252
+ self, param: inspect.Parameter, name: str
253
+ ) -> AlgorithmArgumentType | None:
251
254
  """Get the type of the argument"""
252
255
  if isinstance(param.annotation, UnionType):
253
256
  # Arguments with default values may have type 'str | None'. If that is the
@@ -276,23 +279,23 @@ class Function:
276
279
  type_ = param.annotation
277
280
 
278
281
  if type_ == str:
279
- return AlgorithmArgumentType.STRING.value
282
+ return AlgorithmArgumentType.STRING
280
283
  elif type_ == dict:
281
- return AlgorithmArgumentType.JSON.value
284
+ return AlgorithmArgumentType.JSON
282
285
  elif type_ == int:
283
- return AlgorithmArgumentType.INTEGER.value
286
+ return AlgorithmArgumentType.INTEGER
284
287
  elif type_ == float:
285
- return AlgorithmArgumentType.FLOAT.value
288
+ return AlgorithmArgumentType.FLOAT
286
289
  elif type_ == bool:
287
- return AlgorithmArgumentType.BOOLEAN.value
290
+ return AlgorithmArgumentType.BOOLEAN
288
291
  elif type_ == list:
289
- return AlgorithmArgumentType.STRINGS.value
292
+ return AlgorithmArgumentType.STRINGS
290
293
  elif type_ == list[str]:
291
- return AlgorithmArgumentType.STRINGS.value
294
+ return AlgorithmArgumentType.STRINGS
292
295
  elif type_ == list[int]:
293
- return AlgorithmArgumentType.INTEGERS.value
296
+ return AlgorithmArgumentType.INTEGERS
294
297
  elif type_ == list[float]:
295
- return AlgorithmArgumentType.FLOATS.value
298
+ return AlgorithmArgumentType.FLOATS
296
299
  else:
297
300
  warning(
298
301
  f"Unsupported argument type: {param.annotation} for argument {name} "
@@ -321,21 +324,20 @@ class Function:
321
324
  header = " ".join(line.strip() for line in lines if line.strip() != "")
322
325
  return header
323
326
 
324
- def _get_step_type(self) -> str:
327
+ def _get_step_type(self) -> AlgorithmStepType | None:
325
328
  """Get the step type of the function"""
326
329
  decorator_type = get_vantage6_decorator_type(self.func)
327
330
  if decorator_type == DecoratorStepType.FEDERATED:
328
- return AlgorithmStepType.FEDERATED_COMPUTE.value
331
+ return AlgorithmStepType.FEDERATED_COMPUTE
329
332
  elif decorator_type == DecoratorStepType.CENTRAL:
330
- return AlgorithmStepType.CENTRAL_COMPUTE.value
333
+ return AlgorithmStepType.CENTRAL_COMPUTE
331
334
  elif decorator_type == DecoratorStepType.PREPROCESSING:
332
- return AlgorithmStepType.PREPROCESSING.value
335
+ return AlgorithmStepType.PREPROCESSING
333
336
  elif decorator_type == DecoratorStepType.DATA_EXTRACTION:
334
- return AlgorithmStepType.DATA_EXTRACTION.value
337
+ return AlgorithmStepType.DATA_EXTRACTION
335
338
  else:
336
339
  warning(
337
- f"Unsupported decorator type: {decorator_type} for function "
338
- f"{self.name}"
340
+ f"Unsupported decorator type: {decorator_type} for function {self.name}"
339
341
  )
340
342
  return None
341
343
 
@@ -2,6 +2,7 @@ import click
2
2
 
3
3
  from vantage6.common.docker.addons import check_docker_running
4
4
  from vantage6.common.globals import InstanceType
5
+
5
6
  from vantage6.cli.common.utils import get_server_configuration_list
6
7
 
7
8
 
@@ -12,4 +13,4 @@ def cli_algo_store_configuration_list() -> None:
12
13
  """
13
14
  check_docker_running()
14
15
 
15
- get_server_configuration_list(InstanceType.ALGORITHM_STORE.value)
16
+ get_server_configuration_list(InstanceType.ALGORITHM_STORE)
@@ -7,6 +7,8 @@ from vantage6.common.globals import (
7
7
  InstanceType,
8
8
  Ports,
9
9
  )
10
+
11
+ from vantage6.cli.common.decorator import click_insert_context
10
12
  from vantage6.cli.common.start import (
11
13
  attach_logs,
12
14
  check_for_start,
@@ -17,7 +19,6 @@ from vantage6.cli.common.start import (
17
19
  pull_infra_image,
18
20
  )
19
21
  from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
20
- from vantage6.cli.common.decorator import click_insert_context
21
22
 
22
23
 
23
24
  @click.command()
@@ -27,13 +28,12 @@ from vantage6.cli.common.decorator import click_insert_context
27
28
  @click.option(
28
29
  "--keep/--auto-remove",
29
30
  default=False,
30
- help="Keep image after algorithm store has been stopped. Useful " "for debugging",
31
+ help="Keep image after algorithm store has been stopped. Useful for debugging",
31
32
  )
32
33
  @click.option(
33
34
  "--mount-src",
34
35
  default="",
35
- help="Override vantage6 source code in container with the source"
36
- " code in this path",
36
+ help="Override vantage6 source code in container with the source code in this path",
37
37
  )
38
38
  @click.option(
39
39
  "--attach/--detach",
@@ -54,7 +54,7 @@ def cli_algo_store_start(
54
54
  Start the algorithm store server.
55
55
  """
56
56
  info("Starting algorithm store...")
57
- docker_client = check_for_start(ctx, InstanceType.ALGORITHM_STORE.value)
57
+ docker_client = check_for_start(ctx, InstanceType.ALGORITHM_STORE)
58
58
 
59
59
  image = get_image(image, ctx, "algorithm-store", DEFAULT_ALGO_STORE_IMAGE)
60
60
 
@@ -84,7 +84,7 @@ def cli_algo_store_start(
84
84
  info(cmd)
85
85
 
86
86
  info("Run Docker container")
87
- port_ = str(port or ctx.config["port"] or Ports.DEV_ALGO_STORE.value)
87
+ port_ = str(port or ctx.config["port"] or Ports.DEV_ALGO_STORE)
88
88
  container = docker_client.containers.run(
89
89
  image,
90
90
  command=cmd,
@@ -2,12 +2,13 @@ import click
2
2
  import docker
3
3
  from colorama import Fore, Style
4
4
 
5
- from vantage6.common import info, warning, error
5
+ from vantage6.common import error, info, warning
6
6
  from vantage6.common.docker.addons import (
7
7
  check_docker_running,
8
8
  remove_container_if_exists,
9
9
  )
10
10
  from vantage6.common.globals import APPNAME, InstanceType
11
+
11
12
  from vantage6.cli.common.decorator import click_insert_context
12
13
  from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
13
14
 
@@ -23,7 +24,7 @@ def cli_algo_store_stop(ctx: AlgorithmStoreContext, all_stores: bool):
23
24
  client = docker.from_env()
24
25
 
25
26
  running_stores = client.containers.list(
26
- filters={"label": f"{APPNAME}-type={InstanceType.ALGORITHM_STORE.value}"}
27
+ filters={"label": f"{APPNAME}-type={InstanceType.ALGORITHM_STORE}"}
27
28
  )
28
29
 
29
30
  if not running_stores:
@@ -1,11 +1,13 @@
1
1
  from functools import wraps
2
2
  from pathlib import Path
3
+
3
4
  import click
4
5
 
5
6
  from vantage6.common import error
6
7
  from vantage6.common.globals import InstanceType
8
+
7
9
  from vantage6.cli.configuration_wizard import select_configuration_questionaire
8
- from vantage6.cli.context import select_context_class, get_context
10
+ from vantage6.cli.context import get_context, select_context_class
9
11
 
10
12
 
11
13
  def click_insert_context(
@@ -33,8 +33,8 @@ from vantage6.cli.common.utils import print_log_worker
33
33
  from vantage6.cli.context import AlgorithmStoreContext, ServerContext
34
34
  from vantage6.cli.globals import AlgoStoreGlobals, ServerGlobals
35
35
  from vantage6.cli.utils import (
36
- validate_input_cmd_args,
37
36
  check_config_name_allowed,
37
+ validate_input_cmd_args,
38
38
  )
39
39
 
40
40
 
@@ -69,7 +69,7 @@ def check_for_start(ctx: AppContext, type_: InstanceType) -> DockerClient:
69
69
  )
70
70
  for server in running_servers:
71
71
  if server.name == f"{APPNAME}-{ctx.name}-{ctx.scope}-{type_}":
72
- error(f"Server {Fore.RED}{ctx.name}{Style.RESET_ALL} " "is already running")
72
+ error(f"Server {Fore.RED}{ctx.name}{Style.RESET_ALL} is already running")
73
73
  exit(1)
74
74
  return docker_client
75
75
 
@@ -304,8 +304,6 @@ def attach_logs(container: Container, type_: InstanceType) -> None:
304
304
  type_ : InstanceType
305
305
  The type of instance to attach the logs for
306
306
  """
307
- if isinstance(type_, enum.Enum):
308
- type_ = type_.value
309
307
  logs = container.attach(stream=True, logs=True, stdout=True)
310
308
  Thread(target=print_log_worker, args=(logs,), daemon=True).start()
311
309
  while True:
@@ -78,7 +78,7 @@ def get_running_servers(
78
78
  return [server.name for server in running_servers]
79
79
 
80
80
 
81
- def get_server_configuration_list(instance_type: InstanceType.SERVER) -> None:
81
+ def get_server_configuration_list(instance_type: InstanceType) -> None:
82
82
  """
83
83
  Print list of available server configurations.
84
84
 
@@ -90,11 +90,7 @@ def get_server_configuration_list(instance_type: InstanceType.SERVER) -> None:
90
90
  client = docker.from_env()
91
91
  ctx_class = select_context_class(instance_type)
92
92
 
93
- instance_type_value = (
94
- instance_type.value if isinstance(instance_type, enum.Enum) else instance_type
95
- )
96
-
97
- running_server_names = get_running_servers(client, instance_type_value)
93
+ running_server_names = get_running_servers(client, instance_type)
98
94
  header = "\nName" + (21 * " ") + "Status" + (10 * " ") + "System/User"
99
95
 
100
96
  click.echo(header)
@@ -108,26 +104,24 @@ def get_server_configuration_list(instance_type: InstanceType.SERVER) -> None:
108
104
  for config in configs:
109
105
  status = (
110
106
  running
111
- if f"{APPNAME}-{config.name}-system-{instance_type_value}"
112
- in running_server_names
107
+ if f"{APPNAME}-{config.name}-system-{instance_type}" in running_server_names
113
108
  else stopped
114
109
  )
115
- click.echo(f"{config.name:25}" f"{status:25} System ")
110
+ click.echo(f"{config.name:25}{status:25} System ")
116
111
 
117
112
  # user folders
118
113
  configs, f2 = ctx_class.available_configurations(system_folders=False)
119
114
  for config in configs:
120
115
  status = (
121
116
  running
122
- if f"{APPNAME}-{config.name}-user-{instance_type_value}"
123
- in running_server_names
117
+ if f"{APPNAME}-{config.name}-user-{instance_type}" in running_server_names
124
118
  else stopped
125
119
  )
126
- click.echo(f"{config.name:25}" f"{status:25} User ")
120
+ click.echo(f"{config.name:25}{status:25} User ")
127
121
 
128
122
  click.echo("-" * 85)
129
123
  if len(f1) + len(f2):
130
- warning(f"{Fore.RED}Failed imports: {len(f1)+len(f2)}{Style.RESET_ALL}")
124
+ warning(f"{Fore.RED}Failed imports: {len(f1) + len(f2)}{Style.RESET_ALL}")
131
125
 
132
126
 
133
127
  def print_log_worker(logs_stream: Iterable[bytes]) -> None:
@@ -1,4 +1,6 @@
1
- from schema import And, Or, Use, Optional
1
+ from typing import Self
2
+
3
+ from schema import And, Optional, Or, Use
2
4
 
3
5
  from vantage6.common.configuration_manager import Configuration, ConfigurationManager
4
6
 
@@ -63,7 +65,7 @@ class NodeConfigurationManager(ConfigurationManager):
63
65
  super().__init__(conf_class=NodeConfiguration, name=name)
64
66
 
65
67
  @classmethod
66
- def from_file(cls, path: str) -> "NodeConfigurationManager":
68
+ def from_file(cls, path: str) -> Self:
67
69
  """
68
70
  Create a new instance of the NodeConfigurationManager from a
69
71
  configuration file.
@@ -95,7 +97,7 @@ class ServerConfigurationManager(ConfigurationManager):
95
97
  super().__init__(conf_class=ServerConfiguration, name=name)
96
98
 
97
99
  @classmethod
98
- def from_file(cls, path) -> "ServerConfigurationManager":
100
+ def from_file(cls, path) -> Self:
99
101
  """
100
102
  Create a new instance of the ServerConfigurationManager from a
101
103
  configuration file.
@@ -56,9 +56,9 @@ def node_configuration_questionaire(dirs: dict, instance_name: str) -> dict:
56
56
 
57
57
  # set default port to the https port if server_url is https
58
58
  default_port = (
59
- str(Ports.HTTPS.value)
59
+ str(Ports.HTTPS)
60
60
  if config["server_url"].startswith("https")
61
- else str(Ports.DEV_SERVER.value)
61
+ else str(Ports.DEV_SERVER)
62
62
  )
63
63
 
64
64
  config = config | q.unsafe_prompt(
@@ -184,8 +184,7 @@ def node_configuration_questionaire(dirs: dict, instance_name: str) -> dict:
184
184
  error(f"Could not authenticate with server: {e}")
185
185
  error("Please check (1) your API key and (2) if your server is online")
186
186
  warning(
187
- "If you continue, you should provide your collaboration "
188
- "settings manually."
187
+ "If you continue, you should provide your collaboration settings manually."
189
188
  )
190
189
  if q.confirm("Do you want to abort?", default=True).unsafe_ask():
191
190
  exit(0)
@@ -314,10 +313,9 @@ def _get_common_server_config(instance_type: InstanceType, instance_name: str) -
314
313
  "name": "port",
315
314
  "message": "Enter port to which the server listens:",
316
315
  "default": (
317
- # Note that .value is required in YAML to get proper str value
318
- str(Ports.DEV_SERVER.value)
316
+ str(Ports.DEV_SERVER)
319
317
  if instance_type == InstanceType.SERVER
320
- else str(Ports.DEV_ALGO_STORE.value)
318
+ else str(Ports.DEV_ALGO_STORE)
321
319
  ),
322
320
  },
323
321
  ]
@@ -454,9 +452,7 @@ def algo_store_configuration_questionaire(instance_name: str) -> dict:
454
452
  """
455
453
  config = _get_common_server_config(InstanceType.ALGORITHM_STORE, instance_name)
456
454
 
457
- default_v6_server_uri = (
458
- f"http://localhost:{Ports.DEV_SERVER.value}{DEFAULT_API_PATH}"
459
- )
455
+ default_v6_server_uri = f"http://localhost:{Ports.DEV_SERVER}{DEFAULT_API_PATH}"
460
456
  default_root_username = "admin"
461
457
 
462
458
  v6_server_uri = q.text(
@@ -10,8 +10,9 @@ more.
10
10
 
11
11
  from colorama import Fore, Style
12
12
 
13
- from vantage6.common.globals import InstanceType
14
13
  from vantage6.common import error
14
+ from vantage6.common.globals import InstanceType
15
+
15
16
  from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
16
17
  from vantage6.cli.context.node import NodeContext
17
18
  from vantage6.cli.context.server import ServerContext
@@ -1,14 +1,15 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from vantage6.common.globals import APPNAME, InstanceType
4
+
5
+ from vantage6.cli._version import __version__
4
6
  from vantage6.cli.configuration_manager import ServerConfigurationManager
7
+ from vantage6.cli.context.base_server import BaseServerContext
5
8
  from vantage6.cli.globals import (
6
9
  DEFAULT_SERVER_SYSTEM_FOLDERS as S_FOL,
7
- ServerType,
8
10
  AlgoStoreGlobals,
11
+ ServerType,
9
12
  )
10
- from vantage6.cli._version import __version__
11
- from vantage6.cli.context.base_server import BaseServerContext
12
13
 
13
14
 
14
15
  class AlgorithmStoreContext(BaseServerContext):
@@ -28,7 +29,9 @@ class AlgorithmStoreContext(BaseServerContext):
28
29
 
29
30
  def __init__(self, instance_name: str, system_folders: bool = S_FOL):
30
31
  super().__init__(
31
- InstanceType.ALGORITHM_STORE, instance_name, system_folders=system_folders
32
+ InstanceType.ALGORITHM_STORE,
33
+ instance_name,
34
+ system_folders=system_folders,
32
35
  )
33
36
  self.log.info("vantage6 version '%s'", __version__)
34
37
 
@@ -41,7 +44,7 @@ class AlgorithmStoreContext(BaseServerContext):
41
44
  str
42
45
  string representation of the database uri
43
46
  """
44
- return super().get_database_uri(AlgoStoreGlobals.DB_URI_ENV_VAR)
47
+ return super().get_database_uri(AlgoStoreGlobals.DB_URI_ENV_VAR.value)
45
48
 
46
49
  @property
47
50
  def docker_container_name(self) -> str:
@@ -53,7 +56,7 @@ class AlgorithmStoreContext(BaseServerContext):
53
56
  str
54
57
  Server's docker container name
55
58
  """
56
- return f"{APPNAME}-{self.name}-{self.scope}-{ServerType.ALGORITHM_STORE.value}"
59
+ return f"{APPNAME}-{self.name}-{self.scope}-{ServerType.ALGORITHM_STORE}"
57
60
 
58
61
  @classmethod
59
62
  def from_external_config_file(
@@ -79,7 +82,7 @@ class AlgorithmStoreContext(BaseServerContext):
79
82
  return super().from_external_config_file(
80
83
  path,
81
84
  ServerType.ALGORITHM_STORE,
82
- AlgoStoreGlobals.CONFIG_NAME_ENV_VAR,
85
+ AlgoStoreGlobals.CONFIG_NAME_ENV_VAR.value,
83
86
  system_folders,
84
87
  )
85
88
 
@@ -2,14 +2,14 @@ from __future__ import annotations
2
2
 
3
3
  import hashlib
4
4
  import os.path
5
-
6
5
  from pathlib import Path
7
6
 
8
7
  from vantage6.common.context import AppContext
9
8
  from vantage6.common.globals import APPNAME, STRING_ENCODING, InstanceType
9
+
10
+ from vantage6.cli._version import __version__
10
11
  from vantage6.cli.configuration_manager import NodeConfigurationManager
11
12
  from vantage6.cli.globals import DEFAULT_NODE_SYSTEM_FOLDERS as N_FOL
12
- from vantage6.cli._version import __version__
13
13
 
14
14
 
15
15
  class NodeContext(AppContext):
@@ -40,12 +40,7 @@ class NodeContext(AppContext):
40
40
  logger_prefix: str = "",
41
41
  ):
42
42
  super().__init__(
43
- InstanceType.NODE,
44
- instance_name,
45
- system_folders,
46
- config_file,
47
- print_log_header,
48
- logger_prefix,
43
+ InstanceType.NODE, instance_name, system_folders=system_folders
49
44
  )
50
45
  if print_log_header:
51
46
  self.log.info("vantage6 version '%s'", __version__)
@@ -133,7 +128,7 @@ class NodeContext(AppContext):
133
128
  Path
134
129
  Path to the data folder
135
130
  """
136
- return AppContext.type_data_folder(InstanceType.NODE.value, system_folders)
131
+ return AppContext.type_data_folder(InstanceType.NODE, system_folders)
137
132
 
138
133
  @property
139
134
  def databases(self) -> dict:
@@ -1,16 +1,18 @@
1
1
  from __future__ import annotations
2
+
2
3
  from pathlib import Path
3
4
 
4
5
  from vantage6.common.globals import APPNAME, InstanceType
6
+
7
+ from vantage6.cli._version import __version__
5
8
  from vantage6.cli.configuration_manager import ServerConfigurationManager
9
+ from vantage6.cli.context.base_server import BaseServerContext
6
10
  from vantage6.cli.globals import (
7
11
  DEFAULT_SERVER_SYSTEM_FOLDERS as S_FOL,
8
12
  PROMETHEUS_DIR,
9
- ServerType,
10
13
  ServerGlobals,
14
+ ServerType,
11
15
  )
12
- from vantage6.cli._version import __version__
13
- from vantage6.cli.context.base_server import BaseServerContext
14
16
 
15
17
 
16
18
  class ServerContext(BaseServerContext):
@@ -45,7 +47,7 @@ class ServerContext(BaseServerContext):
45
47
  str
46
48
  string representation of the database uri
47
49
  """
48
- return super().get_database_uri(ServerGlobals.DB_URI_ENV_VAR)
50
+ return super().get_database_uri(ServerGlobals.DB_URI_ENV_VAR.value)
49
51
 
50
52
  @property
51
53
  def docker_container_name(self) -> str:
@@ -105,7 +107,10 @@ class ServerContext(BaseServerContext):
105
107
  Server context object
106
108
  """
107
109
  return super().from_external_config_file(
108
- path, ServerType.V6SERVER, ServerGlobals.CONFIG_NAME_ENV_VAR, system_folders
110
+ path,
111
+ ServerType.V6SERVER,
112
+ ServerGlobals.CONFIG_NAME_ENV_VAR.value,
113
+ system_folders,
109
114
  )
110
115
 
111
116
  @classmethod