vantage6 5.0.0a41__py3-none-any.whl → 5.0.0a43__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.

@@ -44,7 +44,7 @@ def get_configuration_list(instance_type: InstanceType) -> None:
44
44
  in running_server_names
45
45
  else stopped
46
46
  )
47
- click.echo(f"{config.name:25}{status:25} System ")
47
+ click.echo(f"{config.name:25}{status:25}System ")
48
48
 
49
49
  # user folders
50
50
  configs, failed_imports_user = ctx_class.available_configurations(
@@ -58,9 +58,9 @@ def get_configuration_list(instance_type: InstanceType) -> None:
58
58
  in running_server_names
59
59
  else stopped
60
60
  )
61
- click.echo(f"{config.name:25}{status:25} User ")
61
+ click.echo(f"{config.name:25}{status:25}User ")
62
62
 
63
- click.echo("-" * 85)
63
+ click.echo("-" * len(header))
64
64
  if len(failed_imports_system) + len(failed_imports_user):
65
65
  warning(
66
66
  f"{Fore.RED}Failed imports: "
@@ -6,8 +6,10 @@ from colorama import Fore, Style
6
6
  from vantage6.common import ensure_config_dir_writable, error, info
7
7
  from vantage6.common.globals import InstanceType
8
8
 
9
- from vantage6.cli.common.utils import get_main_cli_command_name
10
- from vantage6.cli.config import CliConfig
9
+ from vantage6.cli.common.utils import (
10
+ get_main_cli_command_name,
11
+ select_context_and_namespace,
12
+ )
11
13
  from vantage6.cli.configuration_create import make_configuration
12
14
  from vantage6.cli.context import select_context_class
13
15
  from vantage6.cli.utils import check_config_name_allowed, prompt_config_name
@@ -50,11 +52,7 @@ def new(
50
52
  Path | None
51
53
  Path to the configuration file. None if the process is aborted for any reason.
52
54
  """
53
- cli_config = CliConfig()
54
- context, namespace = cli_config.compare_changes_config(
55
- context=context,
56
- namespace=namespace,
57
- )
55
+ context, namespace = select_context_and_namespace(context, namespace)
58
56
 
59
57
  name = prompt_config_name(name)
60
58
 
@@ -6,19 +6,10 @@ import time
6
6
  from os import PathLike
7
7
  from pathlib import Path
8
8
 
9
- import docker
10
- from docker.client import DockerClient
11
-
12
- from vantage6.common import error, info, warning
9
+ from vantage6.common import error, info
13
10
  from vantage6.common.context import AppContext
14
- from vantage6.common.docker.addons import pull_image
15
11
  from vantage6.common.globals import (
16
- DEFAULT_ALGO_STORE_IMAGE,
17
12
  DEFAULT_CHART_REPO,
18
- DEFAULT_DOCKER_REGISTRY,
19
- DEFAULT_NODE_IMAGE,
20
- DEFAULT_SERVER_IMAGE,
21
- DEFAULT_UI_IMAGE,
22
13
  LOCALHOST,
23
14
  InstanceType,
24
15
  )
@@ -38,95 +29,13 @@ def prestart_checks(
38
29
  Run pre-start checks for an instance.
39
30
  """
40
31
 
41
- check_config_name_allowed(ctx.name)
32
+ check_config_name_allowed(name)
42
33
 
43
34
  if check_running(ctx.helm_release_name, instance_type, name, system_folders):
44
35
  error(f"Instance '{name}' is already running.")
45
36
  exit(1)
46
37
 
47
38
 
48
- def pull_infra_image(
49
- client: DockerClient, image: str, instance_type: InstanceType
50
- ) -> None:
51
- """
52
- Try to pull an infrastructure image. If the image is a default infrastructure image,
53
- exit if in cannot be pulled. If it is not a default image, exit if it cannot be
54
- pulled and it is also not available locally. If a local image is available, a
55
- warning is printed.
56
-
57
- Parameters
58
- ----------
59
- client : DockerClient
60
- The Docker client
61
- image : str
62
- The image name to pull
63
- instance_type : InstanceType
64
- The type of instance to pull the image for
65
- """
66
- try:
67
- pull_image(client, image, suppress_error=True)
68
- except docker.errors.APIError:
69
- if not _is_default_infra_image(image, instance_type):
70
- if _image_exists_locally(client, image):
71
- warning("Failed to pull infrastructure image! Will use local image...")
72
- else:
73
- error("Failed to pull infrastructure image!")
74
- error("Image also not found locally. Exiting...")
75
- exit(1)
76
- else:
77
- error("Failed to pull infrastructure image! Exiting...")
78
- exit(1)
79
-
80
-
81
- def _is_default_infra_image(image: str, instance_type: InstanceType) -> bool:
82
- """
83
- Check if an infrastructure image is the default image.
84
-
85
- Parameters
86
- ----------
87
- image : str
88
- The image name to check
89
- instance_type : InstanceType
90
- The type of instance to check the image for
91
-
92
- Returns
93
- -------
94
- bool
95
- True if the image is the default image, False otherwise
96
- """
97
- if instance_type == InstanceType.SERVER:
98
- return image == f"{DEFAULT_DOCKER_REGISTRY}/{DEFAULT_SERVER_IMAGE}"
99
- elif instance_type == InstanceType.ALGORITHM_STORE:
100
- return image == f"{DEFAULT_DOCKER_REGISTRY}/{DEFAULT_ALGO_STORE_IMAGE}"
101
- elif instance_type == InstanceType.UI:
102
- return image == f"{DEFAULT_DOCKER_REGISTRY}/{DEFAULT_UI_IMAGE}"
103
- elif instance_type == InstanceType.NODE:
104
- return image == f"{DEFAULT_DOCKER_REGISTRY}/{DEFAULT_NODE_IMAGE}"
105
-
106
-
107
- def _image_exists_locally(client: DockerClient, image: str) -> bool:
108
- """
109
- Check if the image exists locally.
110
-
111
- Parameters
112
- ----------
113
- client : DockerClient
114
- The Docker client
115
- image : str
116
- The image name to check
117
-
118
- Returns
119
- -------
120
- bool
121
- True if the image exists locally, False otherwise
122
- """
123
- try:
124
- client.images.get(image)
125
- except docker.errors.ImageNotFound:
126
- return False
127
- return True
128
-
129
-
130
39
  def helm_install(
131
40
  release_name: str,
132
41
  chart_name: ChartName,
@@ -134,6 +43,7 @@ def helm_install(
134
43
  context: str | None = None,
135
44
  namespace: str | None = None,
136
45
  local_chart_dir: str | None = None,
46
+ custom_values: list[str] | None = None,
137
47
  ) -> None:
138
48
  """
139
49
  Manage the `helm install` command.
@@ -152,6 +62,9 @@ def helm_install(
152
62
  The Kubernetes namespace to use.
153
63
  local_chart_dir : str, optional
154
64
  The local directory containing the Helm charts.
65
+ custom_values : list[str], optional
66
+ Custom values to pass to the Helm chart, that override the values in the values
67
+ file. Each item in the list is a string in the format "key=value".
155
68
  """
156
69
  # Input validation
157
70
  validate_input_cmd_args(release_name, "release name")
@@ -197,6 +110,10 @@ def helm_install(
197
110
  if namespace:
198
111
  command.extend(["--namespace", namespace])
199
112
 
113
+ if custom_values:
114
+ for custom_value in custom_values:
115
+ command.extend(["--set", custom_value])
116
+
200
117
  try:
201
118
  subprocess.run(
202
119
  command,
@@ -1,16 +1,13 @@
1
1
  import json
2
2
  import subprocess
3
3
  from pathlib import Path
4
- from typing import Iterable
5
4
 
6
- import docker
7
5
  import questionary as q
8
6
 
9
7
  from vantage6.common import error
10
8
  from vantage6.common.globals import (
11
9
  APPNAME,
12
10
  SANDBOX_SUFFIX,
13
- STRING_ENCODING,
14
11
  InstanceType,
15
12
  )
16
13
 
@@ -187,110 +184,6 @@ def select_running_service(
187
184
  return name
188
185
 
189
186
 
190
- def get_server_name(
191
- name: str,
192
- system_folders: bool,
193
- running_server_names: list[str],
194
- instance_type: InstanceType,
195
- ) -> str:
196
- """
197
- Get the full name of a running server.
198
-
199
- Parameters
200
- ----------
201
- name : str
202
- Name of the server to get the full name from
203
- system_folders : bool
204
- Whether to use system folders or not
205
- running_server_names : list[str]
206
- The names of the running servers
207
- instance_type : InstanceType
208
- The type of instance to get the full name from
209
- """
210
-
211
- if not name:
212
- if not running_server_names:
213
- error(
214
- f"No {instance_type.value}s are running! You can only check the version"
215
- f" for {instance_type.value}s that are running"
216
- )
217
- exit(1)
218
- try:
219
- name = q.select(
220
- f"Select the {instance_type.value} you wish to inspect:",
221
- choices=running_server_names,
222
- ).unsafe_ask()
223
- except KeyboardInterrupt:
224
- error("Aborted by user!")
225
- exit(1)
226
- else:
227
- post_fix = "system" if system_folders else "user"
228
- name = f"{APPNAME}-{name}-{post_fix}"
229
- return name
230
-
231
-
232
- def get_running_servers(
233
- client: docker.DockerClient, instance_type: InstanceType
234
- ) -> list[str]:
235
- """Get the running servers of a certain type.
236
-
237
- Parameters
238
- ----------
239
- client : docker.DockerClient
240
- The docker client to use
241
- instance_type : InstanceType
242
- The type of instance to get the running servers from
243
-
244
- Returns
245
- -------
246
- list[str]
247
- The names of the running servers
248
- """
249
- running_servers = client.containers.list(
250
- filters={"label": f"{APPNAME}-type={instance_type.value}"}
251
- )
252
- return [server.name for server in running_servers]
253
-
254
-
255
- def print_log_worker(logs_stream: Iterable[bytes]) -> None:
256
- """
257
- Print the logs from the logs stream.
258
-
259
- Parameters
260
- ----------
261
- logs_stream : Iterable[bytes]
262
- Output of the container.attach() method
263
- """
264
- for log in logs_stream:
265
- try:
266
- print(log.decode(STRING_ENCODING), end="")
267
- except UnicodeDecodeError:
268
- print(
269
- "ERROR DECODING LOGS!!! Printing raw bytes. Please check the logs in "
270
- "the container."
271
- )
272
- print(log)
273
-
274
-
275
- def get_name_from_container_name(container_name: str) -> str:
276
- """
277
- Get the node/server/store name from a container name.
278
-
279
- Parameters
280
- ----------
281
- container_name : str
282
- The name of the container
283
-
284
- Returns
285
- -------
286
- str
287
- The name of the node/server/store
288
- """
289
- # Container name is structured as: f"{APPNAME}-{name}-{post_fix}"
290
- # Take into account that name can contain '-'
291
- return "-".join(container_name.split("-")[1:-1])
292
-
293
-
294
187
  def get_config_name_from_service_name(service_name: str) -> str:
295
188
  """
296
189
  Get the config name from a service name.
@@ -207,6 +207,7 @@ def select_configuration_questionnaire(
207
207
  Whether to use the system folders or not
208
208
  is_sandbox : bool
209
209
  Whether to show only the sandbox configurations or not
210
+
210
211
  Returns
211
212
  -------
212
213
  str
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- from vantage6.common.globals import APPNAME, InstanceType
3
+ from vantage6.common.globals import InstanceType
4
4
 
5
5
  from vantage6.cli import __version__
6
6
  from vantage6.cli.configuration_manager import AlgorithmStoreConfigurationManager
@@ -48,18 +48,6 @@ class AlgorithmStoreContext(BaseServerContext):
48
48
  """
49
49
  return super().get_database_uri()
50
50
 
51
- @property
52
- def docker_container_name(self) -> str:
53
- """
54
- Name of the docker container that the server is running in.
55
-
56
- Returns
57
- -------
58
- str
59
- Server's docker container name
60
- """
61
- return f"{APPNAME}-{self.name}-{self.scope}-{ServerType.ALGORITHM_STORE}"
62
-
63
51
  @classmethod
64
52
  def from_external_config_file(
65
53
  cls, path: str, system_folders: bool = S_FOL, in_container: bool = False
@@ -5,7 +5,7 @@ import os.path
5
5
  from pathlib import Path
6
6
 
7
7
  from vantage6.common.context import AppContext
8
- from vantage6.common.globals import APPNAME, STRING_ENCODING, InstanceType
8
+ from vantage6.common.globals import STRING_ENCODING, InstanceType
9
9
 
10
10
  from vantage6.cli import __version__
11
11
  from vantage6.cli.configuration_manager import NodeConfigurationManager
@@ -172,43 +172,6 @@ class NodeContext(AppContext):
172
172
  else:
173
173
  return self.config["node"]["databases"]
174
174
 
175
- @property
176
- def docker_container_name(self) -> str:
177
- """
178
- Docker container name of the node.
179
-
180
- Returns
181
- -------
182
- str
183
- Node's Docker container name
184
- """
185
- return f"{APPNAME}-{self.name}-{self.scope}"
186
-
187
- @property
188
- def docker_network_name(self) -> str:
189
- """
190
- Private Docker network name which is unique for this node.
191
-
192
- Returns
193
- -------
194
- str
195
- Docker network name
196
- """
197
- return f"{APPNAME}-{self.name}-{self.scope}-net"
198
-
199
- @property
200
- def docker_volume_name(self) -> str:
201
- """
202
- Docker volume in which task data is stored. In case a file based
203
- database is used, this volume contains the database file as well.
204
-
205
- Returns
206
- -------
207
- str
208
- Docker volume name
209
- """
210
- return os.environ.get("DATA_VOLUME_NAME", f"{self.docker_container_name}-vol")
211
-
212
175
  @property
213
176
  def proxy_log_file(self):
214
177
  return self.log_file_name(type_="proxy_server")
@@ -58,22 +58,10 @@ class ServerContext(BaseServerContext):
58
58
  """
59
59
  return super().get_database_uri()
60
60
 
61
- @property
62
- def docker_container_name(self) -> str:
63
- """
64
- Name of the docker container that the server is running in.
65
-
66
- Returns
67
- -------
68
- str
69
- Server's docker container name
70
- """
71
- return f"{APPNAME}-{self.name}-{self.scope}-{ServerType.V6SERVER.value}"
72
-
73
61
  @property
74
62
  def prometheus_container_name(self) -> str:
75
63
  """
76
- Get the name of the Prometheus Docker container for this server.
64
+ Get the name of the Prometheus pod for this server.
77
65
 
78
66
  Returns
79
67
  -------
@@ -28,7 +28,7 @@ def cli_node_attach(
28
28
  """
29
29
  info("Attaching to node logs...")
30
30
  attach_logs(
31
- name,
31
+ name=name,
32
32
  instance_type=InstanceType.NODE,
33
33
  infra_component=InfraComponentName.NODE,
34
34
  system_folders=system_folders,
@@ -4,12 +4,10 @@ Common functions that are used in node CLI commands
4
4
 
5
5
  import os
6
6
 
7
- import docker
8
7
  from colorama import Fore, Style
9
8
 
10
9
  from vantage6.common import debug, error, info
11
10
  from vantage6.common.globals import (
12
- APPNAME,
13
11
  HTTP_LOCALHOST,
14
12
  InstanceType,
15
13
  Ports,
@@ -48,7 +46,7 @@ def create_client(ctx: NodeContext) -> UserClient:
48
46
  host = ctx.config["node"]["server"]["url"]
49
47
  port = ctx.config["node"]["server"]["port"]
50
48
  api_path = ctx.config["node"]["server"]["path"]
51
- # if the server is run locally, we need to use localhost here instead of
49
+ # if the server is run locally in Docker, we need to use localhost here instead of
52
50
  # the host address of docker
53
51
  if host in ["http://host.docker.internal", "http://172.17.0.1"]:
54
52
  host = HTTP_LOCALHOST
@@ -133,23 +131,3 @@ def select_node(name: str, system_folders: bool) -> str:
133
131
  )
134
132
  exit(1)
135
133
  return name
136
-
137
-
138
- def find_running_node_names(client: docker.DockerClient) -> list[str]:
139
- """
140
- Returns a list of names of running nodes.
141
-
142
- Parameters
143
- ----------
144
- client : docker.DockerClient
145
- Docker client instance
146
-
147
- Returns
148
- -------
149
- list[str]
150
- List of names of running nodes
151
- """
152
- running_nodes = client.containers.list(
153
- filters={"label": f"{APPNAME}-type={InstanceType.NODE.value}"}
154
- )
155
- return [node.name for node in running_nodes]
@@ -18,12 +18,12 @@ def cli_node_files(ctx: NodeContext) -> None:
18
18
  """
19
19
  info(f"Configuration file = {ctx.config_file}")
20
20
  info(f"Log file = {ctx.log_file}")
21
- info(f"data folders = {ctx.data_dir}")
21
+ info(f"Data folders = {ctx.data_dir}")
22
22
  info("Database labels and files")
23
- for db in ctx.databases["fileBased"] or []:
23
+ for db in ctx.databases.get("fileBased", []):
24
24
  info(
25
25
  f" - {db['name']:15} = {db['volumePath']}/{db['originalName']} "
26
26
  f"(type: {db['type']})"
27
27
  )
28
- for db in ctx.databases["serviceBased"] or []:
28
+ for db in ctx.databases.get("serviceBased", []):
29
29
  info(f" - {db['name']:15} = {db['uri']} (type: {db['type']})")
vantage6/cli/node/new.py CHANGED
@@ -128,7 +128,6 @@ def node_configuration_questionaire(data_dir: str, instance_name: str) -> dict:
128
128
  },
129
129
  ]
130
130
  )
131
-
132
131
  config["databases"] = {"fileBased": [], "serviceBased": []}
133
132
  while q.confirm("Do you want to add a database?").unsafe_ask():
134
133
  db_label = q.select(
@@ -195,8 +194,6 @@ def node_configuration_questionaire(data_dir: str, instance_name: str) -> dict:
195
194
  {"name": "urllib3", "level": "warning"},
196
195
  {"name": "requests", "level": "warning"},
197
196
  {"name": "engineio.client", "level": "warning"},
198
- {"name": "docker.utils.config", "level": "warning"},
199
- {"name": "docker.auth", "level": "warning"},
200
197
  ],
201
198
  }
202
199
 
@@ -24,7 +24,7 @@ def cli_node_remove(
24
24
  """
25
25
  Delete a node permanently.
26
26
 
27
- Remove the configuration file, log file, and docker volumes attached to
27
+ Remove the configuration file, log file, and kubernetes resources attached to
28
28
  the node.
29
29
  """
30
30
 
@@ -1,8 +1,14 @@
1
1
  import click
2
2
 
3
- from vantage6.common import info
4
- from vantage6.common.globals import InstanceType
3
+ from vantage6.common import info, warning
4
+ from vantage6.common.globals import (
5
+ DEFAULT_DOCKER_REGISTRY,
6
+ DEFAULT_NODE_IMAGE,
7
+ DEFAULT_NODE_IMAGE_WO_TAG,
8
+ InstanceType,
9
+ )
5
10
 
11
+ from vantage6.cli import __version__
6
12
  from vantage6.cli.common.attach import attach_logs
7
13
  from vantage6.cli.common.decorator import click_insert_context
8
14
  from vantage6.cli.common.start import (
@@ -16,6 +22,7 @@ from vantage6.cli.common.utils import (
16
22
  )
17
23
  from vantage6.cli.context.node import NodeContext
18
24
  from vantage6.cli.globals import ChartName, InfraComponentName
25
+ from vantage6.cli.node.common import create_client
19
26
 
20
27
  from vantage6.node.globals import DEFAULT_PROXY_SERVER_PORT
21
28
 
@@ -60,49 +67,37 @@ def cli_node_start(
60
67
  create_directory_if_not_exists(ctx.log_dir)
61
68
  create_directory_if_not_exists(ctx.data_dir)
62
69
 
63
- # TODO issue #2256 - run same version node as server
64
- # # Determine image-name. First we check if the option --image has been used.
65
- # # Then we check if the image has been specified in the config file, and
66
- # # finally we use the default settings from the package.
67
- # if not image:
68
- # custom_images: dict = ctx.config.get("images")
69
- # if custom_images:
70
- # image = custom_images.get("node")
71
- # else:
72
- # # if no custom image is specified, find the server version and use
73
- # # the latest images from that minor version
74
- # client = create_client(ctx)
75
- # major_minor = None
76
- # try:
77
- # # try to get server version, skip if can't get a connection
78
- # version = client.util.get_server_version(attempts_on_timeout=3)[
79
- # "version"
80
- # ]
81
- # major_minor = ".".join(version.split(".")[:2])
82
- # image = (
83
- # f"{DEFAULT_DOCKER_REGISTRY}/"
84
- # f"{DEFAULT_NODE_IMAGE_WO_TAG}"
85
- # f":{major_minor}"
86
- # )
87
- # except Exception:
88
- # warning("Could not determine server version. Using default node image")
89
-
90
- # if major_minor and not __version__.startswith(major_minor):
91
- # warning(
92
- # "Version mismatch between CLI and server/node. CLI is "
93
- # f"running on version {__version__}, while node and server "
94
- # f"are on version {major_minor}. This might cause "
95
- # f"unexpected issues; changing to {major_minor}.<latest> "
96
- # "is recommended."
97
- # )
70
+ # Determine image-name. First we check if the image is set in the config file.
71
+ # If so, we use it. Otherwise, we use the same version as the server.
72
+ if custom_image := ctx.config.get("node", {}).get("image"):
73
+ image = custom_image
74
+ else:
75
+ # if no custom image is specified, find the server version and use
76
+ # the latest images from that minor version
77
+ client = create_client(ctx)
78
+ major_minor = None
79
+ try:
80
+ # try to get server version, skip if can't get a connection
81
+ version = client.util.get_server_version(attempts_on_timeout=3)["version"]
82
+ major_minor = ".".join(version.split(".")[:2])
83
+ image = (
84
+ f"{DEFAULT_DOCKER_REGISTRY}/{DEFAULT_NODE_IMAGE_WO_TAG}:{major_minor}"
85
+ )
86
+ except Exception:
87
+ warning("Could not determine server version. Using default node image")
98
88
 
99
- # # fail safe, in case no custom image is specified and we can't get the
100
- # # server version
101
- # if not image:
102
- # image = f"{DEFAULT_DOCKER_REGISTRY}/{DEFAULT_NODE_IMAGE}"
89
+ if major_minor and not __version__.startswith(major_minor):
90
+ warning(
91
+ "Version mismatch between CLI and server/node. CLI is running on "
92
+ f"version {__version__}, while node and server are on version "
93
+ f"{major_minor}. This might cause unexpected issues; changing to "
94
+ f"{major_minor}.<latest> is recommended."
95
+ )
103
96
 
104
- # info(f"Pulling latest node image '{image}'")
105
- # pull_infra_image(docker_client, image, InstanceType.NODE)
97
+ # fail safe, in case no custom image is specified and we can't get the
98
+ # server version
99
+ if not image:
100
+ image = f"{DEFAULT_DOCKER_REGISTRY}/{DEFAULT_NODE_IMAGE}"
106
101
 
107
102
  helm_install(
108
103
  release_name=ctx.helm_release_name,
@@ -111,6 +106,7 @@ def cli_node_start(
111
106
  context=context,
112
107
  namespace=namespace,
113
108
  local_chart_dir=local_chart_dir,
109
+ custom_values=[f"node.image={image}"],
114
110
  )
115
111
 
116
112
  # start port forward for the node proxy server
@@ -259,11 +259,6 @@ class NodeSandboxConfigManager(BaseSandboxConfigManager):
259
259
  "proxyPort": 7676 + int(node_specific_config["org_id"]),
260
260
  "apiKey": node_specific_config["api_key"],
261
261
  "name": node_specific_config["node_name"],
262
- "image": (
263
- self.node_image
264
- # TODO v5+ update
265
- or "harbor2.vantage6.ai/infrastructure/node:5.0.0a37"
266
- ),
267
262
  "logging": {
268
263
  "level": "DEBUG",
269
264
  "file": f"{node_specific_config['node_name']}.log",
@@ -303,6 +298,8 @@ class NodeSandboxConfigManager(BaseSandboxConfigManager):
303
298
  },
304
299
  },
305
300
  }
301
+ if self.node_image:
302
+ config["node"]["image"] = self.node_image
306
303
 
307
304
  # merge the extra config with the node config
308
305
  if extra_config is not None:
@@ -152,4 +152,11 @@ def cli_sandbox_remove(
152
152
  click_ctx.invoke(
153
153
  cli_server_remove, ctx=ctx, name=name, system_folders=False, force=True
154
154
  )
155
- # TODO remove the right data in the custom data directory if it is provided
155
+
156
+ # remove the right data in the custom data directory if it is provided. If a custom
157
+ # data directory is provided, all files related to the sandbox have been stored in
158
+ # a subfolder with the name of the sandbox.
159
+ if custom_data_dir:
160
+ sandbox_data_dir = custom_data_dir / ctx.name
161
+ if sandbox_data_dir.is_dir():
162
+ rmtree(sandbox_data_dir)
@@ -28,7 +28,7 @@ def cli_server_attach(
28
28
  """
29
29
  info("Attaching to server logs...")
30
30
  attach_logs(
31
- name,
31
+ name=name,
32
32
  instance_type=InstanceType.SERVER,
33
33
  infra_component=InfraComponentName.SERVER,
34
34
  system_folders=system_folders,
@@ -29,7 +29,15 @@ node:
29
29
  {% endif %}
30
30
 
31
31
 
32
- image: {{ node.image | default('harbor2.vantage6.ai/infrastructure/node:latest') }}
32
+ {% if node.image is defined %}
33
+ # Fixed image to use to run the node. Note that if specified, the node will not
34
+ # automatically run the version matching the server version.
35
+ image: {{ node.image }}
36
+ {% else %}
37
+ # You may specify a fixed image to use to run the node. Note that if specified, the
38
+ # node will not automatically run the version matching the server version.
39
+ # image: harbor2.vantage6.ai/infrastructure/node:latest
40
+ {% endif %}
33
41
 
34
42
  # Namespace in which the task kubernetes resources are created. This must be a
35
43
  # namespace where the node has access to create pods.
@@ -319,6 +327,21 @@ node:
319
327
  # report_interval_seconds: 45
320
328
  {% endif %}
321
329
 
330
+ # Provide additional environment variables to the algorithm containers. This can be
331
+ # useful for instance to provide threshold values, database credentials, etc.
332
+ # Note that variable names should consist of only letters, numbers and underscores,
333
+ # and start with a letter.
334
+ {% if node.algorithm_env is defined %}
335
+ algorithm_env:
336
+ {% for key, value in node.algorithm_env.items() %}
337
+ {{ key }}: {{ value }}
338
+ {% endfor %}
339
+ {% endif %}
340
+ {% else %}
341
+ # algorithm_env:
342
+ # threshold_example: 10
343
+ {% endif %}
344
+
322
345
  {% if node.debug is defined %}
323
346
  # Debug settings
324
347
  debug:
@@ -17,10 +17,6 @@ logging:
17
17
  name: requests
18
18
  - level: warning
19
19
  name: engineio.client
20
- - level: warning
21
- name: docker.utils.config
22
- - level: warning
23
- name: docker.auth
24
20
  - level: warning
25
21
  name: kubernetes.client.rest
26
22
  node_proxy_port: {{ node_proxy_port }}
@@ -115,8 +115,8 @@
115
115
  # click_ctx.invoke(remove_demo_network, name=name)
116
116
  # else:
117
117
  # info(
118
- # f"Keeping the demo network {name}. You can start it with `v6 dev "
119
- # "start-demo-network`"
118
+ # f"Keeping the demo network {name}. You can start it with `v6 sandbox "
119
+ # "start`"
120
120
  # )
121
121
 
122
122
  # return diagnose_results
vantage6/cli/utils.py CHANGED
@@ -9,7 +9,6 @@ import re
9
9
  import subprocess
10
10
  from pathlib import Path
11
11
 
12
- import docker
13
12
  import questionary as q
14
13
 
15
14
  from vantage6.common import error, info, warning
@@ -63,22 +62,6 @@ def check_config_name_allowed(name: str) -> None:
63
62
  exit(1)
64
63
 
65
64
 
66
- def check_if_docker_daemon_is_running(docker_client: docker.DockerClient) -> None:
67
- """
68
- Check if Docker daemon is running
69
-
70
- Parameters
71
- ----------
72
- docker_client : docker.DockerClient
73
- The docker client
74
- """
75
- try:
76
- docker_client.ping()
77
- except Exception:
78
- error("Docker socket can not be found. Make sure Docker is running.")
79
- exit(1)
80
-
81
-
82
65
  def remove_file(file: str | Path, file_type: str) -> None:
83
66
  """
84
67
  Remove a file if it exists.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vantage6
3
- Version: 5.0.0a41
3
+ Version: 5.0.0a43
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==2.1.1
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.0a41
22
- Requires-Dist: vantage6-common==5.0.0a41
21
+ Requires-Dist: vantage6-client==5.0.0a43
22
+ Requires-Dist: vantage6-common==5.0.0a43
23
23
  Provides-Extra: dev
24
24
  Requires-Dist: black; extra == 'dev'
25
25
  Requires-Dist: coverage==7.10.2; extra == 'dev'
@@ -1,10 +1,10 @@
1
1
  vantage6/cli/__init__.py,sha256=8KIgMPbZTNdkYlUrB8irpsUA7KdkFdLbNbMKixOP2dE,277
2
2
  vantage6/cli/cli.py,sha256=uEazjKFMpVWP3rQ0FtHNcOg70qYTymoqPqc8dF5saKg,8591
3
3
  vantage6/cli/config.py,sha256=vaHNrgJTaAeYLpxfsXOHkYmsI1gLSipkKzyEOPXF1w4,8258
4
- vantage6/cli/configuration_create.py,sha256=Q8qnfDZ7gVEPgIqZJNJl4nEqc13ZVJh9K3U-O4XRk_Y,7354
4
+ vantage6/cli/configuration_create.py,sha256=kQzmsokRiKtWU7ZThbSlK-utSSJPJawUpaWLqMe5QxM,7355
5
5
  vantage6/cli/configuration_manager.py,sha256=zsk6dkdUA9zggUeFSkzXrNZ_XkxmQf26_oZsmLYYsu8,8096
6
6
  vantage6/cli/globals.py,sha256=VBa49tjuy9KjeF1eKtZre5QSohnWvlI1hsHeDZNMblA,2738
7
- vantage6/cli/utils.py,sha256=kq1Nv8SJPG5STII9DAcTSR4yCsZcoOvM8rygA5cWa28,5199
7
+ vantage6/cli/utils.py,sha256=6JJAvGWbRr_nY_T859BwNRXND-rvGQtthJMXlH-6Onk,4795
8
8
  vantage6/cli/utils_kubernetes.py,sha256=zMdarsuWeeZdrDBTczIjC920HadM_5BcOnhOFXBHk0Q,8200
9
9
  vantage6/cli/algorithm/create.py,sha256=kRT1BlBcb0fDaB2Q988WxtA6EyAZmOW5QoU2uhbwBIo,2075
10
10
  vantage6/cli/algorithm/generate_algorithm_json.py,sha256=p22wKt3y3J6G8ZQZ7qy5aNe7KppXdY7au9MKsnRWwwU,19525
@@ -26,46 +26,46 @@ vantage6/cli/auth/start.py,sha256=cH5bYvectyliobd6ybpGYf9wI7FyML5-5HS3jsjIyu8,28
26
26
  vantage6/cli/auth/stop.py,sha256=oWy7jDZ45zEyqSzwJr5-T14vp01D1TTcTYWxjXNtJ_U,1882
27
27
  vantage6/cli/common/attach.py,sha256=bw9-Q1JjKa_f8Q7-xI5lpI2WoUmlGKZSvULlGoSmnH8,3423
28
28
  vantage6/cli/common/decorator.py,sha256=N08qVbEokkV-XYLwEgEYRzjvgauiUdhIygBQqxR-XoM,4693
29
- vantage6/cli/common/list.py,sha256=j2q6B4k7wX5UMJ0gkuMrkYPl5I3NmkVuV6eV70hM36I,2075
30
- vantage6/cli/common/new.py,sha256=_srwNExvphy2SImbeFhGxuSsarkztPxxYXMwGMBy7g8,3278
29
+ vantage6/cli/common/list.py,sha256=uCKfPxng0-WLYBMGhUphOC-kmi6kXsmK5hUpkRFjXhI,2082
30
+ vantage6/cli/common/new.py,sha256=3ZhRFyzW04aRKJzLgn-Bh5t_T3EWei3YnYiI9-xr0aY,3204
31
31
  vantage6/cli/common/remove.py,sha256=q8YOihk5aClvPuw2cADulHrxeXv_0JhqpaNUVH1zhlQ,2206
32
- vantage6/cli/common/start.py,sha256=kMDjL_sObSkx4TqhnukyD9Jb7vOGXJ9Bo0pJBcxpbsg,10095
32
+ vantage6/cli/common/start.py,sha256=mBoTrlVERpbP77N93udB_c1J1Fy82faN3lLhIZrKEG4,7648
33
33
  vantage6/cli/common/stop.py,sha256=qIJ1COJWvQlbIpyMqh6ao2WKuXDqPBbU7-wF7IuOgQc,5614
34
- vantage6/cli/common/utils.py,sha256=-XP-JslNpnveR37v4vwiCgdj4kXOMlluoPJRmNECtFk,11473
34
+ vantage6/cli/common/utils.py,sha256=WSzbhleOasPLtS7vLjg1xoCrmydcqTCNM_SIGb8vqko,8577
35
35
  vantage6/cli/common/version.py,sha256=2XPeZm5NMYSqTGjHLUFcRFZZRhtDVLwytQjoDad3utU,2489
36
36
  vantage6/cli/context/__init__.py,sha256=umHNotzJjd2TQCela7V8MTUwN4iAKDy8AR4s7ask5Ic,3135
37
- vantage6/cli/context/algorithm_store.py,sha256=4_lglDDUyIss_H8iKzNAB0qWzCIppua4q-IvPp_i7A0,4332
37
+ vantage6/cli/context/algorithm_store.py,sha256=twVcy8jah4uqq04udX_o-BVCAG2MeIUUDBbQOngXhBs,4002
38
38
  vantage6/cli/context/auth.py,sha256=CozmEzFtpL8K3Pq4rEiHl8MMPnCI7vKwmzsPAIF2Szc,3911
39
39
  vantage6/cli/context/base_server.py,sha256=vln405k6b4z4L_VIfPCycy7gIfpJs0nqvJa8enl2HsA,2390
40
- vantage6/cli/context/node.py,sha256=1jjDw3u1Vf0maycEA0lyiBkXrh_qcw2wGLd_b2tnX4k,7972
41
- vantage6/cli/context/server.py,sha256=nuTUSfe08xnMMREhy8TN_PND9Ay3CASeUcgcCV6ti9A,5308
40
+ vantage6/cli/context/node.py,sha256=xsoNWBoZaPD-p5hUbUn7tztKyOqMmiqEQ698Bh1WI8I,7026
41
+ vantage6/cli/context/server.py,sha256=FC4lnQeA3DIWQNVVbstVRlmK7DYSbdFDmLIJtOuiqxQ,4975
42
42
  vantage6/cli/dev/clean.py,sha256=4fk5zNU7mi43YTPmgHwl6AC43_uZZyt1SUFy-JXGkRU,829
43
43
  vantage6/cli/dev/common.py,sha256=fiERHE0o2-m0ZAgIbyaZnFhYdeVMddrHiUoiLjmAR8o,929
44
44
  vantage6/cli/dev/rebuild.py,sha256=3iMIqAxiwdZkx4Q0xQyqcWHvXUzOQT-9cyRuOiulwR8,1290
45
45
  vantage6/cli/dev/start.py,sha256=DzFtD_jQaVIIawfPdMwBLjY1E_YOokiWm27oanci8k4,1000
46
46
  vantage6/cli/dev/stop.py,sha256=-yrLCadDfeLES9pFJz9yxm33XtzEXpdqvHvwakLQNEE,663
47
- vantage6/cli/node/attach.py,sha256=xOTB_79pShvn6B4Ky1bZ3TI_F3gOkGS9huzbEE0DRYc,1217
47
+ vantage6/cli/node/attach.py,sha256=JbBNYSvfou0ezKFrQt4ZGT4PgpYqz5gFuRKspQVreoI,1222
48
48
  vantage6/cli/node/create_private_key.py,sha256=UTsoJ04OCVjubC8b7AZhxrLzdwG-wQ_63ROw5uruxqs,5229
49
- vantage6/cli/node/files.py,sha256=y7WOGHCTE3DnmxgbweLcu51t0YLS9Jvl24zgCHKkQTQ,1003
49
+ vantage6/cli/node/files.py,sha256=aVuTyq1R8YnpGDRHXm9A8QrK0tJ1dJUiuzJ04c4Mokk,1007
50
50
  vantage6/cli/node/list.py,sha256=cydU5tByy0bHWCApcaZ8Pl_2SEbiqkK-mjVhWeChiCc,361
51
- vantage6/cli/node/new.py,sha256=XEVsnkI1UBngWwE96-KIOcs4zdPCuq3coTGHPNQxepQ,12717
52
- vantage6/cli/node/remove.py,sha256=alInSH_3E-yJthQ8JrGaopvAZ7GgxuRBppnpC8BRTBU,1061
51
+ vantage6/cli/node/new.py,sha256=EjlhlV1vAl3KhMIYz3hDqZFkYJTcSKJVKfd8J1kqiDk,12594
52
+ vantage6/cli/node/remove.py,sha256=WwgFtoJ8MLxewfjN-Hz9bctXzgPUm5cn3yF_0KKuVqI,1067
53
53
  vantage6/cli/node/restart.py,sha256=hJWzyJjetfNe8YYkOt5ZEUE_t-LpvQOwUGcQH0pXfNQ,3122
54
54
  vantage6/cli/node/set_api_key.py,sha256=eLB-NVpvXROlGKPAMua6vBAs5l08-AkENWiTfOB82FM,2103
55
- vantage6/cli/node/start.py,sha256=dn9wlDzq-XCV4ruMSTt0Nt01TOuJKZbXt3WJ3PPqZQY,4691
55
+ vantage6/cli/node/start.py,sha256=tVwJINgMGAC7_tTC3MXBDHVWL1G9n-7vtvKVr-VbIq0,4361
56
56
  vantage6/cli/node/stop.py,sha256=9936hGZu8EuYFF2NZ2of8U33jc8hKRLc4bXFu1ImuLw,6814
57
57
  vantage6/cli/node/version.py,sha256=vuQlq2SFWxHsA2_hqXtYK8c06mS2KqPCPU48F7-XXFU,4001
58
- vantage6/cli/node/common/__init__.py,sha256=B05W_dhjzhbk056xgxoGDDWlOM0YYGM6ZMslalR-nyw,3977
58
+ vantage6/cli/node/common/__init__.py,sha256=HO5eMantNY174C1K-XAgEPtCz6NpcR3H8N5yw-4j_sU,3482
59
59
  vantage6/cli/node/common/task_cleanup.py,sha256=bNa72P_gmGeQ3Z-Vl6Q7tKG8-deSAqk_02gvG--eHIY,4515
60
60
  vantage6/cli/prometheus/monitoring_manager.py,sha256=I4iR_2i6EgLMR2dM2e4bOVbTyGN4jPPRDPKHd8_CbRk,4908
61
61
  vantage6/cli/prometheus/prometheus.yml,sha256=Q4i9lVknITBodHUMgarRnEsXfXTNuSdI6a-9pW4YCoI,98
62
62
  vantage6/cli/sandbox/new.py,sha256=bsHHd7nVVOcoIpl0yhM15LxG_6adOvnIkh8e4h4HwPA,6077
63
- vantage6/cli/sandbox/remove.py,sha256=xCLE1ayjaDimby9Out0XgyLZRY0wbwmVpuEBDCrcPkM,5228
63
+ vantage6/cli/sandbox/remove.py,sha256=C4jzb1dlYfLsDeIMsofytDQfefSv2hovhVC2cYhshSo,5525
64
64
  vantage6/cli/sandbox/start.py,sha256=5qJawSH4HBO23RZgaPQd3UUYIJ0tVMcGdzNaKIUE6PU,10256
65
65
  vantage6/cli/sandbox/stop.py,sha256=gjNfcoXfB4pVy7x3CvdiJ1yC2x36UO17rBlAaKS_-QE,2782
66
66
  vantage6/cli/sandbox/config/base.py,sha256=24Ebo9mVa6KjqZllGkFvzjiD29o1gAVz0KQn6tZCHZU,3948
67
67
  vantage6/cli/sandbox/config/core.py,sha256=mScKMiaxpxR9rkuHr8mxjTtk2Dgoh4B4ZlxMrx60f1A,10004
68
- vantage6/cli/sandbox/config/node.py,sha256=qyxAotGwJStTpO91J0plvgUZsyB_GyRBFNHuCHO0uQ4,10239
68
+ vantage6/cli/sandbox/config/node.py,sha256=s75W3ZU7-E-s0MQCrN0vVSUS8kPIh5rNjVWoJpAfMI8,10127
69
69
  vantage6/cli/sandbox/data/km_dataset.csv,sha256=OrYF2ympb2QndiUOX_nTFGGB1HbAp2eOvZzrQ_PqJs4,31283
70
70
  vantage6/cli/sandbox/data/olympic_athletes_2016.csv,sha256=WGycwcwMKEyOyJc3aEo4EhrnBJiTSE0kZAr50j2qzGk,77699
71
71
  vantage6/cli/sandbox/populate/__init__.py,sha256=xzrDMnmX60kuuDA7u-E-aABdMO1rZKNwmxOo4cL68L4,4706
@@ -73,7 +73,7 @@ vantage6/cli/sandbox/populate/helpers/connect_store.py,sha256=Wb4shAbrNU7AARK7KZ
73
73
  vantage6/cli/sandbox/populate/helpers/delete_fixtures.py,sha256=fIAgzxvJqTfB1BCC-Nsdt1ltBL-o4Afl08zx6ZITb6I,2101
74
74
  vantage6/cli/sandbox/populate/helpers/load_fixtures.py,sha256=PQpEo0Q5PyWwYDaenAMqPrgRG6DF_SiFGK1V0BFNY3g,16225
75
75
  vantage6/cli/sandbox/populate/helpers/utils.py,sha256=5LSGZ-h7QtMB51IDzawXPIQFF7i2CIm6oYzEsdVKG4Y,1213
76
- vantage6/cli/server/attach.py,sha256=FrSdpRLJeRKWt0VBifj8oPKZsLNDaKJaI2Hy0D2m3kY,1282
76
+ vantage6/cli/server/attach.py,sha256=4zT4MJdqff0paCvDj2V1diRI0_qMXoBuJCBnzaz8xsM,1287
77
77
  vantage6/cli/server/files.py,sha256=MsnLaY91F2m49mm_FpVboFrSsZiEsu175KioN1alZfk,568
78
78
  vantage6/cli/server/import_.py,sha256=m7yjhXhGvL3dJ-8pEN0NMrE3CjMTcf0A0hEhJ5kTBIk,8276
79
79
  vantage6/cli/server/list.py,sha256=m-g1k8pmScK_CdhKiVFrLIUZsPnPsHr5CrfHmmI6KJk,299
@@ -85,18 +85,18 @@ vantage6/cli/server/version.py,sha256=iVYem8Gye4dCChC70s_FTqiWi1AF4VQfvhebnh0jur
85
85
  vantage6/cli/server/common/__init__.py,sha256=Frh_4V8ssoGy8rO3o7mRnlKkpOlNSjA5J6eReN1Yluo,1386
86
86
  vantage6/cli/template/algo_store_config.j2,sha256=dlKiUzZ-zYGdFCBArMMRpXvoQFG7rYz4vmv6rCwp6fM,7470
87
87
  vantage6/cli/template/auth_config.j2,sha256=mFNL7H3plnqN7kpptk2WPXPsnuGddCP_ktbzBZHi5ic,10866
88
- vantage6/cli/template/node_config.j2,sha256=ZHx-PvjldyKLcE3e8V1K0k5LkDUaS1uZunvbQWfgA2E,13963
89
- vantage6/cli/template/node_config_nonk8s.j2,sha256=mrS-YQwg_9i7zBKuEFG5pe3ZbHCLtl5hGgzk2etXTvo,783
88
+ vantage6/cli/template/node_config.j2,sha256=uiZSGuo6lGokCqd6fOc0SRsJOQgFWWSsNrJa4oFsFdc,14858
89
+ vantage6/cli/template/node_config_nonk8s.j2,sha256=J4r-ZtGX_PGSqnPBcobSjKUaWlDd-WjMz93kHs9OPW0,693
90
90
  vantage6/cli/template/server_config.j2,sha256=0uksEkCf4lRcBD39brOGdwoF_vCtieA-FjTiSUxNvo0,10195
91
91
  vantage6/cli/test/client_script.py,sha256=AHQ4fhzbtD-VcJAm0rxUDteepXNa4Bef9SKWnzobTd0,4825
92
92
  vantage6/cli/test/feature_tester.py,sha256=AsZam91KqaAo_yIFxyZ5Hmy1ZPw83d02BDyO4TzKFQo,2631
93
- vantage6/cli/test/integration_test.py,sha256=MctR_t-WEyxzFpMdc6ByTcX1BQglZiT5-CIOQXTBBWo,4034
93
+ vantage6/cli/test/integration_test.py,sha256=dOAHTr1Ids1vGL4E_T1kPid4Z0KDh5mvzIRzKboe4ys,4025
94
94
  vantage6/cli/test/algo_test_scripts/algo_test_arguments.py,sha256=HIKAhJ5zKkWMGXpCb_KLukbcwbyeMK5j3wcqubalbyM,791
95
95
  vantage6/cli/test/algo_test_scripts/algo_test_script.py,sha256=jfzXPmpL0HlE_eq1jXLV3HuZgh_aV-ZOaawHcYIuwQE,2741
96
96
  vantage6/cli/test/common/diagnostic_runner.py,sha256=jFFHqlj3v0WRpVEBa7Ovek3DL6RX6W5cQd9w5hWHtZA,6597
97
97
  vantage6/cli/use/context.py,sha256=cTp9kwC4hhq4FkPz1wYAeYWUGK4054S19FxpZYLF7lM,1665
98
98
  vantage6/cli/use/namespace.py,sha256=ev22EuixwW7ZWqhGo8SiSKgtGq4yy8gEXmMhR31khkE,1729
99
- vantage6-5.0.0a41.dist-info/METADATA,sha256=4aR_JWhmZV4yqZ9JyQBrlRgziI_a-0CblbUxiOMMxXk,1778
100
- vantage6-5.0.0a41.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
- vantage6-5.0.0a41.dist-info/entry_points.txt,sha256=RKVCMsD70s_Gp6If89uDlCphsZ9uLIOMt1gciv8EMDQ,53
102
- vantage6-5.0.0a41.dist-info/RECORD,,
99
+ vantage6-5.0.0a43.dist-info/METADATA,sha256=U-Tw-Up8VO7WXhb-W4zmz5goWxF558yNbIDwjzZeyZk,1778
100
+ vantage6-5.0.0a43.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
+ vantage6-5.0.0a43.dist-info/entry_points.txt,sha256=RKVCMsD70s_Gp6If89uDlCphsZ9uLIOMt1gciv8EMDQ,53
102
+ vantage6-5.0.0a43.dist-info/RECORD,,