vantage6 5.0.0a26__py3-none-any.whl → 5.0.0a33__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 (44) hide show
  1. vantage6/cli/__init__.py +5 -1
  2. vantage6/cli/algorithm/generate_algorithm_json.py +28 -34
  3. vantage6/cli/algostore/list.py +2 -1
  4. vantage6/cli/algostore/start.py +6 -6
  5. vantage6/cli/algostore/stop.py +3 -2
  6. vantage6/cli/common/decorator.py +3 -1
  7. vantage6/cli/common/start.py +2 -4
  8. vantage6/cli/common/utils.py +7 -13
  9. vantage6/cli/configuration_manager.py +5 -3
  10. vantage6/cli/configuration_wizard.py +6 -10
  11. vantage6/cli/context/__init__.py +2 -1
  12. vantage6/cli/context/algorithm_store.py +10 -7
  13. vantage6/cli/context/node.py +7 -7
  14. vantage6/cli/context/server.py +10 -5
  15. vantage6/cli/dev/create.py +11 -13
  16. vantage6/cli/dev/remove.py +2 -2
  17. vantage6/cli/globals.py +5 -5
  18. vantage6/cli/node/common/__init__.py +6 -5
  19. vantage6/cli/node/start.py +18 -24
  20. vantage6/cli/server/files.py +4 -2
  21. vantage6/cli/server/import_.py +7 -7
  22. vantage6/cli/server/list.py +2 -1
  23. vantage6/cli/server/shell.py +5 -4
  24. vantage6/cli/server/start.py +2 -1
  25. vantage6/cli/server/stop.py +3 -2
  26. vantage6/cli/server/version.py +5 -4
  27. vantage6/cli/template/node_config.j2 +2 -0
  28. vantage6/cli/test/algo_test_scripts/algo_test_script.py +6 -5
  29. vantage6/cli/test/feature_tester.py +5 -2
  30. vantage6-5.0.0a33.dist-info/METADATA +54 -0
  31. {vantage6-5.0.0a26.dist-info → vantage6-5.0.0a33.dist-info}/RECORD +33 -42
  32. {vantage6-5.0.0a26.dist-info → vantage6-5.0.0a33.dist-info}/WHEEL +1 -2
  33. vantage6-5.0.0a33.dist-info/entry_points.txt +2 -0
  34. tests_cli/__init__.py +0 -0
  35. tests_cli/test_client_script.py +0 -23
  36. tests_cli/test_example.py +0 -7
  37. tests_cli/test_node_cli.py +0 -452
  38. tests_cli/test_server_cli.py +0 -179
  39. tests_cli/test_wizard.py +0 -141
  40. vantage6/cli/__build__ +0 -1
  41. vantage6/cli/_version.py +0 -23
  42. vantage6-5.0.0a26.dist-info/METADATA +0 -231
  43. vantage6-5.0.0a26.dist-info/entry_points.txt +0 -5
  44. vantage6-5.0.0a26.dist-info/top_level.txt +0 -2
vantage6/cli/__init__.py CHANGED
@@ -1,3 +1,7 @@
1
1
  """Command line interface for the vantage6 infrastructure."""
2
2
 
3
- from ._version import version_info, __version__ # noqa: F401
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")
@@ -1,27 +1,25 @@
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.client import AlgorithmClient
25
23
  from vantage6.algorithm.preprocessing.algorithm_json_data import (
26
24
  PREPROCESSING_FUNCTIONS_JSON_DATA,
27
25
  )
@@ -54,7 +52,7 @@ class MergePreference:
54
52
  cls._prefer_existing = None
55
53
 
56
54
 
57
- class FunctionArgumentType(Enum):
55
+ class FunctionArgumentType(StrEnumBase):
58
56
  """Type of the function argument"""
59
57
 
60
58
  PARAMETER = "parameter"
@@ -80,7 +78,7 @@ class Function:
80
78
  "display_name": self._pretty_print_name(self.name),
81
79
  "standalone": True,
82
80
  "description": self._extract_headline_of_docstring(),
83
- "step_type": self.step_type,
81
+ "step_type": self.step_type.value if self.step_type else None,
84
82
  "ui_visualizations": [],
85
83
  "arguments": [],
86
84
  "databases": [],
@@ -91,7 +89,7 @@ class Function:
91
89
  # if the function is a data extraction function, the first argument is a dict
92
90
  # with database connection details. This argument should not be added to the
93
91
  # function json. Instead, a database should be added to the function json.
94
- if self.step_type == AlgorithmStepType.DATA_EXTRACTION.value:
92
+ if self.step_type == AlgorithmStepType.DATA_EXTRACTION:
95
93
  function_json["databases"].append(
96
94
  {
97
95
  "name": "Database",
@@ -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
 
@@ -211,11 +209,12 @@ class Function:
211
209
  }, FunctionArgumentType.DATAFRAME
212
210
  else:
213
211
  # This is a regular function parameter
212
+ type_ = self._get_argument_type(param, name)
214
213
  arg_json = {
215
214
  "name": name,
216
215
  "display_name": self._pretty_print_name(name),
217
216
  "description": self._extract_parameter_description(name),
218
- "type": self.get_argument_type(param, name),
217
+ "type": type_.value if type_ else None,
219
218
  "required": param.default == inspect.Parameter.empty,
220
219
  "has_default_value": param.default != inspect.Parameter.empty,
221
220
  "is_frontend_only": False,
@@ -247,7 +246,9 @@ class Function:
247
246
  "will not be added."
248
247
  )
249
248
 
250
- def get_argument_type(self, param: inspect.Parameter, name: str) -> str:
249
+ def _get_argument_type(
250
+ self, param: inspect.Parameter, name: str
251
+ ) -> AlgorithmArgumentType | None:
251
252
  """Get the type of the argument"""
252
253
  if isinstance(param.annotation, UnionType):
253
254
  # Arguments with default values may have type 'str | None'. If that is the
@@ -276,23 +277,23 @@ class Function:
276
277
  type_ = param.annotation
277
278
 
278
279
  if type_ == str:
279
- return AlgorithmArgumentType.STRING.value
280
+ return AlgorithmArgumentType.STRING
280
281
  elif type_ == dict:
281
- return AlgorithmArgumentType.JSON.value
282
+ return AlgorithmArgumentType.JSON
282
283
  elif type_ == int:
283
- return AlgorithmArgumentType.INTEGER.value
284
+ return AlgorithmArgumentType.INTEGER
284
285
  elif type_ == float:
285
- return AlgorithmArgumentType.FLOAT.value
286
+ return AlgorithmArgumentType.FLOAT
286
287
  elif type_ == bool:
287
- return AlgorithmArgumentType.BOOLEAN.value
288
+ return AlgorithmArgumentType.BOOLEAN
288
289
  elif type_ == list:
289
- return AlgorithmArgumentType.STRINGS.value
290
+ return AlgorithmArgumentType.STRINGS
290
291
  elif type_ == list[str]:
291
- return AlgorithmArgumentType.STRINGS.value
292
+ return AlgorithmArgumentType.STRINGS
292
293
  elif type_ == list[int]:
293
- return AlgorithmArgumentType.INTEGERS.value
294
+ return AlgorithmArgumentType.INTEGERS
294
295
  elif type_ == list[float]:
295
- return AlgorithmArgumentType.FLOATS.value
296
+ return AlgorithmArgumentType.FLOATS
296
297
  else:
297
298
  warning(
298
299
  f"Unsupported argument type: {param.annotation} for argument {name} "
@@ -321,21 +322,14 @@ class Function:
321
322
  header = " ".join(line.strip() for line in lines if line.strip() != "")
322
323
  return header
323
324
 
324
- def _get_step_type(self) -> str:
325
+ def _get_step_type(self) -> AlgorithmStepType | None:
325
326
  """Get the step type of the function"""
326
327
  decorator_type = get_vantage6_decorator_type(self.func)
327
- if decorator_type == DecoratorStepType.FEDERATED:
328
- return AlgorithmStepType.FEDERATED_COMPUTE.value
329
- elif decorator_type == DecoratorStepType.CENTRAL:
330
- return AlgorithmStepType.CENTRAL_COMPUTE.value
331
- elif decorator_type == DecoratorStepType.PREPROCESSING:
332
- return AlgorithmStepType.PREPROCESSING.value
333
- elif decorator_type == DecoratorStepType.DATA_EXTRACTION:
334
- return AlgorithmStepType.DATA_EXTRACTION.value
328
+ if decorator_type in AlgorithmStepType.list():
329
+ return decorator_type
335
330
  else:
336
331
  warning(
337
- f"Unsupported decorator type: {decorator_type} for function "
338
- f"{self.name}"
332
+ f"Unsupported decorator type: {decorator_type} for function {self.name}"
339
333
  )
340
334
  return None
341
335
 
@@ -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 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 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):
@@ -42,10 +42,10 @@ class NodeContext(AppContext):
42
42
  super().__init__(
43
43
  InstanceType.NODE,
44
44
  instance_name,
45
- system_folders,
46
- config_file,
47
- print_log_header,
48
- logger_prefix,
45
+ system_folders=system_folders,
46
+ config_file=config_file,
47
+ print_log_header=print_log_header,
48
+ logger_prefix=logger_prefix,
49
49
  )
50
50
  if print_log_header:
51
51
  self.log.info("vantage6 version '%s'", __version__)
@@ -133,7 +133,7 @@ class NodeContext(AppContext):
133
133
  Path
134
134
  Path to the data folder
135
135
  """
136
- return AppContext.type_data_folder(InstanceType.NODE.value, system_folders)
136
+ return AppContext.type_data_folder(InstanceType.NODE, system_folders)
137
137
 
138
138
  @property
139
139
  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 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
@@ -1,20 +1,20 @@
1
- from pathlib import Path
2
1
  from importlib import resources as impresources
3
- import yaml
2
+ from pathlib import Path
3
+
4
4
  import click
5
5
  import pandas as pd
6
-
7
- from jinja2 import Environment, FileSystemLoader
6
+ import yaml
8
7
  from colorama import Fore, Style
8
+ from jinja2 import Environment, FileSystemLoader
9
9
 
10
+ from vantage6.common import ensure_config_dir_writable, error, generate_apikey, info
10
11
  from vantage6.common.globals import APPNAME, InstanceType, Ports
11
- from vantage6.common import ensure_config_dir_writable, info, error, generate_apikey
12
12
 
13
13
  import vantage6.cli.dev.data as data_dir
14
14
  from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
15
- from vantage6.cli.globals import PACKAGE_FOLDER, DefaultDatasets
16
- from vantage6.cli.context.server import ServerContext
17
15
  from vantage6.cli.context.node import NodeContext
16
+ from vantage6.cli.context.server import ServerContext
17
+ from vantage6.cli.globals import PACKAGE_FOLDER, DefaultDatasets
18
18
  from vantage6.cli.server.common import get_server_context
19
19
  from vantage6.cli.server.import_ import cli_server_import
20
20
  from vantage6.cli.utils import prompt_config_name
@@ -428,7 +428,7 @@ def create_algo_store_config(
428
428
  )
429
429
  folders = AlgorithmStoreContext.instance_folders(
430
430
  instance_type=InstanceType.ALGORITHM_STORE,
431
- instance_name="{server_name}_store",
431
+ instance_name=f"{server_name}_store",
432
432
  system_folders=False,
433
433
  )
434
434
 
@@ -546,21 +546,19 @@ def demo_network(
546
546
  "--server-port",
547
547
  type=int,
548
548
  default=Ports.DEV_SERVER.value,
549
- help=f"Port to run the server on. Default is {Ports.DEV_SERVER.value}.",
549
+ help=f"Port to run the server on. Default is {Ports.DEV_SERVER}.",
550
550
  )
551
551
  @click.option(
552
552
  "--ui-port",
553
553
  type=int,
554
554
  default=Ports.DEV_UI.value,
555
- help=f"Port to run the UI on. Default is {Ports.DEV_UI.value}.",
555
+ help=f"Port to run the UI on. Default is {Ports.DEV_UI}.",
556
556
  )
557
557
  @click.option(
558
558
  "--algorithm-store-port",
559
559
  type=int,
560
560
  default=Ports.DEV_ALGO_STORE.value,
561
- help=(
562
- f"Port to run the algorithm store on. Default is {Ports.DEV_ALGO_STORE.value}."
563
- ),
561
+ help=(f"Port to run the algorithm store on. Default is {Ports.DEV_ALGO_STORE}."),
564
562
  )
565
563
  @click.option(
566
564
  "-i",
@@ -41,10 +41,10 @@
41
41
  # # check that the server is not running
42
42
  # client = docker.from_env()
43
43
  # running_servers = client.containers.list(
44
- # filters={"label": f"{APPNAME}-type={InstanceType.SERVER.value}"}
44
+ # filters={"label": f"{APPNAME}-type={InstanceType.SERVER}"}
45
45
  # )
46
46
  # running_server_names = [server.name for server in running_servers]
47
- # container_name = f"{APPNAME}-{name}-user-{InstanceType.SERVER.value}"
47
+ # container_name = f"{APPNAME}-{name}-user-{InstanceType.SERVER}"
48
48
  # if container_name in running_server_names:
49
49
  # error(
50
50
  # f"Server {Fore.RED}{name}{Style.RESET_ALL} is still running! First stop "