vantage6 4.8.2__py3-none-any.whl → 4.9.0__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.
- tests_cli/test_node_cli.py +27 -5
- tests_cli/test_server_cli.py +1 -1
- vantage6/cli/_version.py +1 -1
- vantage6/cli/algostore/attach.py +20 -7
- vantage6/cli/algostore/new.py +2 -2
- vantage6/cli/cli.py +2 -0
- vantage6/cli/common/utils.py +19 -0
- vantage6/cli/configuration_wizard.py +3 -1
- vantage6/cli/dev/create.py +3 -2
- vantage6/cli/dev/start.py +2 -2
- vantage6/cli/node/attach.py +1 -1
- vantage6/cli/node/common/__init__.py +7 -2
- vantage6/cli/node/create_private_key.py +10 -2
- vantage6/cli/node/new.py +2 -2
- vantage6/cli/node/restart.py +124 -0
- vantage6/cli/node/set_api_key.py +2 -2
- vantage6/cli/node/start.py +1 -1
- vantage6/cli/server/attach.py +1 -1
- vantage6/cli/server/new.py +2 -2
- {vantage6-4.8.2.dist-info → vantage6-4.9.0.dist-info}/METADATA +3 -3
- {vantage6-4.8.2.dist-info → vantage6-4.9.0.dist-info}/RECORD +24 -23
- {vantage6-4.8.2.dist-info → vantage6-4.9.0.dist-info}/WHEEL +0 -0
- {vantage6-4.8.2.dist-info → vantage6-4.9.0.dist-info}/entry_points.txt +0 -0
- {vantage6-4.8.2.dist-info → vantage6-4.9.0.dist-info}/top_level.txt +0 -0
tests_cli/test_node_cli.py
CHANGED
|
@@ -17,6 +17,7 @@ from vantage6.cli.node.list import cli_node_list
|
|
|
17
17
|
from vantage6.cli.node.new import cli_node_new_configuration
|
|
18
18
|
from vantage6.cli.node.files import cli_node_files
|
|
19
19
|
from vantage6.cli.node.start import cli_node_start
|
|
20
|
+
from vantage6.cli.node.restart import cli_node_restart
|
|
20
21
|
from vantage6.cli.node.stop import cli_node_stop
|
|
21
22
|
from vantage6.cli.node.attach import cli_node_attach
|
|
22
23
|
from vantage6.cli.node.create_private_key import cli_node_create_private_key
|
|
@@ -85,7 +86,7 @@ class NodeCLITest(unittest.TestCase):
|
|
|
85
86
|
)
|
|
86
87
|
|
|
87
88
|
@patch("vantage6.cli.node.new.configuration_wizard")
|
|
88
|
-
@patch("vantage6.cli.node.new.
|
|
89
|
+
@patch("vantage6.cli.node.new.ensure_config_dir_writable")
|
|
89
90
|
@patch("vantage6.cli.node.common.NodeContext")
|
|
90
91
|
def test_new_config(self, context, permissions, wizard):
|
|
91
92
|
"""No error produced when creating new configuration."""
|
|
@@ -147,7 +148,7 @@ class NodeCLITest(unittest.TestCase):
|
|
|
147
148
|
# check non-zero exit code
|
|
148
149
|
self.assertEqual(result.exit_code, 1)
|
|
149
150
|
|
|
150
|
-
@patch("vantage6.cli.node.new.
|
|
151
|
+
@patch("vantage6.cli.node.new.ensure_config_dir_writable")
|
|
151
152
|
@patch("vantage6.cli.node.common.NodeContext")
|
|
152
153
|
def test_new_write_permissions(self, context, permissions):
|
|
153
154
|
"""User needs write permissions."""
|
|
@@ -248,14 +249,17 @@ class NodeCLITest(unittest.TestCase):
|
|
|
248
249
|
|
|
249
250
|
self.assertEqual(result.exit_code, 0)
|
|
250
251
|
|
|
252
|
+
def _setup_stop_test(self, containers):
|
|
253
|
+
container1 = MagicMock()
|
|
254
|
+
container1.name = f"{APPNAME}-iknl-user"
|
|
255
|
+
containers.list.return_value = [container1]
|
|
256
|
+
|
|
251
257
|
@patch("docker.DockerClient.containers")
|
|
252
258
|
@patch("vantage6.cli.node.stop.check_docker_running", return_value=True)
|
|
253
259
|
@patch("vantage6.cli.node.stop.NodeContext")
|
|
254
260
|
@patch("vantage6.cli.node.stop.delete_volume_if_exists")
|
|
255
261
|
def test_stop(self, delete_volume, node_context, check_docker, containers):
|
|
256
|
-
|
|
257
|
-
container1.name = f"{APPNAME}-iknl-user"
|
|
258
|
-
containers.list.return_value = [container1]
|
|
262
|
+
self._setup_stop_test(containers)
|
|
259
263
|
|
|
260
264
|
runner = CliRunner()
|
|
261
265
|
|
|
@@ -267,6 +271,24 @@ class NodeCLITest(unittest.TestCase):
|
|
|
267
271
|
|
|
268
272
|
self.assertEqual(result.exit_code, 0)
|
|
269
273
|
|
|
274
|
+
@patch("docker.DockerClient.containers")
|
|
275
|
+
@patch("vantage6.cli.node.stop.check_docker_running", return_value=True)
|
|
276
|
+
@patch("vantage6.cli.node.stop.NodeContext")
|
|
277
|
+
@patch("vantage6.cli.node.stop.delete_volume_if_exists")
|
|
278
|
+
@patch("vantage6.cli.node.restart.subprocess.run")
|
|
279
|
+
def test_restart(
|
|
280
|
+
self, subprocess_run, delete_volume, node_context, check_docker, containers
|
|
281
|
+
):
|
|
282
|
+
"""Restart a node without errors."""
|
|
283
|
+
self._setup_stop_test(containers)
|
|
284
|
+
# The subprocess.run() function is called with the command to start the node.
|
|
285
|
+
# Unfortunately it is hard to test this, so we just return a successful run
|
|
286
|
+
subprocess_run.return_value = MagicMock(returncode=0)
|
|
287
|
+
runner = CliRunner()
|
|
288
|
+
with runner.isolated_filesystem():
|
|
289
|
+
result = runner.invoke(cli_node_restart, ["--name", "iknl"])
|
|
290
|
+
self.assertEqual(result.exit_code, 0)
|
|
291
|
+
|
|
270
292
|
@patch("vantage6.cli.node.attach.time")
|
|
271
293
|
@patch("vantage6.cli.node.attach.print_log_worker")
|
|
272
294
|
@patch("docker.DockerClient.containers")
|
tests_cli/test_server_cli.py
CHANGED
|
@@ -112,7 +112,7 @@ class ServerCLITest(unittest.TestCase):
|
|
|
112
112
|
self.assertEqual(result.exit_code, 0)
|
|
113
113
|
|
|
114
114
|
@patch("vantage6.cli.server.new.configuration_wizard")
|
|
115
|
-
@patch("vantage6.cli.server.new.
|
|
115
|
+
@patch("vantage6.cli.server.new.ensure_config_dir_writable")
|
|
116
116
|
@patch("vantage6.cli.server.new.ServerContext")
|
|
117
117
|
def test_new(self, context, permissions, wizard):
|
|
118
118
|
"""New configuration without errors."""
|
vantage6/cli/_version.py
CHANGED
|
@@ -7,7 +7,7 @@ with open(os.path.join(here, "__build__")) as fp:
|
|
|
7
7
|
__build__ = json.load(fp)
|
|
8
8
|
|
|
9
9
|
# Module version
|
|
10
|
-
version_info = (4,
|
|
10
|
+
version_info = (4, 9, 0, "final", __build__, 0)
|
|
11
11
|
|
|
12
12
|
# Module version stage suffix map
|
|
13
13
|
_specifier_ = {"alpha": "a", "beta": "b", "candidate": "rc", "final": ""}
|
vantage6/cli/algostore/attach.py
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import click
|
|
2
2
|
import docker
|
|
3
|
+
import questionary as q
|
|
3
4
|
|
|
4
5
|
from colorama import Fore, Style
|
|
5
6
|
|
|
6
7
|
from vantage6.common import error
|
|
7
8
|
from vantage6.common.docker.addons import check_docker_running
|
|
8
9
|
from vantage6.common.globals import APPNAME, InstanceType
|
|
9
|
-
from vantage6.cli.common.decorator import click_insert_context
|
|
10
10
|
from vantage6.cli.common.start import attach_logs
|
|
11
|
-
from vantage6.cli.
|
|
11
|
+
from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
@click.command()
|
|
15
|
-
@
|
|
16
|
-
|
|
15
|
+
@click.option("-n", "--name", default=None, help="configuration name")
|
|
16
|
+
@click.option("--system", "system_folders", flag_value=True)
|
|
17
|
+
@click.option(
|
|
18
|
+
"--user", "system_folders", flag_value=False, default=DEFAULT_SERVER_SYSTEM_FOLDERS
|
|
19
|
+
)
|
|
20
|
+
def cli_algo_store_attach(name: str, system_folders: bool) -> None:
|
|
17
21
|
"""
|
|
18
22
|
Show the server logs in the current console.
|
|
19
23
|
"""
|
|
@@ -25,8 +29,17 @@ def cli_algo_store_attach(ctx: AlgorithmStoreContext) -> None:
|
|
|
25
29
|
)
|
|
26
30
|
running_server_names = [container.name for container in running_servers]
|
|
27
31
|
|
|
28
|
-
if
|
|
29
|
-
|
|
32
|
+
if not name:
|
|
33
|
+
name = q.select(
|
|
34
|
+
"Select the algorithm store you wish to attach:",
|
|
35
|
+
choices=running_server_names,
|
|
36
|
+
).ask()
|
|
37
|
+
else:
|
|
38
|
+
post_fix = "system" if system_folders else "user"
|
|
39
|
+
name = f"{APPNAME}-{name}-{post_fix}-{InstanceType.ALGORITHM_STORE}"
|
|
40
|
+
|
|
41
|
+
if name in running_server_names:
|
|
42
|
+
container = client.containers.get(name)
|
|
30
43
|
attach_logs(container, InstanceType.ALGORITHM_STORE)
|
|
31
44
|
else:
|
|
32
|
-
error(f"{Fore.RED}{
|
|
45
|
+
error(f"{Fore.RED}{name}{Style.RESET_ALL} is not running!")
|
vantage6/cli/algostore/new.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import click
|
|
2
2
|
from colorama import Fore, Style
|
|
3
3
|
|
|
4
|
-
from vantage6.common import info, error,
|
|
4
|
+
from vantage6.common import info, error, ensure_config_dir_writable
|
|
5
5
|
from vantage6.common.globals import InstanceType
|
|
6
6
|
from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS
|
|
7
7
|
from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
|
|
@@ -36,7 +36,7 @@ def cli_algo_store_new(name: str, system_folders: bool) -> None:
|
|
|
36
36
|
exit(1)
|
|
37
37
|
|
|
38
38
|
# Check that we can write in this folder
|
|
39
|
-
if not
|
|
39
|
+
if not ensure_config_dir_writable(system_folders):
|
|
40
40
|
error("Your user does not have write access to all folders. Exiting")
|
|
41
41
|
info(
|
|
42
42
|
f"Create a new server using '{Fore.GREEN}v6 algorithm-store new "
|
vantage6/cli/cli.py
CHANGED
|
@@ -17,6 +17,7 @@ from vantage6.cli.node.files import cli_node_files
|
|
|
17
17
|
from vantage6.cli.node.list import cli_node_list
|
|
18
18
|
from vantage6.cli.node.new import cli_node_new_configuration
|
|
19
19
|
from vantage6.cli.node.remove import cli_node_remove
|
|
20
|
+
from vantage6.cli.node.restart import cli_node_restart
|
|
20
21
|
from vantage6.cli.node.set_api_key import cli_node_set_api_key
|
|
21
22
|
from vantage6.cli.node.start import cli_node_start
|
|
22
23
|
from vantage6.cli.node.stop import cli_node_stop
|
|
@@ -75,6 +76,7 @@ cli_node.add_command(cli_node_files, name="files")
|
|
|
75
76
|
cli_node.add_command(cli_node_list, name="list")
|
|
76
77
|
cli_node.add_command(cli_node_new_configuration, name="new")
|
|
77
78
|
cli_node.add_command(cli_node_remove, name="remove")
|
|
79
|
+
cli_node.add_command(cli_node_restart, name="restart")
|
|
78
80
|
cli_node.add_command(cli_node_set_api_key, name="set-api-key")
|
|
79
81
|
cli_node.add_command(cli_node_start, name="start")
|
|
80
82
|
cli_node.add_command(cli_node_stop, name="stop")
|
vantage6/cli/common/utils.py
CHANGED
|
@@ -135,3 +135,22 @@ def print_log_worker(logs_stream: Iterable[bytes]) -> None:
|
|
|
135
135
|
"the container."
|
|
136
136
|
)
|
|
137
137
|
print(log)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def get_name_from_container_name(container_name: str) -> str:
|
|
141
|
+
"""
|
|
142
|
+
Get the node/server/store name from a container name.
|
|
143
|
+
|
|
144
|
+
Parameters
|
|
145
|
+
----------
|
|
146
|
+
container_name : str
|
|
147
|
+
The name of the container
|
|
148
|
+
|
|
149
|
+
Returns
|
|
150
|
+
-------
|
|
151
|
+
str
|
|
152
|
+
The name of the node/server/store
|
|
153
|
+
"""
|
|
154
|
+
# Container name is structured as: f"{APPNAME}-{name}-{post_fix}"
|
|
155
|
+
# Take into account that name can contain '-'
|
|
156
|
+
return "-".join(container_name.split("-")[1:-1])
|
|
@@ -487,7 +487,9 @@ def algo_store_configuration_questionaire(instance_name: str) -> dict:
|
|
|
487
487
|
"""
|
|
488
488
|
config = _get_common_server_config(InstanceType.ALGORITHM_STORE, instance_name)
|
|
489
489
|
|
|
490
|
-
default_v6_server_uri =
|
|
490
|
+
default_v6_server_uri = (
|
|
491
|
+
f"http://localhost:{Ports.DEV_SERVER.value}{DEFAULT_API_PATH}"
|
|
492
|
+
)
|
|
491
493
|
default_root_username = "root"
|
|
492
494
|
|
|
493
495
|
v6_server_uri = q.text(
|
vantage6/cli/dev/create.py
CHANGED
|
@@ -485,8 +485,9 @@ def demo_network(
|
|
|
485
485
|
"--server-url",
|
|
486
486
|
type=str,
|
|
487
487
|
default="http://host.docker.internal",
|
|
488
|
-
help="Server URL to point to. If you are using Docker Desktop, "
|
|
489
|
-
"
|
|
488
|
+
help="Server URL to point to. If you are using Docker Desktop, the default "
|
|
489
|
+
"http://host.docker.internal should not be changed. If you are using Linux without"
|
|
490
|
+
" Docker Desktop, you should set this to http://172.17.0.1",
|
|
490
491
|
)
|
|
491
492
|
@click.option(
|
|
492
493
|
"-p",
|
vantage6/cli/dev/start.py
CHANGED
|
@@ -67,7 +67,7 @@ def start_demo_network(
|
|
|
67
67
|
cmd = ["v6", "algorithm-store", "start", "--name", f"{ctx.name}_store", "--user"]
|
|
68
68
|
if store_image:
|
|
69
69
|
cmd.extend(["--image", store_image])
|
|
70
|
-
subprocess.run(cmd)
|
|
70
|
+
subprocess.run(cmd, check=True)
|
|
71
71
|
|
|
72
72
|
# run all nodes that belong to this server
|
|
73
73
|
configs, _ = NodeContext.available_configurations(system_folders=False)
|
|
@@ -78,7 +78,7 @@ def start_demo_network(
|
|
|
78
78
|
cmd = ["v6", "node", "start", "--name", name]
|
|
79
79
|
if node_image:
|
|
80
80
|
cmd.extend(["--image", node_image])
|
|
81
|
-
subprocess.run(cmd)
|
|
81
|
+
subprocess.run(cmd, check=True)
|
|
82
82
|
|
|
83
83
|
# now that both server and store have been started, couple them
|
|
84
84
|
info("Linking local algorithm store to server...")
|
vantage6/cli/node/attach.py
CHANGED
|
@@ -46,7 +46,7 @@ def cli_node_attach(name: str, system_folders: bool) -> None:
|
|
|
46
46
|
|
|
47
47
|
if not name:
|
|
48
48
|
name = q.select(
|
|
49
|
-
"Select the node you wish to
|
|
49
|
+
"Select the node you wish to attach:", choices=running_node_names
|
|
50
50
|
).ask()
|
|
51
51
|
else:
|
|
52
52
|
post_fix = "system" if system_folders else "user"
|
|
@@ -38,7 +38,9 @@ def create_client(ctx: NodeContext) -> UserClient:
|
|
|
38
38
|
return UserClient(host, port, api_path, log_level="warn")
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
def create_client_and_authenticate(
|
|
41
|
+
def create_client_and_authenticate(
|
|
42
|
+
ctx: NodeContext, ask_mfa: bool = False
|
|
43
|
+
) -> UserClient:
|
|
42
44
|
"""
|
|
43
45
|
Generate a client and authenticate with the server.
|
|
44
46
|
|
|
@@ -46,6 +48,8 @@ def create_client_and_authenticate(ctx: NodeContext) -> UserClient:
|
|
|
46
48
|
----------
|
|
47
49
|
ctx : NodeContext
|
|
48
50
|
Context of the node loaded from the configuration file
|
|
51
|
+
ask_mfa : bool, optional
|
|
52
|
+
Whether to ask for MFA code, by default False
|
|
49
53
|
|
|
50
54
|
Returns
|
|
51
55
|
-------
|
|
@@ -56,9 +60,10 @@ def create_client_and_authenticate(ctx: NodeContext) -> UserClient:
|
|
|
56
60
|
|
|
57
61
|
username = q.text("Username:").ask()
|
|
58
62
|
password = q.password("Password:").ask()
|
|
63
|
+
mfa_code = q.text("MFA code:").ask() if ask_mfa else None
|
|
59
64
|
|
|
60
65
|
try:
|
|
61
|
-
client.authenticate(username, password)
|
|
66
|
+
client.authenticate(username, password, mfa_code=mfa_code)
|
|
62
67
|
|
|
63
68
|
except Exception as exc:
|
|
64
69
|
error("Could not authenticate with server!")
|
|
@@ -59,6 +59,13 @@ from vantage6.cli.node.common import select_node, create_client_and_authenticate
|
|
|
59
59
|
default=False,
|
|
60
60
|
help="Overwrite existing private key if present",
|
|
61
61
|
)
|
|
62
|
+
@click.option(
|
|
63
|
+
"--mfa",
|
|
64
|
+
"ask_mfa",
|
|
65
|
+
flag_value=True,
|
|
66
|
+
default=False,
|
|
67
|
+
help="Ask for multi-factor authentication code. Use this if MFA is enabled on the server.",
|
|
68
|
+
)
|
|
62
69
|
def cli_node_create_private_key(
|
|
63
70
|
name: str,
|
|
64
71
|
config: str,
|
|
@@ -66,6 +73,7 @@ def cli_node_create_private_key(
|
|
|
66
73
|
upload: bool,
|
|
67
74
|
organization_name: str,
|
|
68
75
|
overwrite: bool,
|
|
76
|
+
ask_mfa: bool,
|
|
69
77
|
) -> None:
|
|
70
78
|
"""
|
|
71
79
|
Create and upload a new private key
|
|
@@ -89,7 +97,7 @@ def cli_node_create_private_key(
|
|
|
89
97
|
# Authenticate with the server to obtain organization name if it wasn't
|
|
90
98
|
# provided
|
|
91
99
|
if organization_name is None:
|
|
92
|
-
client = create_client_and_authenticate(ctx)
|
|
100
|
+
client = create_client_and_authenticate(ctx, ask_mfa)
|
|
93
101
|
organization_name = client.whoami.organization_name
|
|
94
102
|
|
|
95
103
|
# create directory where private key goes if it doesn't exist yet
|
|
@@ -103,7 +111,7 @@ def cli_node_create_private_key(
|
|
|
103
111
|
warning(f"File '{Fore.CYAN}{file_}{Style.RESET_ALL}' exists!")
|
|
104
112
|
|
|
105
113
|
if overwrite:
|
|
106
|
-
warning("'--
|
|
114
|
+
warning("'--overwrite' specified, so it will be overwritten ...")
|
|
107
115
|
|
|
108
116
|
if file_.exists() and not overwrite:
|
|
109
117
|
error("Could not create private key!")
|
vantage6/cli/node/new.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import click
|
|
2
2
|
from colorama import Fore, Style
|
|
3
3
|
|
|
4
|
-
from vantage6.common import error, info,
|
|
4
|
+
from vantage6.common import error, info, ensure_config_dir_writable
|
|
5
5
|
from vantage6.cli.context.node import NodeContext
|
|
6
6
|
from vantage6.cli.globals import DEFAULT_NODE_SYSTEM_FOLDERS as N_FOL
|
|
7
7
|
from vantage6.cli.configuration_wizard import configuration_wizard
|
|
@@ -41,7 +41,7 @@ def cli_node_new_configuration(name: str, system_folders: bool) -> None:
|
|
|
41
41
|
exit(1)
|
|
42
42
|
|
|
43
43
|
# Check that we can write in this folder
|
|
44
|
-
if not
|
|
44
|
+
if not ensure_config_dir_writable(system_folders):
|
|
45
45
|
error("Cannot write configuration file. Exiting...")
|
|
46
46
|
exit(1)
|
|
47
47
|
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import click
|
|
3
|
+
import questionary as q
|
|
4
|
+
import docker
|
|
5
|
+
|
|
6
|
+
from vantage6.common import warning, error
|
|
7
|
+
from vantage6.common.docker.addons import check_docker_running
|
|
8
|
+
from vantage6.cli.common.utils import get_name_from_container_name
|
|
9
|
+
from vantage6.cli.node.stop import cli_node_stop
|
|
10
|
+
from vantage6.cli.node.common import find_running_node_names
|
|
11
|
+
from vantage6.cli.globals import DEFAULT_NODE_SYSTEM_FOLDERS as N_FOL
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@click.command()
|
|
15
|
+
@click.option("-n", "--name", default=None, help="Configuration name")
|
|
16
|
+
@click.option(
|
|
17
|
+
"--system",
|
|
18
|
+
"system_folders",
|
|
19
|
+
flag_value=True,
|
|
20
|
+
help="Search for configuration in system folders instead of " "user folders",
|
|
21
|
+
)
|
|
22
|
+
@click.option(
|
|
23
|
+
"--user",
|
|
24
|
+
"system_folders",
|
|
25
|
+
flag_value=False,
|
|
26
|
+
default=N_FOL,
|
|
27
|
+
help="Search for configuration in the user folders instead of "
|
|
28
|
+
"system folders. This is the default.",
|
|
29
|
+
)
|
|
30
|
+
@click.option("-i", "--image", default=None, help="Node Docker image to use")
|
|
31
|
+
@click.option(
|
|
32
|
+
"--keep/--auto-remove",
|
|
33
|
+
default=False,
|
|
34
|
+
help="Keep node container after finishing. Useful for debugging",
|
|
35
|
+
)
|
|
36
|
+
@click.option(
|
|
37
|
+
"--force-db-mount",
|
|
38
|
+
is_flag=True,
|
|
39
|
+
help="Always mount node databases; skip the check if they are existing files.",
|
|
40
|
+
)
|
|
41
|
+
@click.option(
|
|
42
|
+
"--attach/--detach",
|
|
43
|
+
default=False,
|
|
44
|
+
help="Show node logs on the current console after starting the " "node",
|
|
45
|
+
)
|
|
46
|
+
@click.option(
|
|
47
|
+
"--mount-src",
|
|
48
|
+
default="",
|
|
49
|
+
help="Override vantage6 source code in container with the source"
|
|
50
|
+
" code in this path",
|
|
51
|
+
)
|
|
52
|
+
@click.option("--all", "all_nodes", flag_value=True, help="Stop all running nodes")
|
|
53
|
+
@click.option(
|
|
54
|
+
"--force",
|
|
55
|
+
"force",
|
|
56
|
+
flag_value=True,
|
|
57
|
+
help="Kill nodes instantly; don't wait for them to shut down",
|
|
58
|
+
)
|
|
59
|
+
@click.pass_context
|
|
60
|
+
def cli_node_restart(
|
|
61
|
+
click_ctx: click.Context,
|
|
62
|
+
name: str,
|
|
63
|
+
system_folders: bool,
|
|
64
|
+
image: str,
|
|
65
|
+
keep: bool,
|
|
66
|
+
mount_src: str,
|
|
67
|
+
attach: bool,
|
|
68
|
+
force_db_mount: bool,
|
|
69
|
+
all_nodes: bool,
|
|
70
|
+
force: bool,
|
|
71
|
+
) -> None:
|
|
72
|
+
"""Restart the node"""
|
|
73
|
+
check_docker_running()
|
|
74
|
+
client = docker.from_env()
|
|
75
|
+
|
|
76
|
+
running_node_names = find_running_node_names(client)
|
|
77
|
+
if not running_node_names:
|
|
78
|
+
warning("No nodes are currently running. No action taken.")
|
|
79
|
+
return
|
|
80
|
+
|
|
81
|
+
if attach and all_nodes:
|
|
82
|
+
error(
|
|
83
|
+
"Cannot attach logs of all nodes at once. Please remove either the "
|
|
84
|
+
"'--all' or '--attach' option."
|
|
85
|
+
)
|
|
86
|
+
return
|
|
87
|
+
|
|
88
|
+
if all_nodes:
|
|
89
|
+
names = [
|
|
90
|
+
get_name_from_container_name(container_name)
|
|
91
|
+
for container_name in running_node_names
|
|
92
|
+
]
|
|
93
|
+
else:
|
|
94
|
+
if not name:
|
|
95
|
+
container_name = q.select(
|
|
96
|
+
"Select the node you wish to restart:", choices=running_node_names
|
|
97
|
+
).ask()
|
|
98
|
+
names = [get_name_from_container_name(container_name)]
|
|
99
|
+
else:
|
|
100
|
+
names = [name]
|
|
101
|
+
|
|
102
|
+
for node_name in names:
|
|
103
|
+
click_ctx.invoke(
|
|
104
|
+
cli_node_stop,
|
|
105
|
+
name=node_name,
|
|
106
|
+
system_folders=system_folders,
|
|
107
|
+
all_nodes=False,
|
|
108
|
+
force=force,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
cmd = ["v6", "node", "start", "--name", node_name]
|
|
112
|
+
if system_folders:
|
|
113
|
+
cmd.append("--system")
|
|
114
|
+
if image:
|
|
115
|
+
cmd.extend(["--image", image])
|
|
116
|
+
if keep:
|
|
117
|
+
cmd.append("--keep")
|
|
118
|
+
if mount_src:
|
|
119
|
+
cmd.extend(["--mount-src", mount_src])
|
|
120
|
+
if attach:
|
|
121
|
+
cmd.append("--attach")
|
|
122
|
+
if force_db_mount:
|
|
123
|
+
cmd.append("--force-db-mount")
|
|
124
|
+
subprocess.run(cmd, check=True)
|
vantage6/cli/node/set_api_key.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import click
|
|
2
2
|
import questionary as q
|
|
3
3
|
|
|
4
|
-
from vantage6.common import error, info,
|
|
4
|
+
from vantage6.common import error, info, ensure_config_dir_writable
|
|
5
5
|
from vantage6.cli.context.node import NodeContext
|
|
6
6
|
from vantage6.cli.globals import DEFAULT_NODE_SYSTEM_FOLDERS as N_FOL
|
|
7
7
|
from vantage6.cli.configuration_wizard import NodeConfigurationManager
|
|
@@ -33,7 +33,7 @@ def cli_node_set_api_key(name: str, api_key: str, system_folders: bool) -> None:
|
|
|
33
33
|
name = select_node(name, system_folders)
|
|
34
34
|
|
|
35
35
|
# Check that we can write in the config folder
|
|
36
|
-
if not
|
|
36
|
+
if not ensure_config_dir_writable(system_folders):
|
|
37
37
|
error("Your user does not have write access to all folders. Exiting")
|
|
38
38
|
exit(1)
|
|
39
39
|
|
vantage6/cli/node/start.py
CHANGED
|
@@ -177,7 +177,7 @@ def cli_node_start(
|
|
|
177
177
|
if Path(fullpath).exists():
|
|
178
178
|
mounts.append(("/mnt/private_key.pem", str(fullpath)))
|
|
179
179
|
else:
|
|
180
|
-
warning(f"
|
|
180
|
+
warning(f"Private key file is provided {fullpath}, but does not exist")
|
|
181
181
|
|
|
182
182
|
# Mount private keys for ssh tunnels
|
|
183
183
|
ssh_tunnels = ctx.config.get("ssh-tunnels", [])
|
vantage6/cli/server/attach.py
CHANGED
|
@@ -35,7 +35,7 @@ def cli_server_attach(name: str, system_folders: bool) -> None:
|
|
|
35
35
|
|
|
36
36
|
if not name:
|
|
37
37
|
name = q.select(
|
|
38
|
-
"Select the server you wish to
|
|
38
|
+
"Select the server you wish to attach:", choices=running_server_names
|
|
39
39
|
).ask()
|
|
40
40
|
else:
|
|
41
41
|
post_fix = "system" if system_folders else "user"
|
vantage6/cli/server/new.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import click
|
|
2
2
|
from colorama import Fore, Style
|
|
3
3
|
|
|
4
|
-
from vantage6.common import info, error,
|
|
4
|
+
from vantage6.common import info, error, ensure_config_dir_writable
|
|
5
5
|
from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS
|
|
6
6
|
from vantage6.cli.context.server import ServerContext
|
|
7
7
|
from vantage6.cli.configuration_wizard import configuration_wizard
|
|
@@ -36,7 +36,7 @@ def cli_server_new(name: str, system_folders: bool) -> None:
|
|
|
36
36
|
exit(1)
|
|
37
37
|
|
|
38
38
|
# Check that we can write in this folder
|
|
39
|
-
if not
|
|
39
|
+
if not ensure_config_dir_writable(system_folders):
|
|
40
40
|
error("Your user does not have write access to all folders. Exiting")
|
|
41
41
|
info(
|
|
42
42
|
f"Create a new server using '{Fore.GREEN}v6 server new "
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: vantage6
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.9.0
|
|
4
4
|
Summary: vantage6 command line interface
|
|
5
5
|
Home-page: https://github.com/vantage6/vantage6
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -16,8 +16,8 @@ Requires-Dist: questionary==1.10.0
|
|
|
16
16
|
Requires-Dist: rich==13.5.2
|
|
17
17
|
Requires-Dist: schema==0.7.5
|
|
18
18
|
Requires-Dist: SQLAlchemy==1.4.46
|
|
19
|
-
Requires-Dist: vantage6-common==4.
|
|
20
|
-
Requires-Dist: vantage6-client==4.
|
|
19
|
+
Requires-Dist: vantage6-common==4.9.0
|
|
20
|
+
Requires-Dist: vantage6-client==4.9.0
|
|
21
21
|
Provides-Extra: dev
|
|
22
22
|
Requires-Dist: coverage==6.4.4; extra == "dev"
|
|
23
23
|
Requires-Dist: black; extra == "dev"
|
|
@@ -1,60 +1,61 @@
|
|
|
1
1
|
tests_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
tests_cli/test_example.py,sha256=0fw_v-lgZEacshWSDwLNyLMA1_xc48bKUGM3ll-n1L0,146
|
|
3
|
-
tests_cli/test_node_cli.py,sha256=
|
|
4
|
-
tests_cli/test_server_cli.py,sha256=
|
|
3
|
+
tests_cli/test_node_cli.py,sha256=lPRKFK5JsZS-rFV943B9S6BUcHLGLpE9cu53ZBkyjus,17127
|
|
4
|
+
tests_cli/test_server_cli.py,sha256=M0Vh4XZIxZPwPPFDY03pBP3yk98vmmW_2G91BcM0_Yg,5867
|
|
5
5
|
tests_cli/test_wizard.py,sha256=eoa0WQ9yw7IjtaeAKzbK8-sOCBGow7gLrhhmUx024p8,4881
|
|
6
6
|
vantage6/cli/__build__,sha256=X-zrZv_IbzjZUnhsbWlsecLbwjndTpG0ZynXOif7V-k,1
|
|
7
7
|
vantage6/cli/__init__.py,sha256=-Ec-Z7ELDveGdSALXda3qdUGpkuKyJQfhN3eIm7koHE,127
|
|
8
|
-
vantage6/cli/_version.py,sha256=
|
|
9
|
-
vantage6/cli/cli.py,sha256=
|
|
8
|
+
vantage6/cli/_version.py,sha256=5_N7ID4mlQDdbdXKu-RHvKbEzw5nS7_2FSKr8IbNw0I,696
|
|
9
|
+
vantage6/cli/cli.py,sha256=NHpiPcljADaVzwGYrG4FWVMfbmDRguSZWBeGxcdQxDo,6184
|
|
10
10
|
vantage6/cli/configuration_manager.py,sha256=cN4tQpQjLG5GaGrsjEP-5ed_LqvPApIkNkM1J6ai3n0,3588
|
|
11
|
-
vantage6/cli/configuration_wizard.py,sha256=
|
|
11
|
+
vantage6/cli/configuration_wizard.py,sha256=wjKgZ5WzX4VT46rxNoH80M33fnYvrXRDC8UoDBlZ6Fc,20470
|
|
12
12
|
vantage6/cli/globals.py,sha256=8AWI55FBbumVQTuI1bJzKp5hiRWtiwsVgTTKqWgRBes,1616
|
|
13
13
|
vantage6/cli/utils.py,sha256=8_PZeihjopYXQU10gMwIKr87yDAq-_z2LKi0BcdhNEc,2365
|
|
14
14
|
vantage6/cli/algorithm/create.py,sha256=2Ks0JnWNldsn9Eg2h_lqn-yIMaJ-OYs-B3cv58tCiIs,1628
|
|
15
15
|
vantage6/cli/algorithm/update.py,sha256=qN1YzUK5oiBvDepQOvUGpSVxf_eGaD1DRjh522ythE8,1224
|
|
16
|
-
vantage6/cli/algostore/attach.py,sha256=
|
|
16
|
+
vantage6/cli/algostore/attach.py,sha256=jZAfqiKS0TFYthpE6O53DthzD2HFVOO-ozm21IQEKTU,1540
|
|
17
17
|
vantage6/cli/algostore/files.py,sha256=r89VRixK_K-c44qseq58Aa2Dqf1wEf8yompQRN5AVu4,580
|
|
18
18
|
vantage6/cli/algostore/list.py,sha256=owBrU52ANp8oE68Rk1Hhd6yNYqWX-7uREtmCok_wndg,417
|
|
19
|
-
vantage6/cli/algostore/new.py,sha256=
|
|
19
|
+
vantage6/cli/algostore/new.py,sha256=b8ZCEC46GZfImooQTShuKz5uff3ypREym4dICnmQ9dA,2017
|
|
20
20
|
vantage6/cli/algostore/remove.py,sha256=ieQLpo2ZpblpPxaeRXdB7IO0DzTtURnveYQltW7TTSw,1643
|
|
21
21
|
vantage6/cli/algostore/start.py,sha256=lkijG7K5TymXpZqVLhrW-YPhBmex_8T6WSLSruj64PQ,3169
|
|
22
22
|
vantage6/cli/algostore/stop.py,sha256=8g5DlISUXTf7abs4BTi2b2XOsuKWTwUGuCPIOMgSAeA,1835
|
|
23
23
|
vantage6/cli/common/decorator.py,sha256=7Iwlcc_ekgXJco4tNjEV79ul43Q28OrieiGkvDBeGeE,3625
|
|
24
24
|
vantage6/cli/common/start.py,sha256=tjz61lQ9yYf-ZAow_Zm3J17oJVDLSLBdxhfR8Wb9eoo,9255
|
|
25
|
-
vantage6/cli/common/utils.py,sha256=
|
|
25
|
+
vantage6/cli/common/utils.py,sha256=Hzb0v0hywa_4IawZzAa3sPVVNo5n5Hq3mIhXT_N_kgk,4468
|
|
26
26
|
vantage6/cli/context/__init__.py,sha256=e8rfY2tCyu6_SLQ-rbVzEHkDtmbnGCZRHFN_HH-2bnA,2683
|
|
27
27
|
vantage6/cli/context/algorithm_store.py,sha256=NsmrgDCTJ10KqQ209Q1sq-hBhuU_4LRqfbj3SZ-ivnU,3938
|
|
28
28
|
vantage6/cli/context/base_server.py,sha256=paKSzNrKWD-J6eakHAtGELk2cD05A8NqoCAuQfF7c2s,2972
|
|
29
29
|
vantage6/cli/context/node.py,sha256=lfaPlb8llgOR-fUG8VFebzh0IEynROyFN1HAg6p9gI0,7438
|
|
30
30
|
vantage6/cli/context/server.py,sha256=vBGJWNsJoVcIryX5OLiWnFklNRcjOVkhqm2U5tqW5b0,3946
|
|
31
|
-
vantage6/cli/dev/create.py,sha256=
|
|
31
|
+
vantage6/cli/dev/create.py,sha256=E13qE0EXvmQeISzvunKJZcSKvi6TZV_MEK9HxMjlD3g,19197
|
|
32
32
|
vantage6/cli/dev/remove.py,sha256=1ZX5L3bqTsRUt8PkXUvH7tgSLR32viZ5Ve_Q1k-sQ5M,3055
|
|
33
|
-
vantage6/cli/dev/start.py,sha256=
|
|
33
|
+
vantage6/cli/dev/start.py,sha256=fUMoPAEpmXoDAJidAmjIziaHZX1yqEErcrTKEXqPik8,4471
|
|
34
34
|
vantage6/cli/dev/stop.py,sha256=gPy87r8T3nqe7RFJjlYE9Bns8N3RiPPcdzNIFCoqGRY,1430
|
|
35
35
|
vantage6/cli/dev/utils.py,sha256=DOTwPVXKZWhJfto9FG7EFgMhMaFJHXuhLDSlBCUCR1o,888
|
|
36
36
|
vantage6/cli/dev/data/olympic_athletes_2016.csv,sha256=WGycwcwMKEyOyJc3aEo4EhrnBJiTSE0kZAr50j2qzGk,77699
|
|
37
|
-
vantage6/cli/node/attach.py,sha256=
|
|
37
|
+
vantage6/cli/node/attach.py,sha256=UYISJDBjVE0p7Y6rZPviN8AWh7f5TVPb-CEA0t4NRiM,2203
|
|
38
38
|
vantage6/cli/node/clean.py,sha256=9W9PaVILx8SnmB2lymw23KJeQmH5nFcX79QHcEOvo0A,1124
|
|
39
|
-
vantage6/cli/node/create_private_key.py,sha256=
|
|
39
|
+
vantage6/cli/node/create_private_key.py,sha256=yciL1DtACxrBeEGxeaDi0NefDTvegG6s4rr5jA9J5TY,5207
|
|
40
40
|
vantage6/cli/node/files.py,sha256=V7bJeR8weX0Llpp6y9wQoNrRsvlotEE6e70aTJp9j6M,1331
|
|
41
41
|
vantage6/cli/node/list.py,sha256=_WZ8EBIEUlzFhVp3cR2MK5FUuQicMEZHhD8npMwKSpM,1664
|
|
42
|
-
vantage6/cli/node/new.py,sha256=
|
|
42
|
+
vantage6/cli/node/new.py,sha256=fGtdaRwWeWM-MmU9LUzzClkGqzkcEXyWi5KgkH18k4s,1931
|
|
43
43
|
vantage6/cli/node/remove.py,sha256=Al1XALUwciOU6zIRQB2D9EggUdvtU23laOZTWyYKKvc,3552
|
|
44
|
-
vantage6/cli/node/
|
|
45
|
-
vantage6/cli/node/
|
|
44
|
+
vantage6/cli/node/restart.py,sha256=PM6R_vpCfxEa6GPbd_dqZftunfgg6FjgC9Lh0tdsi-w,3570
|
|
45
|
+
vantage6/cli/node/set_api_key.py,sha256=OYzXa6XvadPGG9aFlh1vTBnYk2vi64ltN7iLCQ3h3Bw,1755
|
|
46
|
+
vantage6/cli/node/start.py,sha256=90MsuZgDNsi6-_3nQgDGvYavH5Hms2SMrNrboycpYsY,12026
|
|
46
47
|
vantage6/cli/node/stop.py,sha256=nassaUq5qVuyRdoNrP_PAbq-l-X1tKUU_UwlYx08e54,3946
|
|
47
48
|
vantage6/cli/node/version.py,sha256=eYJ4ayQsEsHPL00V88UY1LhmlnQCzF-Te4lrw4SFbHQ,1836
|
|
48
|
-
vantage6/cli/node/common/__init__.py,sha256=
|
|
49
|
+
vantage6/cli/node/common/__init__.py,sha256=OPQa-nXdG2VWit10leJGmQeVq1PQ_EN1_U_LG_ZC58I,3055
|
|
49
50
|
vantage6/cli/rabbitmq/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
51
|
vantage6/cli/rabbitmq/definitions.py,sha256=CcS9jG7ZGB6LjzHQqZ2FliDurPItUvNSjHrOYptORZg,637
|
|
51
52
|
vantage6/cli/rabbitmq/queue_manager.py,sha256=KGDGHy4NBN8O9xhjzfI7mh65i9lOQIqQwrOFqvGFdHI,7545
|
|
52
53
|
vantage6/cli/rabbitmq/rabbitmq.config,sha256=LYAQAEoXaF472XeJDYXc9JfWSETIzPRIR2W-JB2i7fU,136
|
|
53
|
-
vantage6/cli/server/attach.py,sha256=
|
|
54
|
+
vantage6/cli/server/attach.py,sha256=mRc54Eto063-3OdY-wmsj10i08kCv8TMDcy2k9pik5E,2002
|
|
54
55
|
vantage6/cli/server/files.py,sha256=LJhFyYHcEnCgFhVAM-lX6_EnfhMJ7YPdN21kVIpmwkc,507
|
|
55
56
|
vantage6/cli/server/import_.py,sha256=mp6DgHzmRXd_M_507QPJOp0IiAtbXJY4V0IZxdkY0Lg,4516
|
|
56
57
|
vantage6/cli/server/list.py,sha256=qxBaUFmkP2tNNo9cuZB5OsVg3KD_c9KJDSTC4cxuUOM,404
|
|
57
|
-
vantage6/cli/server/new.py,sha256=
|
|
58
|
+
vantage6/cli/server/new.py,sha256=jJP9kBvdd0j2Ge36bMpiKhiHGU-STLTb4DVcHMlb-48,1986
|
|
58
59
|
vantage6/cli/server/remove.py,sha256=6tfKfVa5dYnZAKQYo_VlGZTuiugi7sh2F3U2cZ7mCmQ,1627
|
|
59
60
|
vantage6/cli/server/shell.py,sha256=9b_koFmBQRQYIK57usm75hZAaIF4msicLTu55dYHlzM,1583
|
|
60
61
|
vantage6/cli/server/start.py,sha256=4EnRl72Ub72UpcKQCmi9Utrczbts0r0DWLf-BHqy4_4,7735
|
|
@@ -68,8 +69,8 @@ vantage6/cli/template/server_import_config.j2,sha256=9WT2XeG9-ADoYLb4ahXhof3i9Fc
|
|
|
68
69
|
vantage6/cli/test/feature_tester.py,sha256=rdxRvDelVuOceXvbZh5dRc5Pdw4bVNiotj0m__RWN5Q,2563
|
|
69
70
|
vantage6/cli/test/integration_test.py,sha256=yQVG72XKDNH_eOPTsf3pb65FCBwJzMxn5VNfUGemJBM,3808
|
|
70
71
|
vantage6/cli/test/common/diagnostic_runner.py,sha256=x_4ikihgoSTKI914pqlgVziBSg5LpV6MheO6O_GBCeA,6657
|
|
71
|
-
vantage6-4.
|
|
72
|
-
vantage6-4.
|
|
73
|
-
vantage6-4.
|
|
74
|
-
vantage6-4.
|
|
75
|
-
vantage6-4.
|
|
72
|
+
vantage6-4.9.0.dist-info/METADATA,sha256=JZM3WLLUgZ9Oy49syNhL-6n0StYKWFeT_rMZV6Z8AqM,10878
|
|
73
|
+
vantage6-4.9.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
74
|
+
vantage6-4.9.0.dist-info/entry_points.txt,sha256=YFBvwjxoeAGxYyPC-YevEgOBBYRGaXkS6jiOGGCLNy0,157
|
|
75
|
+
vantage6-4.9.0.dist-info/top_level.txt,sha256=CYDIBS8jEfFq5YCs_Fuit54K9-3wdosZppTrsymIoUk,19
|
|
76
|
+
vantage6-4.9.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|