vantage6 5.0.0a36__py3-none-any.whl → 5.0.0a38__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 (80) hide show
  1. vantage6/cli/algorithm/generate_algorithm_json.py +0 -1
  2. vantage6/cli/algostore/attach.py +28 -3
  3. vantage6/cli/algostore/list.py +2 -2
  4. vantage6/cli/algostore/new.py +3 -2
  5. vantage6/cli/algostore/start.py +25 -6
  6. vantage6/cli/algostore/stop.py +3 -0
  7. vantage6/cli/algostore/version.py +62 -0
  8. vantage6/cli/auth/attach.py +1 -1
  9. vantage6/cli/auth/list.py +2 -2
  10. vantage6/cli/auth/new.py +3 -2
  11. vantage6/cli/auth/remove.py +58 -0
  12. vantage6/cli/auth/start.py +27 -9
  13. vantage6/cli/auth/stop.py +3 -0
  14. vantage6/cli/cli.py +21 -0
  15. vantage6/cli/common/attach.py +114 -0
  16. vantage6/cli/common/decorator.py +25 -4
  17. vantage6/cli/common/list.py +68 -0
  18. vantage6/cli/common/new.py +27 -7
  19. vantage6/cli/common/remove.py +18 -0
  20. vantage6/cli/common/start.py +48 -40
  21. vantage6/cli/common/stop.py +16 -4
  22. vantage6/cli/common/utils.py +65 -74
  23. vantage6/cli/common/version.py +82 -0
  24. vantage6/cli/config.py +10 -2
  25. vantage6/cli/{configuration_wizard.py → configuration_create.py} +22 -14
  26. vantage6/cli/configuration_manager.py +70 -21
  27. vantage6/cli/context/__init__.py +10 -5
  28. vantage6/cli/context/algorithm_store.py +13 -7
  29. vantage6/cli/context/auth.py +23 -5
  30. vantage6/cli/context/node.py +25 -8
  31. vantage6/cli/context/server.py +18 -6
  32. vantage6/cli/globals.py +1 -0
  33. vantage6/cli/node/attach.py +27 -3
  34. vantage6/cli/node/common/__init__.py +26 -10
  35. vantage6/cli/node/common/task_cleanup.py +153 -0
  36. vantage6/cli/node/list.py +3 -44
  37. vantage6/cli/node/new.py +13 -6
  38. vantage6/cli/node/set_api_key.py +1 -1
  39. vantage6/cli/node/start.py +30 -7
  40. vantage6/cli/node/stop.py +151 -7
  41. vantage6/cli/node/version.py +96 -33
  42. vantage6/cli/sandbox/config/base.py +109 -0
  43. vantage6/cli/sandbox/config/core.py +300 -0
  44. vantage6/cli/sandbox/config/node.py +311 -0
  45. vantage6/cli/sandbox/data/km_dataset.csv +2401 -0
  46. vantage6/cli/sandbox/data/olympic_athletes_2016.csv +2425 -0
  47. vantage6/cli/sandbox/new.py +207 -0
  48. vantage6/cli/sandbox/populate/__init__.py +173 -0
  49. vantage6/cli/sandbox/populate/helpers/connect_store.py +203 -0
  50. vantage6/cli/sandbox/populate/helpers/delete_fixtures.py +67 -0
  51. vantage6/cli/sandbox/populate/helpers/load_fixtures.py +476 -0
  52. vantage6/cli/sandbox/populate/helpers/utils.py +35 -0
  53. vantage6/cli/sandbox/remove.py +155 -0
  54. vantage6/cli/sandbox/start.py +349 -0
  55. vantage6/cli/sandbox/stop.py +106 -0
  56. vantage6/cli/server/attach.py +28 -3
  57. vantage6/cli/server/common/__init__.py +5 -6
  58. vantage6/cli/server/import_.py +137 -119
  59. vantage6/cli/server/list.py +2 -2
  60. vantage6/cli/server/new.py +5 -3
  61. vantage6/cli/server/start.py +21 -4
  62. vantage6/cli/server/stop.py +2 -0
  63. vantage6/cli/server/version.py +31 -18
  64. vantage6/cli/template/algo_store_config.j2 +3 -0
  65. vantage6/cli/template/auth_config.j2 +24 -1
  66. vantage6/cli/template/node_config.j2 +2 -0
  67. vantage6/cli/template/server_config.j2 +10 -7
  68. vantage6/cli/use/context.py +8 -1
  69. vantage6/cli/use/namespace.py +10 -7
  70. vantage6/cli/utils.py +33 -1
  71. vantage6/cli/utils_kubernetes.py +270 -0
  72. {vantage6-5.0.0a36.dist-info → vantage6-5.0.0a38.dist-info}/METADATA +4 -4
  73. vantage6-5.0.0a38.dist-info/RECORD +102 -0
  74. vantage6/cli/rabbitmq/__init__.py +0 -0
  75. vantage6/cli/rabbitmq/definitions.py +0 -26
  76. vantage6/cli/rabbitmq/queue_manager.py +0 -220
  77. vantage6/cli/rabbitmq/rabbitmq.config +0 -8
  78. vantage6-5.0.0a36.dist-info/RECORD +0 -86
  79. {vantage6-5.0.0a36.dist-info → vantage6-5.0.0a38.dist-info}/WHEEL +0 -0
  80. {vantage6-5.0.0a36.dist-info → vantage6-5.0.0a38.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,82 @@
1
+ from vantage6.common import error
2
+ from vantage6.common.globals import InstanceType
3
+
4
+ from vantage6.cli.common.utils import (
5
+ find_running_service_names,
6
+ get_config_name_from_helm_release_name,
7
+ select_context_and_namespace,
8
+ select_running_service,
9
+ )
10
+ from vantage6.cli.context import get_context
11
+ from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
12
+ from vantage6.cli.context.node import NodeContext
13
+ from vantage6.cli.context.server import ServerContext
14
+
15
+
16
+ def get_and_select_ctx(
17
+ instance_type: InstanceType,
18
+ name: str,
19
+ system_folders: bool,
20
+ context: str,
21
+ namespace: str,
22
+ is_sandbox: bool,
23
+ ) -> ServerContext | NodeContext | AlgorithmStoreContext:
24
+ """
25
+ Get and select the context for the given instance type.
26
+
27
+ Parameters
28
+ ----------
29
+ instance_type : InstanceType
30
+ The type of instance to get the context for
31
+ name : str
32
+ The name of the instance
33
+ system_folders : bool
34
+ Whether to use system folders or not
35
+ context : str
36
+ The Kubernetes context to use
37
+ namespace : str
38
+ The Kubernetes namespace to use
39
+ is_sandbox : bool
40
+ Whether the configuration is a sandbox configuration
41
+
42
+ Returns
43
+ -------
44
+ ServerContext | NodeContext | AlgorithmStoreContext
45
+ The context for the given instance type
46
+ """
47
+ context, namespace = select_context_and_namespace(
48
+ context=context,
49
+ namespace=namespace,
50
+ )
51
+ running_services = find_running_service_names(
52
+ instance_type=instance_type,
53
+ only_system_folders=False,
54
+ only_user_folders=False,
55
+ context=context,
56
+ namespace=namespace,
57
+ sandbox=is_sandbox,
58
+ )
59
+
60
+ if not running_services:
61
+ error(f"No running {instance_type.value}s found.")
62
+ exit(1)
63
+
64
+ if not name:
65
+ helm_name = select_running_service(running_services, instance_type)
66
+
67
+ service_name = get_config_name_from_helm_release_name(
68
+ helm_name, is_store=(instance_type == InstanceType.ALGORITHM_STORE)
69
+ )
70
+ ctx = get_context(
71
+ instance_type, service_name, system_folders, is_sandbox=is_sandbox
72
+ )
73
+
74
+ else:
75
+ ctx = get_context(instance_type, name, system_folders, is_sandbox=is_sandbox)
76
+ helm_name = ctx.helm_release_name
77
+ service_name = ctx.name
78
+
79
+ if helm_name not in running_services:
80
+ error(f"The {instance_type.value} {service_name} is not running.")
81
+ exit(1)
82
+ return ctx
vantage6/cli/config.py CHANGED
@@ -13,6 +13,8 @@ from vantage6.cli.globals import (
13
13
  DEFAULT_CLI_CONFIG_FILE,
14
14
  )
15
15
 
16
+ _CONTEXT_INFO_PRINTED = False
17
+
16
18
 
17
19
  class CliConfig:
18
20
  """
@@ -255,6 +257,12 @@ class CliConfig:
255
257
  if last_namespace != active_namespace:
256
258
  self.set_last_namespace(namespace=active_namespace)
257
259
 
258
- info(f"Using context: {Fore.YELLOW}{active_context}{Style.RESET_ALL}")
259
- info(f"Using namespace: {Fore.YELLOW}{active_namespace}{Style.RESET_ALL}")
260
+ # only print the context and namespace once. This is to avoid printing it many
261
+ # times, e.g. in sandbox commands
262
+ global _CONTEXT_INFO_PRINTED
263
+ if not _CONTEXT_INFO_PRINTED:
264
+ info(f"Using context: {Fore.YELLOW}{active_context}{Style.RESET_ALL}")
265
+ info(f"Using namespace: {Fore.YELLOW}{active_namespace}{Style.RESET_ALL}")
266
+ _CONTEXT_INFO_PRINTED = True
267
+
260
268
  return active_context, active_namespace
@@ -126,25 +126,31 @@ def _add_production_server_config(config: dict) -> dict:
126
126
  return config
127
127
 
128
128
 
129
- def configuration_wizard(
130
- questionnaire_function: callable,
129
+ def make_configuration(
130
+ config_producing_func: callable,
131
+ config_producing_func_args: tuple,
131
132
  type_: InstanceType,
132
133
  instance_name: str,
133
134
  system_folders: bool,
135
+ is_sandbox: bool = False,
134
136
  ) -> Path:
135
137
  """
136
138
  Create a configuration file for a node or server instance.
137
139
 
138
140
  Parameters
139
141
  ----------
140
- questionnaire_function : callable
142
+ config_producing_func : callable
141
143
  Function to generate the configuration
144
+ config_producing_func_args : tuple
145
+ Arguments to pass to the config producing function
142
146
  type_ : InstanceType
143
147
  Type of the instance to create a configuration for
144
148
  instance_name : str
145
149
  Name of the instance
146
150
  system_folders : bool
147
151
  Whether to use the system folders or not
152
+ is_sandbox : bool
153
+ Whether to create a sandbox configuration or not
148
154
 
149
155
  Returns
150
156
  -------
@@ -154,11 +160,10 @@ def configuration_wizard(
154
160
  # for defaults and where to save the config
155
161
  dirs = AppContext.instance_folders(type_, instance_name, system_folders)
156
162
 
157
- # invoke questionaire to create configuration file
158
- if type_ == InstanceType.NODE:
159
- config = questionnaire_function(dirs, instance_name)
160
- else:
161
- config = questionnaire_function(instance_name)
163
+ # invoke function to create configuration file. Usually this is a questionaire
164
+ # but it can also be a function that immediately returns a dict with the
165
+ # configuration.
166
+ config = config_producing_func(*config_producing_func_args)
162
167
 
163
168
  # in the case of an environment we need to add it to the current
164
169
  # configuration. In the case of application we can simply overwrite this
@@ -176,17 +181,19 @@ def configuration_wizard(
176
181
  raise ValueError(f"Invalid instance type: {type_}")
177
182
 
178
183
  if Path(config_file).exists():
179
- config_manager = conf_manager.from_file(config_file)
184
+ config_manager = conf_manager.from_file(config_file, is_sandbox=is_sandbox)
180
185
  else:
181
- config_manager = conf_manager(instance_name)
186
+ config_manager = conf_manager(instance_name, is_sandbox=is_sandbox)
182
187
 
183
188
  config_manager.put(config)
184
- config_manager.save(config_file)
189
+ config_file = config_manager.save(config_file)
185
190
 
186
191
  return config_file
187
192
 
188
193
 
189
- def select_configuration_questionaire(type_: InstanceType, system_folders: bool) -> str:
194
+ def select_configuration_questionnaire(
195
+ type_: InstanceType, system_folders: bool, is_sandbox: bool = False
196
+ ) -> str:
190
197
  """
191
198
  Ask which configuration the user wants to use. It shows only configurations
192
199
  that are in the default folder.
@@ -197,14 +204,15 @@ def select_configuration_questionaire(type_: InstanceType, system_folders: bool)
197
204
  Type of the instance to create a configuration for
198
205
  system_folders : bool
199
206
  Whether to use the system folders or not
200
-
207
+ is_sandbox : bool
208
+ Whether to show only the sandbox configurations or not
201
209
  Returns
202
210
  -------
203
211
  str
204
212
  Name of the configuration
205
213
  """
206
214
  context = select_context_class(type_)
207
- configs, _ = context.available_configurations(system_folders)
215
+ configs, _ = context.available_configurations(system_folders, is_sandbox)
208
216
 
209
217
  # each collection (file) can contain multiple configs. (e.g. test,
210
218
  # dev)
@@ -1,3 +1,4 @@
1
+ from pathlib import Path
1
2
  from typing import Self
2
3
 
3
4
  from schema import And, Use
@@ -86,18 +87,18 @@ class NodeConfigurationManager(ConfigurationManager):
86
87
  Name of the configuration file.
87
88
  """
88
89
 
89
- def __init__(self, name, *args, **kwargs) -> None:
90
- super().__init__(conf_class=NodeConfiguration, name=name)
90
+ def __init__(self, name: str, is_sandbox: bool = False, *args, **kwargs) -> None:
91
+ super().__init__(conf_class=NodeConfiguration, name=name, is_sandbox=is_sandbox)
91
92
 
92
93
  @classmethod
93
- def from_file(cls, path: str) -> Self:
94
+ def from_file(cls, path: Path | str, is_sandbox: bool = False) -> Self:
94
95
  """
95
96
  Create a new instance of the NodeConfigurationManager from a
96
97
  configuration file.
97
98
 
98
99
  Parameters
99
100
  ----------
100
- path : str
101
+ path : str | Path
101
102
  Path to the configuration file.
102
103
 
103
104
  Returns
@@ -105,7 +106,9 @@ class NodeConfigurationManager(ConfigurationManager):
105
106
  NodeConfigurationManager
106
107
  A new instance of the NodeConfigurationManager.
107
108
  """
108
- return super().from_file(path, conf_class=NodeConfiguration)
109
+ return super().from_file(
110
+ path, conf_class=NodeConfiguration, is_sandbox=is_sandbox
111
+ )
109
112
 
110
113
  def get_config_template(self) -> str:
111
114
  """
@@ -124,18 +127,20 @@ class ServerConfigurationManager(ConfigurationManager):
124
127
  Name of the configuration file.
125
128
  """
126
129
 
127
- def __init__(self, name, *args, **kwargs) -> None:
128
- super().__init__(conf_class=ServerConfiguration, name=name)
130
+ def __init__(self, name: str, is_sandbox: bool = False, *args, **kwargs) -> None:
131
+ super().__init__(
132
+ conf_class=ServerConfiguration, name=name, is_sandbox=is_sandbox
133
+ )
129
134
 
130
135
  @classmethod
131
- def from_file(cls, path) -> Self:
136
+ def from_file(cls, path: Path | str, is_sandbox: bool = False) -> Self:
132
137
  """
133
138
  Create a new instance of the ServerConfigurationManager from a
134
139
  configuration file.
135
140
 
136
141
  Parameters
137
142
  ----------
138
- path : str
143
+ path : str | Path
139
144
  Path to the configuration file.
140
145
 
141
146
  Returns
@@ -143,7 +148,9 @@ class ServerConfigurationManager(ConfigurationManager):
143
148
  ServerConfigurationManager
144
149
  A new instance of the ServerConfigurationManager.
145
150
  """
146
- return super().from_file(path, conf_class=ServerConfiguration)
151
+ return super().from_file(
152
+ path, conf_class=ServerConfiguration, is_sandbox=is_sandbox
153
+ )
147
154
 
148
155
  def get_config_template(self) -> str:
149
156
  """
@@ -167,18 +174,20 @@ class AlgorithmStoreConfigurationManager(ConfigurationManager):
167
174
  Name of the configuration file.
168
175
  """
169
176
 
170
- def __init__(self, name, *args, **kwargs) -> None:
171
- super().__init__(conf_class=AlgorithmStoreConfiguration, name=name)
177
+ def __init__(self, name: str, is_sandbox: bool = False, *args, **kwargs) -> None:
178
+ super().__init__(
179
+ conf_class=AlgorithmStoreConfiguration, name=name, is_sandbox=is_sandbox
180
+ )
172
181
 
173
182
  @classmethod
174
- def from_file(cls, path: str) -> Self:
183
+ def from_file(cls, path: Path | str, is_sandbox: bool = False) -> Self:
175
184
  """
176
185
  Create a new instance of the AlgorithmStoreConfigurationManager from a
177
186
  configuration file.
178
187
 
179
188
  Parameters
180
189
  ----------
181
- path : str
190
+ path : str | Path
182
191
  Path to the configuration file.
183
192
 
184
193
  Returns
@@ -186,7 +195,9 @@ class AlgorithmStoreConfigurationManager(ConfigurationManager):
186
195
  AlgorithmStoreConfigurationManager
187
196
  A new instance of the AlgorithmStoreConfigurationManager.
188
197
  """
189
- return super().from_file(path, conf_class=AlgorithmStoreConfiguration)
198
+ return super().from_file(
199
+ path, conf_class=AlgorithmStoreConfiguration, is_sandbox=is_sandbox
200
+ )
190
201
 
191
202
  def get_config_template(self) -> str:
192
203
  """
@@ -208,14 +219,34 @@ class AuthConfigurationManager(ConfigurationManager):
208
219
  ----------
209
220
  name : str
210
221
  Name of the configuration file.
222
+ is_sandbox : bool, optional
223
+ Whether the configuration is a sandbox configuration, by default False
211
224
  """
212
225
 
213
- def __init__(self, name, *args, **kwargs):
214
- super().__init__(conf_class=AuthConfiguration, name=name)
226
+ def __init__(self, name, is_sandbox: bool = False, *args, **kwargs):
227
+ super().__init__(conf_class=AuthConfiguration, name=name, is_sandbox=is_sandbox)
215
228
 
216
229
  @classmethod
217
- def from_file(cls, path: str) -> Self:
218
- return super().from_file(path, conf_class=AuthConfiguration)
230
+ def from_file(cls, path: Path | str, is_sandbox: bool = False) -> Self:
231
+ """
232
+ Create a new instance of the AuthConfigurationManager from a
233
+ configuration file.
234
+
235
+ Parameters
236
+ ----------
237
+ path : str | Path
238
+ Path to the configuration file.
239
+ is_sandbox : bool, optional
240
+ Whether the configuration is a sandbox configuration, by default False
241
+
242
+ Returns
243
+ -------
244
+ AuthConfigurationManager
245
+ A new instance of the AuthConfigurationManager.
246
+ """
247
+ return super().from_file(
248
+ path, conf_class=AuthConfiguration, is_sandbox=is_sandbox
249
+ )
219
250
 
220
251
  def get_config_template(self) -> str:
221
252
  """
@@ -229,5 +260,23 @@ class TestingConfigurationManager(ConfigurationManager):
229
260
  super().__init__(conf_class=TestConfiguration, name=name)
230
261
 
231
262
  @classmethod
232
- def from_file(cls, path):
233
- return super().from_file(path, conf_class=TestConfiguration)
263
+ def from_file(cls, path: Path | str, is_sandbox: bool = False) -> Self:
264
+ """
265
+ Create a new instance of the TestingConfigurationManager from a
266
+ configuration file.
267
+
268
+ Parameters
269
+ ----------
270
+ path : str | Path
271
+ Path to the configuration file.
272
+ is_sandbox : bool, optional
273
+ Whether the configuration is a sandbox configuration, by default False
274
+
275
+ Returns
276
+ -------
277
+ TestingConfigurationManager
278
+ A new instance of the TestingConfigurationManager.
279
+ """
280
+ return super().from_file(
281
+ path, conf_class=TestConfiguration, is_sandbox=is_sandbox
282
+ )
@@ -13,6 +13,7 @@ from colorama import Fore, Style
13
13
  from vantage6.common import error
14
14
  from vantage6.common.globals import InstanceType
15
15
 
16
+ from vantage6.cli.common.utils import extract_name_and_is_sandbox
16
17
  from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
17
18
  from vantage6.cli.context.auth import AuthContext
18
19
  from vantage6.cli.context.node import NodeContext
@@ -21,7 +22,7 @@ from vantage6.cli.context.server import ServerContext
21
22
 
22
23
  def select_context_class(
23
24
  type_: InstanceType,
24
- ) -> ServerContext | NodeContext | AlgorithmStoreContext:
25
+ ) -> ServerContext | NodeContext | AlgorithmStoreContext | AuthContext:
25
26
  """
26
27
  Select the context class based on the type of instance.
27
28
 
@@ -32,7 +33,7 @@ def select_context_class(
32
33
 
33
34
  Returns
34
35
  -------
35
- ServerContext | NodeContext | AlgorithmStoreContext
36
+ ServerContext | NodeContext | AlgorithmStoreContext | AuthContext
36
37
  Specialized subclass of AppContext for the given instance type
37
38
 
38
39
  Raises
@@ -53,7 +54,7 @@ def select_context_class(
53
54
 
54
55
 
55
56
  def get_context(
56
- type_: InstanceType, name: str, system_folders: bool
57
+ type_: InstanceType, name: str, system_folders: bool, is_sandbox: bool = False
57
58
  ) -> ServerContext | NodeContext | AlgorithmStoreContext:
58
59
  """
59
60
  Load the server context from the configuration file.
@@ -66,14 +67,18 @@ def get_context(
66
67
  Name of the instance
67
68
  system_folders : bool
68
69
  Wether to use system folders or if False, the user folders
70
+ is_sandbox : bool
71
+ Whether the configuration is a sandbox configuration, by default False
69
72
 
70
73
  Returns
71
74
  -------
72
75
  AppContext
73
76
  Specialized subclass context of AppContext for the given instance type
74
77
  """
78
+ name, is_sandbox = extract_name_and_is_sandbox(name, is_sandbox)
79
+
75
80
  ctx_class = select_context_class(type_)
76
- if not ctx_class.config_exists(name, system_folders):
81
+ if not ctx_class.config_exists(name, system_folders, is_sandbox=is_sandbox):
77
82
  scope = "system" if system_folders else "user"
78
83
  error(
79
84
  f"Configuration {Fore.RED}{name}{Style.RESET_ALL} does not "
@@ -86,6 +91,6 @@ def get_context(
86
91
  ctx_class.LOGGING_ENABLED = False
87
92
 
88
93
  # create server context, and initialize db
89
- ctx = ctx_class(name, system_folders=system_folders)
94
+ ctx = ctx_class(name, system_folders=system_folders, is_sandbox=is_sandbox)
90
95
 
91
96
  return ctx
@@ -26,11 +26,14 @@ class AlgorithmStoreContext(BaseServerContext):
26
26
 
27
27
  INST_CONFIG_MANAGER = AlgorithmStoreConfigurationManager
28
28
 
29
- def __init__(self, instance_name: str, system_folders: bool = S_FOL):
29
+ def __init__(
30
+ self, instance_name: str, system_folders: bool = S_FOL, is_sandbox: bool = False
31
+ ):
30
32
  super().__init__(
31
33
  InstanceType.ALGORITHM_STORE,
32
34
  instance_name,
33
35
  system_folders=system_folders,
36
+ is_sandbox=is_sandbox,
34
37
  )
35
38
  self.log.info("vantage6 version '%s'", __version__)
36
39
 
@@ -88,7 +91,9 @@ class AlgorithmStoreContext(BaseServerContext):
88
91
  )
89
92
 
90
93
  @classmethod
91
- def config_exists(cls, instance_name: str, system_folders: bool = S_FOL) -> bool:
94
+ def config_exists(
95
+ cls, instance_name: str, system_folders: bool = S_FOL, is_sandbox: bool = False
96
+ ) -> bool:
92
97
  """
93
98
  Check if a configuration file exists.
94
99
 
@@ -99,19 +104,20 @@ class AlgorithmStoreContext(BaseServerContext):
99
104
  of the configuration file.
100
105
  system_folders : bool, optional
101
106
  System wide or user configuration, by default S_FOL
102
-
107
+ is_sandbox : bool, optional
108
+ Whether the configuration is a sandbox configuration, by default False
103
109
  Returns
104
110
  -------
105
111
  bool
106
112
  Whether the configuration file exists or not
107
113
  """
108
- return super().config_exists(
109
- InstanceType.ALGORITHM_STORE, instance_name, system_folders
114
+ return super().base_config_exists(
115
+ InstanceType.ALGORITHM_STORE, instance_name, system_folders, is_sandbox
110
116
  )
111
117
 
112
118
  @classmethod
113
119
  def available_configurations(
114
- cls, system_folders: bool = S_FOL
120
+ cls, system_folders: bool = S_FOL, is_sandbox: bool = False
115
121
  ) -> tuple[list, list]:
116
122
  """
117
123
  Find all available server configurations in the default folders.
@@ -128,5 +134,5 @@ class AlgorithmStoreContext(BaseServerContext):
128
134
  list contains invalid configuration files.
129
135
  """
130
136
  return super().available_configurations(
131
- InstanceType.ALGORITHM_STORE, system_folders
137
+ InstanceType.ALGORITHM_STORE, system_folders, is_sandbox
132
138
  )
@@ -19,6 +19,8 @@ class AuthContext(AppContext):
19
19
  of the configuration file.
20
20
  system_folders : bool, optional
21
21
  System wide or user configuration, by default S_FOL
22
+ is_sandbox : bool, optional
23
+ Whether the configuration is a sandbox configuration, by default False
22
24
  """
23
25
 
24
26
  # The auth configuration manager is aware of the structure of the auth
@@ -29,11 +31,13 @@ class AuthContext(AppContext):
29
31
  self,
30
32
  instance_name: str,
31
33
  system_folders: bool = S_FOL,
34
+ is_sandbox: bool = False,
32
35
  ):
33
36
  super().__init__(
34
37
  InstanceType.AUTH,
35
38
  instance_name,
36
39
  system_folders=system_folders,
40
+ is_sandbox=is_sandbox,
37
41
  )
38
42
  self.log.info("vantage6 version '%s'", __version__)
39
43
 
@@ -65,7 +69,12 @@ class AuthContext(AppContext):
65
69
  )
66
70
 
67
71
  @classmethod
68
- def config_exists(cls, instance_name: str, system_folders: bool = S_FOL) -> bool:
72
+ def config_exists(
73
+ cls,
74
+ instance_name: str,
75
+ system_folders: bool = S_FOL,
76
+ is_sandbox: bool = False,
77
+ ) -> bool:
69
78
  """
70
79
  Check if a configuration file exists.
71
80
 
@@ -76,19 +85,24 @@ class AuthContext(AppContext):
76
85
  of the configuration file.
77
86
  system_folders : bool, optional
78
87
  System wide or user configuration, by default S_FOL
88
+ is_sandbox : bool, optional
89
+ Whether the configuration is a sandbox configuration, by default False
79
90
 
80
91
  Returns
81
92
  -------
82
93
  bool
83
94
  Whether the configuration file exists or not
84
95
  """
85
- return super().config_exists(
86
- InstanceType.AUTH, instance_name, system_folders=system_folders
96
+ return super().base_config_exists(
97
+ InstanceType.AUTH,
98
+ instance_name,
99
+ system_folders=system_folders,
100
+ is_sandbox=is_sandbox,
87
101
  )
88
102
 
89
103
  @classmethod
90
104
  def available_configurations(
91
- cls, system_folders: bool = S_FOL
105
+ cls, system_folders: bool = S_FOL, is_sandbox: bool = False
92
106
  ) -> tuple[list, list]:
93
107
  """
94
108
  Find all available auth configurations in the default folders.
@@ -97,6 +111,8 @@ class AuthContext(AppContext):
97
111
  ----------
98
112
  system_folders : bool, optional
99
113
  System wide or user configuration, by default S_FOL
114
+ is_sandbox : bool, optional
115
+ Whether the configuration is a sandbox configuration, by default False
100
116
 
101
117
  Returns
102
118
  -------
@@ -104,4 +120,6 @@ class AuthContext(AppContext):
104
120
  The first list contains validated configuration files, the second
105
121
  list contains invalid configuration files.
106
122
  """
107
- return super().available_configurations(InstanceType.AUTH, system_folders)
123
+ return super().available_configurations(
124
+ InstanceType.AUTH, system_folders, is_sandbox
125
+ )
@@ -27,6 +27,8 @@ class NodeContext(AppContext):
27
27
  _description_, by default None
28
28
  in_container : bool, optional
29
29
  Whether the application is running inside a container, by default False
30
+ is_sandbox : bool, optional
31
+ Whether the configuration is a sandbox configuration, by default False
30
32
  """
31
33
 
32
34
  # The server configuration manager is aware of the structure of the server
@@ -41,6 +43,7 @@ class NodeContext(AppContext):
41
43
  print_log_header: bool = True,
42
44
  logger_prefix: str = "",
43
45
  in_container: bool = False,
46
+ is_sandbox: bool = False,
44
47
  ):
45
48
  super().__init__(
46
49
  InstanceType.NODE,
@@ -50,6 +53,7 @@ class NodeContext(AppContext):
50
53
  print_log_header=print_log_header,
51
54
  logger_prefix=logger_prefix,
52
55
  in_container=in_container,
56
+ is_sandbox=is_sandbox,
53
57
  )
54
58
  if print_log_header:
55
59
  self.log.info("vantage6 version '%s'", __version__)
@@ -57,7 +61,7 @@ class NodeContext(AppContext):
57
61
 
58
62
  @classmethod
59
63
  def from_external_config_file(
60
- cls, path: str, system_folders: bool = N_FOL
64
+ cls, path: str, system_folders: bool = N_FOL, is_sandbox: bool = False
61
65
  ) -> NodeContext:
62
66
  """
63
67
  Create a node context from an external configuration file. External
@@ -77,11 +81,16 @@ class NodeContext(AppContext):
77
81
  Node context object
78
82
  """
79
83
  return super().from_external_config_file(
80
- Path(path).resolve(), InstanceType.NODE, system_folders
84
+ Path(path).resolve(),
85
+ InstanceType.NODE,
86
+ system_folders,
87
+ is_sandbox=is_sandbox,
81
88
  )
82
89
 
83
90
  @classmethod
84
- def config_exists(cls, instance_name: str, system_folders: bool = N_FOL) -> bool:
91
+ def config_exists(
92
+ cls, instance_name: str, system_folders: bool = N_FOL, is_sandbox: bool = False
93
+ ) -> bool:
85
94
  """
86
95
  Check if a configuration file exists.
87
96
 
@@ -92,19 +101,23 @@ class NodeContext(AppContext):
92
101
  of the configuration file.
93
102
  system_folders : bool, optional
94
103
  System wide or user configuration, by default N_FOL
95
-
104
+ is_sandbox : bool, optional
105
+ Whether the configuration is a sandbox configuration, by default False
96
106
  Returns
97
107
  -------
98
108
  bool
99
109
  Whether the configuration file exists or not
100
110
  """
101
- return super().config_exists(
102
- InstanceType.NODE, instance_name, system_folders=system_folders
111
+ return super().base_config_exists(
112
+ InstanceType.NODE,
113
+ instance_name,
114
+ system_folders=system_folders,
115
+ is_sandbox=is_sandbox,
103
116
  )
104
117
 
105
118
  @classmethod
106
119
  def available_configurations(
107
- cls, system_folders: bool = N_FOL
120
+ cls, system_folders: bool = N_FOL, is_sandbox: bool = False
108
121
  ) -> tuple[list, list]:
109
122
  """
110
123
  Find all available server configurations in the default folders.
@@ -113,6 +126,8 @@ class NodeContext(AppContext):
113
126
  ----------
114
127
  system_folders : bool, optional
115
128
  System wide or user configuration, by default N_FOL
129
+ is_sandbox : bool, optional
130
+ Whether the configuration is a sandbox configuration, by default False
116
131
 
117
132
  Returns
118
133
  -------
@@ -120,7 +135,9 @@ class NodeContext(AppContext):
120
135
  The first list contains validated configuration files, the second
121
136
  list contains invalid configuration files.
122
137
  """
123
- return super().available_configurations(InstanceType.NODE, system_folders)
138
+ return super().available_configurations(
139
+ InstanceType.NODE, system_folders, is_sandbox
140
+ )
124
141
 
125
142
  @staticmethod
126
143
  def type_data_folder(system_folders: bool = N_FOL) -> Path: