vantage6 5.0.0a7__tar.gz → 5.0.0a14__tar.gz
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.
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/PKG-INFO +1 -1
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/setup.py +1 -1
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/tests_cli/test_node_cli.py +4 -21
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/tests_cli/test_server_cli.py +33 -12
- vantage6-5.0.0a14/vantage6/cli/__build__ +1 -0
- vantage6-5.0.0a14/vantage6/cli/algostore/attach.py +13 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/algostore/list.py +1 -1
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/algostore/start.py +2 -2
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/algostore/stop.py +1 -1
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/cli.py +4 -11
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/common/utils.py +25 -3
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/configuration_manager.py +1 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/context/algorithm_store.py +1 -1
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/context/node.py +1 -1
- vantage6-5.0.0a14/vantage6/cli/node/attach.py +13 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/node/common/__init__.py +1 -1
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/node/start.py +2 -2
- vantage6-5.0.0a14/vantage6/cli/server/attach.py +13 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/server/import_.py +4 -1
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/server/list.py +2 -1
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/server/shell.py +1 -1
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/server/start.py +5 -2
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/server/stop.py +2 -2
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/server/version.py +2 -2
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/template/algo_store_config.j2 +1 -1
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/template/node_config.j2 +1 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/template/server_config.j2 +1 -1
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/test/common/diagnostic_runner.py +2 -4
- vantage6-5.0.0a14/vantage6/cli/test/integration_test.py +122 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6.egg-info/PKG-INFO +1 -1
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6.egg-info/SOURCES.txt +0 -5
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6.egg-info/requires.txt +3 -3
- vantage6-5.0.0a7/vantage6/cli/__build__ +0 -1
- vantage6-5.0.0a7/vantage6/cli/algostore/attach.py +0 -49
- vantage6-5.0.0a7/vantage6/cli/dev/create.py +0 -633
- vantage6-5.0.0a7/vantage6/cli/dev/remove.py +0 -94
- vantage6-5.0.0a7/vantage6/cli/dev/start.py +0 -123
- vantage6-5.0.0a7/vantage6/cli/dev/stop.py +0 -47
- vantage6-5.0.0a7/vantage6/cli/dev/utils.py +0 -24
- vantage6-5.0.0a7/vantage6/cli/node/attach.py +0 -74
- vantage6-5.0.0a7/vantage6/cli/server/attach.py +0 -63
- vantage6-5.0.0a7/vantage6/cli/test/integration_test.py +0 -122
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/setup.cfg +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/tests_cli/__init__.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/tests_cli/test_example.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/tests_cli/test_wizard.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/__init__.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/_version.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/algorithm/create.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/algorithm/update.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/algostore/files.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/algostore/new.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/algostore/remove.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/common/decorator.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/common/start.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/configuration_wizard.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/context/__init__.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/context/base_server.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/context/server.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/globals.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/node/clean.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/node/create_private_key.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/node/files.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/node/list.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/node/new.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/node/remove.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/node/restart.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/node/set_api_key.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/node/stop.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/node/version.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/rabbitmq/__init__.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/rabbitmq/definitions.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/rabbitmq/queue_manager.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/rabbitmq/rabbitmq.config +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/server/common/__init__.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/server/files.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/server/new.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/server/remove.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/template/server_import_config.j2 +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/test/feature_tester.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6/cli/utils.py +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6.egg-info/dependency_links.txt +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6.egg-info/entry_points.txt +0 -0
- {vantage6-5.0.0a7 → vantage6-5.0.0a14}/vantage6.egg-info/top_level.txt +0 -0
|
@@ -295,29 +295,12 @@ class NodeCLITest(unittest.TestCase):
|
|
|
295
295
|
result = runner.invoke(cli_node_restart, ["--name", "iknl"])
|
|
296
296
|
self.assertEqual(result.exit_code, 0)
|
|
297
297
|
|
|
298
|
-
@patch("vantage6.cli.node.attach.
|
|
299
|
-
|
|
300
|
-
@patch("docker.DockerClient.containers")
|
|
301
|
-
@patch("vantage6.cli.node.attach.check_docker_running", return_value=True)
|
|
302
|
-
def test_attach(self, check_docker, containers, log_worker, time_):
|
|
298
|
+
@patch("vantage6.cli.node.attach.attach_logs")
|
|
299
|
+
def test_attach(self, attach_logs):
|
|
303
300
|
"""Attach docker logs without errors."""
|
|
304
|
-
container1 = MagicMock()
|
|
305
|
-
container1.name = f"{APPNAME}-iknl-user"
|
|
306
|
-
containers.list.return_value = [container1]
|
|
307
|
-
|
|
308
|
-
log_worker.return_value = ""
|
|
309
|
-
time_.sleep.side_effect = KeyboardInterrupt()
|
|
310
|
-
|
|
311
301
|
runner = CliRunner()
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
self.assertEqual(
|
|
315
|
-
result.output,
|
|
316
|
-
"[info ] - Closing log file. Keyboard Interrupt.\n"
|
|
317
|
-
"[info ] - Note that your node is still running! Shut it down "
|
|
318
|
-
"with 'v6 node stop'\n",
|
|
319
|
-
)
|
|
320
|
-
self.assertEqual(result.exit_code, 0)
|
|
302
|
+
runner.invoke(cli_node_attach)
|
|
303
|
+
attach_logs.assert_called_once_with("app=node")
|
|
321
304
|
|
|
322
305
|
@patch("vantage6.cli.node.clean.q")
|
|
323
306
|
@patch("docker.DockerClient.volumes")
|
|
@@ -5,6 +5,7 @@ from pathlib import Path
|
|
|
5
5
|
from click.testing import CliRunner
|
|
6
6
|
|
|
7
7
|
from vantage6.common.globals import APPNAME, InstanceType
|
|
8
|
+
from vantage6.cli.common.utils import attach_logs
|
|
8
9
|
from vantage6.cli.server.start import cli_server_start
|
|
9
10
|
from vantage6.cli.server.list import cli_server_configuration_list
|
|
10
11
|
from vantage6.cli.server.files import cli_server_files
|
|
@@ -132,7 +133,7 @@ class ServerCLITest(unittest.TestCase):
|
|
|
132
133
|
"""Stop server without errors."""
|
|
133
134
|
|
|
134
135
|
container1 = MagicMock()
|
|
135
|
-
container1.name = f"{APPNAME}-iknl-system-{InstanceType.SERVER}"
|
|
136
|
+
container1.name = f"{APPNAME}-iknl-system-{InstanceType.SERVER.value}"
|
|
136
137
|
containers.containers.list.return_value = [container1]
|
|
137
138
|
|
|
138
139
|
runner = CliRunner()
|
|
@@ -141,18 +142,38 @@ class ServerCLITest(unittest.TestCase):
|
|
|
141
142
|
self.assertIsNone(result.exception)
|
|
142
143
|
self.assertEqual(result.exit_code, 0)
|
|
143
144
|
|
|
144
|
-
@patch("vantage6.cli.server.attach.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
"""Attach log to the console without errors."""
|
|
148
|
-
container1 = MagicMock()
|
|
149
|
-
container1.name = f"{APPNAME}-iknl-system-{InstanceType.SERVER}"
|
|
150
|
-
containers.list.return_value = [container1]
|
|
151
|
-
|
|
152
|
-
sleep.side_effect = KeyboardInterrupt("Boom!")
|
|
153
|
-
|
|
145
|
+
@patch("vantage6.cli.server.attach.attach_logs")
|
|
146
|
+
def test_attach(self, attach_logs):
|
|
147
|
+
"""Attach logs to the console without errors."""
|
|
154
148
|
runner = CliRunner()
|
|
155
|
-
result = runner.invoke(cli_server_attach
|
|
149
|
+
result = runner.invoke(cli_server_attach)
|
|
156
150
|
|
|
157
151
|
self.assertIsNone(result.exception)
|
|
158
152
|
self.assertEqual(result.exit_code, 0)
|
|
153
|
+
attach_logs.assert_called_once_with(
|
|
154
|
+
"app=vantage6-server", "component=vantage6-server"
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
@patch("vantage6.cli.common.utils.Popen")
|
|
158
|
+
def test_attach_logs(self, mock_popen):
|
|
159
|
+
# Mock the Popen instance and its methods
|
|
160
|
+
mock_process = mock_popen.return_value
|
|
161
|
+
mock_process.wait.return_value = None
|
|
162
|
+
|
|
163
|
+
# Call the function with a sample label
|
|
164
|
+
attach_logs("app=node", "env=dev")
|
|
165
|
+
|
|
166
|
+
# Construct the expected command
|
|
167
|
+
expected_command = [
|
|
168
|
+
"devspace",
|
|
169
|
+
"logs",
|
|
170
|
+
"--follow",
|
|
171
|
+
"--label-selector",
|
|
172
|
+
"app=node,env=dev",
|
|
173
|
+
]
|
|
174
|
+
|
|
175
|
+
# Verify that Popen was called with the expected command
|
|
176
|
+
mock_popen.assert_called_once_with(expected_command, stdout=None, stderr=None)
|
|
177
|
+
|
|
178
|
+
# Verify that wait was called on the process
|
|
179
|
+
mock_process.wait.assert_called_once()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
14
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from vantage6.common import info
|
|
4
|
+
from vantage6.cli.common.utils import attach_logs
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@click.command()
|
|
8
|
+
def cli_algo_store_attach() -> None:
|
|
9
|
+
"""
|
|
10
|
+
Show the store logs in the current console.
|
|
11
|
+
"""
|
|
12
|
+
info("Attaching to store logs...")
|
|
13
|
+
attach_logs("app=store", "component=store-server")
|
|
@@ -54,7 +54,7 @@ def cli_algo_store_start(
|
|
|
54
54
|
Start the algorithm store server.
|
|
55
55
|
"""
|
|
56
56
|
info("Starting algorithm store...")
|
|
57
|
-
docker_client = check_for_start(ctx, InstanceType.ALGORITHM_STORE)
|
|
57
|
+
docker_client = check_for_start(ctx, InstanceType.ALGORITHM_STORE.value)
|
|
58
58
|
|
|
59
59
|
image = get_image(image, ctx, "algorithm-store", DEFAULT_ALGO_STORE_IMAGE)
|
|
60
60
|
|
|
@@ -91,7 +91,7 @@ def cli_algo_store_start(
|
|
|
91
91
|
mounts=mounts,
|
|
92
92
|
detach=True,
|
|
93
93
|
labels={
|
|
94
|
-
f"{APPNAME}-type": InstanceType.ALGORITHM_STORE,
|
|
94
|
+
f"{APPNAME}-type": InstanceType.ALGORITHM_STORE.value,
|
|
95
95
|
"name": ctx.config_file_name,
|
|
96
96
|
},
|
|
97
97
|
environment=environment_vars,
|
|
@@ -23,7 +23,7 @@ def cli_algo_store_stop(ctx: AlgorithmStoreContext, all_stores: bool):
|
|
|
23
23
|
client = docker.from_env()
|
|
24
24
|
|
|
25
25
|
running_stores = client.containers.list(
|
|
26
|
-
filters={"label": f"{APPNAME}-type={InstanceType.ALGORITHM_STORE}"}
|
|
26
|
+
filters={"label": f"{APPNAME}-type={InstanceType.ALGORITHM_STORE.value}"}
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
if not running_stores:
|
|
@@ -22,14 +22,11 @@ from vantage6.cli.node.set_api_key import cli_node_set_api_key
|
|
|
22
22
|
from vantage6.cli.node.start import cli_node_start
|
|
23
23
|
from vantage6.cli.node.stop import cli_node_stop
|
|
24
24
|
from vantage6.cli.node.version import cli_node_version
|
|
25
|
-
from vantage6.cli.dev.create import create_demo_network
|
|
26
|
-
from vantage6.cli.dev.remove import remove_demo_network
|
|
27
|
-
from vantage6.cli.dev.start import start_demo_network
|
|
28
|
-
from vantage6.cli.dev.stop import stop_demo_network
|
|
29
25
|
from vantage6.cli.algorithm.create import cli_algorithm_create
|
|
30
26
|
from vantage6.cli.algorithm.update import cli_algorithm_update
|
|
31
27
|
from vantage6.cli.test.feature_tester import cli_test_features
|
|
32
|
-
|
|
28
|
+
|
|
29
|
+
# from vantage6.cli.test.integration_test import cli_test_integration
|
|
33
30
|
from vantage6.cli.algostore.attach import cli_algo_store_attach
|
|
34
31
|
from vantage6.cli.algostore.new import cli_algo_store_new
|
|
35
32
|
from vantage6.cli.algostore.start import cli_algo_store_start
|
|
@@ -93,11 +90,7 @@ def cli_dev() -> None:
|
|
|
93
90
|
"""
|
|
94
91
|
|
|
95
92
|
|
|
96
|
-
#
|
|
97
|
-
cli_dev.add_command(create_demo_network, name="create-demo-network")
|
|
98
|
-
cli_dev.add_command(remove_demo_network, name="remove-demo-network")
|
|
99
|
-
cli_dev.add_command(start_demo_network, name="start-demo-network")
|
|
100
|
-
cli_dev.add_command(stop_demo_network, name="stop-demo-network")
|
|
93
|
+
# TODO add commands for the dev group
|
|
101
94
|
|
|
102
95
|
|
|
103
96
|
# Define the algorithm group
|
|
@@ -123,7 +116,7 @@ def cli_test() -> None:
|
|
|
123
116
|
|
|
124
117
|
# Define the commands for the test group
|
|
125
118
|
cli_test.add_command(cli_test_features, name="feature-test")
|
|
126
|
-
cli_test.add_command(cli_test_integration, name="integration-test")
|
|
119
|
+
# cli_test.add_command(cli_test_integration, name="integration-test")
|
|
127
120
|
|
|
128
121
|
|
|
129
122
|
# Define the algorithm-store group
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import enum
|
|
1
2
|
import questionary as q
|
|
2
3
|
from colorama import Fore, Style
|
|
3
4
|
import click
|
|
4
5
|
from typing import Iterable
|
|
5
6
|
import docker
|
|
7
|
+
from subprocess import Popen
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
from vantage6.common import warning, error
|
|
@@ -87,7 +89,11 @@ def get_server_configuration_list(instance_type: InstanceType.SERVER) -> None:
|
|
|
87
89
|
client = docker.from_env()
|
|
88
90
|
ctx_class = select_context_class(instance_type)
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
instance_type_value = (
|
|
93
|
+
instance_type.value if isinstance(instance_type, enum.Enum) else instance_type
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
running_server_names = get_running_servers(client, instance_type_value)
|
|
91
97
|
header = "\nName" + (21 * " ") + "Status" + (10 * " ") + "System/User"
|
|
92
98
|
|
|
93
99
|
click.echo(header)
|
|
@@ -101,7 +107,8 @@ def get_server_configuration_list(instance_type: InstanceType.SERVER) -> None:
|
|
|
101
107
|
for config in configs:
|
|
102
108
|
status = (
|
|
103
109
|
running
|
|
104
|
-
if f"{APPNAME}-{config.name}-system-{
|
|
110
|
+
if f"{APPNAME}-{config.name}-system-{instance_type_value}"
|
|
111
|
+
in running_server_names
|
|
105
112
|
else stopped
|
|
106
113
|
)
|
|
107
114
|
click.echo(f"{config.name:25}" f"{status:25} System ")
|
|
@@ -111,7 +118,8 @@ def get_server_configuration_list(instance_type: InstanceType.SERVER) -> None:
|
|
|
111
118
|
for config in configs:
|
|
112
119
|
status = (
|
|
113
120
|
running
|
|
114
|
-
if f"{APPNAME}-{config.name}-user-{
|
|
121
|
+
if f"{APPNAME}-{config.name}-user-{instance_type_value}"
|
|
122
|
+
in running_server_names
|
|
115
123
|
else stopped
|
|
116
124
|
)
|
|
117
125
|
click.echo(f"{config.name:25}" f"{status:25} User ")
|
|
@@ -158,3 +166,17 @@ def get_name_from_container_name(container_name: str) -> str:
|
|
|
158
166
|
# Container name is structured as: f"{APPNAME}-{name}-{post_fix}"
|
|
159
167
|
# Take into account that name can contain '-'
|
|
160
168
|
return "-".join(container_name.split("-")[1:-1])
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def attach_logs(*labels: list[str]) -> None:
|
|
172
|
+
"""
|
|
173
|
+
Attach to the logs of the given labels.
|
|
174
|
+
|
|
175
|
+
Parameters
|
|
176
|
+
----------
|
|
177
|
+
labels : list[str]
|
|
178
|
+
The labels to attach to
|
|
179
|
+
"""
|
|
180
|
+
command = ["devspace", "logs", "--follow", "--label-selector", ",".join(labels)]
|
|
181
|
+
process = Popen(command, stdout=None, stderr=None)
|
|
182
|
+
process.wait()
|
|
@@ -53,7 +53,7 @@ class AlgorithmStoreContext(BaseServerContext):
|
|
|
53
53
|
str
|
|
54
54
|
Server's docker container name
|
|
55
55
|
"""
|
|
56
|
-
return f"{APPNAME}-{self.name}-{self.scope}-{ServerType.ALGORITHM_STORE}"
|
|
56
|
+
return f"{APPNAME}-{self.name}-{self.scope}-{ServerType.ALGORITHM_STORE.value}"
|
|
57
57
|
|
|
58
58
|
@classmethod
|
|
59
59
|
def from_external_config_file(
|
|
@@ -136,7 +136,7 @@ class NodeContext(AppContext):
|
|
|
136
136
|
Path
|
|
137
137
|
Path to the data folder
|
|
138
138
|
"""
|
|
139
|
-
return AppContext.type_data_folder(InstanceType.NODE, system_folders)
|
|
139
|
+
return AppContext.type_data_folder(InstanceType.NODE.value, system_folders)
|
|
140
140
|
|
|
141
141
|
@property
|
|
142
142
|
def databases(self) -> dict:
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from vantage6.common import info
|
|
4
|
+
from vantage6.cli.common.utils import attach_logs
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@click.command()
|
|
8
|
+
def cli_node_attach() -> None:
|
|
9
|
+
"""
|
|
10
|
+
Show the node logs in the current console.
|
|
11
|
+
"""
|
|
12
|
+
info("Attaching to node logs...")
|
|
13
|
+
attach_logs("app=node")
|
|
@@ -130,6 +130,6 @@ def find_running_node_names(client: docker.DockerClient) -> list[str]:
|
|
|
130
130
|
List of names of running nodes
|
|
131
131
|
"""
|
|
132
132
|
running_nodes = client.containers.list(
|
|
133
|
-
filters={"label": f"{APPNAME}-type={InstanceType.NODE}"}
|
|
133
|
+
filters={"label": f"{APPNAME}-type={InstanceType.NODE.value}"}
|
|
134
134
|
)
|
|
135
135
|
return [node.name for node in running_nodes]
|
|
@@ -78,7 +78,7 @@ def cli_node_start(
|
|
|
78
78
|
|
|
79
79
|
# check that this node is not already running
|
|
80
80
|
running_nodes = docker_client.containers.list(
|
|
81
|
-
filters={"label": f"{APPNAME}-type={InstanceType.NODE}"}
|
|
81
|
+
filters={"label": f"{APPNAME}-type={InstanceType.NODE.value}"}
|
|
82
82
|
)
|
|
83
83
|
|
|
84
84
|
suffix = "system" if system_folders else "user"
|
|
@@ -306,7 +306,7 @@ def cli_node_start(
|
|
|
306
306
|
volumes=volumes,
|
|
307
307
|
detach=True,
|
|
308
308
|
labels={
|
|
309
|
-
f"{APPNAME}-type": InstanceType.NODE,
|
|
309
|
+
f"{APPNAME}-type": InstanceType.NODE.value,
|
|
310
310
|
"system": str(system_folders),
|
|
311
311
|
"name": ctx.config_file_name,
|
|
312
312
|
},
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from vantage6.common import info
|
|
4
|
+
from vantage6.cli.common.utils import attach_logs
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@click.command()
|
|
8
|
+
def cli_server_attach() -> None:
|
|
9
|
+
"""
|
|
10
|
+
Show the server logs in the current console.
|
|
11
|
+
"""
|
|
12
|
+
info("Attaching to server logs...")
|
|
13
|
+
attach_logs("app=vantage6-server", "component=vantage6-server")
|
|
@@ -132,7 +132,10 @@ def cli_server_import(
|
|
|
132
132
|
command=cmd,
|
|
133
133
|
mounts=mounts,
|
|
134
134
|
detach=True,
|
|
135
|
-
labels={
|
|
135
|
+
labels={
|
|
136
|
+
f"{APPNAME}-type": InstanceType.SERVER.value,
|
|
137
|
+
"name": ctx.config_file_name,
|
|
138
|
+
},
|
|
136
139
|
environment=environment_vars,
|
|
137
140
|
auto_remove=not keep,
|
|
138
141
|
tty=True,
|
|
@@ -28,7 +28,7 @@ def cli_server_shell(ctx: ServerContext) -> None:
|
|
|
28
28
|
docker_client = docker.from_env()
|
|
29
29
|
|
|
30
30
|
running_servers = docker_client.containers.list(
|
|
31
|
-
filters={"label": f"{APPNAME}-type={InstanceType.SERVER}"}
|
|
31
|
+
filters={"label": f"{APPNAME}-type={InstanceType.SERVER.value}"}
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
if ctx.docker_container_name not in [s.name for s in running_servers]:
|
|
@@ -83,7 +83,7 @@ def cli_server_start(
|
|
|
83
83
|
Start the server.
|
|
84
84
|
"""
|
|
85
85
|
info("Starting server...")
|
|
86
|
-
docker_client = check_for_start(ctx, InstanceType.SERVER)
|
|
86
|
+
docker_client = check_for_start(ctx, InstanceType.SERVER.value)
|
|
87
87
|
|
|
88
88
|
image = get_image(image, ctx, "server", DEFAULT_SERVER_IMAGE)
|
|
89
89
|
|
|
@@ -157,7 +157,10 @@ def cli_server_start(
|
|
|
157
157
|
command=cmd,
|
|
158
158
|
mounts=mounts,
|
|
159
159
|
detach=True,
|
|
160
|
-
labels={
|
|
160
|
+
labels={
|
|
161
|
+
f"{APPNAME}-type": InstanceType.SERVER.value,
|
|
162
|
+
"name": ctx.config_file_name,
|
|
163
|
+
},
|
|
161
164
|
environment=environment_vars,
|
|
162
165
|
ports={f"{internal_port}/tcp": (ip, port_)},
|
|
163
166
|
name=ctx.docker_container_name,
|
|
@@ -37,7 +37,7 @@ def cli_server_stop(name: str, system_folders: bool, all_servers: bool):
|
|
|
37
37
|
client = docker.from_env()
|
|
38
38
|
|
|
39
39
|
running_servers = client.containers.list(
|
|
40
|
-
filters={"label": f"{APPNAME}-type={InstanceType.SERVER}"}
|
|
40
|
+
filters={"label": f"{APPNAME}-type={InstanceType.SERVER.value}"}
|
|
41
41
|
)
|
|
42
42
|
|
|
43
43
|
if not running_servers:
|
|
@@ -62,7 +62,7 @@ def cli_server_stop(name: str, system_folders: bool, all_servers: bool):
|
|
|
62
62
|
return
|
|
63
63
|
else:
|
|
64
64
|
post_fix = "system" if system_folders else "user"
|
|
65
|
-
container_name = f"{APPNAME}-{name}-{post_fix}-{InstanceType.SERVER}"
|
|
65
|
+
container_name = f"{APPNAME}-{name}-{post_fix}-{InstanceType.SERVER.value}"
|
|
66
66
|
|
|
67
67
|
if container_name not in running_server_names:
|
|
68
68
|
error(f"{Fore.RED}{name}{Style.RESET_ALL} is not running!")
|
|
@@ -22,10 +22,10 @@ def cli_server_version(name: str, system_folders: bool) -> None:
|
|
|
22
22
|
check_docker_running()
|
|
23
23
|
client = docker.from_env()
|
|
24
24
|
|
|
25
|
-
running_server_names = get_running_servers(client, InstanceType.SERVER)
|
|
25
|
+
running_server_names = get_running_servers(client, InstanceType.SERVER.value)
|
|
26
26
|
|
|
27
27
|
name = get_server_name(
|
|
28
|
-
name, system_folders, running_server_names, InstanceType.SERVER
|
|
28
|
+
name, system_folders, running_server_names, InstanceType.SERVER.value
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
if name in running_server_names:
|
|
@@ -97,9 +97,7 @@ class DiagnosticRunner:
|
|
|
97
97
|
name="test",
|
|
98
98
|
description="Basic Diagnostic test",
|
|
99
99
|
image=DIAGNOSTICS_IMAGE,
|
|
100
|
-
|
|
101
|
-
"method": "base_features",
|
|
102
|
-
},
|
|
100
|
+
method="base_features",
|
|
103
101
|
organizations=self.organization_ids,
|
|
104
102
|
databases=[{"label": "default"}],
|
|
105
103
|
)
|
|
@@ -123,8 +121,8 @@ class DiagnosticRunner:
|
|
|
123
121
|
name="test",
|
|
124
122
|
description="VPN Diagnostic test",
|
|
125
123
|
image=DIAGNOSTICS_IMAGE,
|
|
124
|
+
method="vpn_features",
|
|
126
125
|
input_={
|
|
127
|
-
"method": "vpn_features",
|
|
128
126
|
"kwargs": {"other_nodes": self.organization_ids},
|
|
129
127
|
},
|
|
130
128
|
organizations=self.organization_ids,
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# from pathlib import Path
|
|
2
|
+
# import click
|
|
3
|
+
|
|
4
|
+
# from vantage6.common.globals import Ports
|
|
5
|
+
# from vantage6.cli.utils import info
|
|
6
|
+
# from vantage6.cli.dev.create import create_demo_network
|
|
7
|
+
# from vantage6.cli.dev.start import start_demo_network
|
|
8
|
+
# from vantage6.cli.dev.stop import stop_demo_network
|
|
9
|
+
# from vantage6.cli.dev.remove import remove_demo_network
|
|
10
|
+
# from vantage6.cli.utils import prompt_config_name, check_config_name_allowed
|
|
11
|
+
# from vantage6.cli.test.feature_tester import cli_test_features
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# @click.command()
|
|
15
|
+
# @click.option(
|
|
16
|
+
# "-n", "--name", default=None, type=str, help="Name for your development setup"
|
|
17
|
+
# )
|
|
18
|
+
# @click.option(
|
|
19
|
+
# "--server-url",
|
|
20
|
+
# type=str,
|
|
21
|
+
# default="http://host.docker.internal",
|
|
22
|
+
# help="Server URL to point to. If you are using Docker Desktop, "
|
|
23
|
+
# "the default http://host.docker.internal should not be changed.",
|
|
24
|
+
# )
|
|
25
|
+
# @click.option(
|
|
26
|
+
# "-i", "--image", type=str, default=None, help="Server Docker image to use"
|
|
27
|
+
# )
|
|
28
|
+
# @click.option(
|
|
29
|
+
# "--keep",
|
|
30
|
+
# type=bool,
|
|
31
|
+
# default=False,
|
|
32
|
+
# help="Keep the dev network after finishing the test",
|
|
33
|
+
# )
|
|
34
|
+
# @click.option(
|
|
35
|
+
# "--extra-server-config",
|
|
36
|
+
# type=click.Path(exists=True),
|
|
37
|
+
# default=None,
|
|
38
|
+
# help="YAML File with additional server "
|
|
39
|
+
# "configuration. This will be appended to the server "
|
|
40
|
+
# "configuration file",
|
|
41
|
+
# )
|
|
42
|
+
# @click.option(
|
|
43
|
+
# "--extra-node-config",
|
|
44
|
+
# type=click.Path("rb"),
|
|
45
|
+
# default=None,
|
|
46
|
+
# help="YAML File with additional node configuration. This will be"
|
|
47
|
+
# " appended to each of the node configuration files",
|
|
48
|
+
# )
|
|
49
|
+
# @click.pass_context
|
|
50
|
+
# def cli_test_integration(
|
|
51
|
+
# click_ctx: click.Context,
|
|
52
|
+
# name: str,
|
|
53
|
+
# server_url: str,
|
|
54
|
+
# image: str,
|
|
55
|
+
# keep: bool = False,
|
|
56
|
+
# extra_server_config: Path = None,
|
|
57
|
+
# extra_node_config: Path = None,
|
|
58
|
+
# ) -> list[dict]:
|
|
59
|
+
# """
|
|
60
|
+
# Create dev network and run diagnostic checks on it.
|
|
61
|
+
|
|
62
|
+
# This is a full integration test of the vantage6 network. It will create
|
|
63
|
+
# a test server with some nodes using the `vdev` commands, and then run the
|
|
64
|
+
# v6-diagnostics algorithm to test all functionality.
|
|
65
|
+
# """
|
|
66
|
+
# # get name for the development setup - if not given - and check if it is
|
|
67
|
+
# # allowed
|
|
68
|
+
# name = prompt_config_name(name)
|
|
69
|
+
# check_config_name_allowed(name)
|
|
70
|
+
|
|
71
|
+
# # create server & node configurations and create test resources (
|
|
72
|
+
# # collaborations, organizations, etc)
|
|
73
|
+
# click_ctx.invoke(
|
|
74
|
+
# create_demo_network,
|
|
75
|
+
# name=name,
|
|
76
|
+
# num_nodes=3,
|
|
77
|
+
# server_url=server_url,
|
|
78
|
+
# server_port=Ports.DEV_SERVER.value,
|
|
79
|
+
# image=image,
|
|
80
|
+
# extra_server_config=extra_server_config,
|
|
81
|
+
# extra_node_config=extra_node_config,
|
|
82
|
+
# )
|
|
83
|
+
|
|
84
|
+
# # start the server and nodes
|
|
85
|
+
# click_ctx.invoke(
|
|
86
|
+
# start_demo_network,
|
|
87
|
+
# name=name,
|
|
88
|
+
# server_image=image,
|
|
89
|
+
# node_image=image,
|
|
90
|
+
# )
|
|
91
|
+
|
|
92
|
+
# # run the diagnostic tests
|
|
93
|
+
# # TODO the username and password should be coordinated with the vdev
|
|
94
|
+
# # command - at present it spits out this username/password combination by
|
|
95
|
+
# # default but both should be defined in the same place
|
|
96
|
+
# # TODO VPN testing is always excluded - allow to include it with a flag
|
|
97
|
+
# # when vdev commands can handle extra config parameters
|
|
98
|
+
# diagnose_results = click_ctx.invoke(
|
|
99
|
+
# cli_test_features,
|
|
100
|
+
# host="http://localhost",
|
|
101
|
+
# port=Ports.DEV_SERVER.value,
|
|
102
|
+
# api_path="/api",
|
|
103
|
+
# username="dev_admin",
|
|
104
|
+
# password="password",
|
|
105
|
+
# collaboration=1,
|
|
106
|
+
# organizations=None,
|
|
107
|
+
# all_nodes=True,
|
|
108
|
+
# online_only=False,
|
|
109
|
+
# no_vpn=True,
|
|
110
|
+
# )
|
|
111
|
+
|
|
112
|
+
# # clean up the test resources
|
|
113
|
+
# click_ctx.invoke(stop_demo_network, name=name)
|
|
114
|
+
# if not keep:
|
|
115
|
+
# click_ctx.invoke(remove_demo_network, name=name)
|
|
116
|
+
# else:
|
|
117
|
+
# info(
|
|
118
|
+
# f"Keeping the demo network {name}. You can start it with `v6 dev "
|
|
119
|
+
# "start-demo-network`"
|
|
120
|
+
# )
|
|
121
|
+
|
|
122
|
+
# return diagnose_results
|
|
@@ -35,11 +35,6 @@ vantage6/cli/context/algorithm_store.py
|
|
|
35
35
|
vantage6/cli/context/base_server.py
|
|
36
36
|
vantage6/cli/context/node.py
|
|
37
37
|
vantage6/cli/context/server.py
|
|
38
|
-
vantage6/cli/dev/create.py
|
|
39
|
-
vantage6/cli/dev/remove.py
|
|
40
|
-
vantage6/cli/dev/start.py
|
|
41
|
-
vantage6/cli/dev/stop.py
|
|
42
|
-
vantage6/cli/dev/utils.py
|
|
43
38
|
vantage6/cli/node/attach.py
|
|
44
39
|
vantage6/cli/node/clean.py
|
|
45
40
|
vantage6/cli/node/create_private_key.py
|
|
@@ -3,14 +3,14 @@ colorama==0.4.6
|
|
|
3
3
|
copier==9.2.0
|
|
4
4
|
docker==7.1.0
|
|
5
5
|
ipython==8.10.0
|
|
6
|
-
jinja2==3.1.
|
|
6
|
+
jinja2==3.1.6
|
|
7
7
|
pandas>=1.5.3
|
|
8
8
|
questionary==1.10.0
|
|
9
9
|
rich==13.5.2
|
|
10
10
|
schema==0.7.5
|
|
11
11
|
sqlalchemy==2.0.37
|
|
12
|
-
vantage6-common==5.0.
|
|
13
|
-
vantage6-client==5.0.
|
|
12
|
+
vantage6-common==5.0.0a14
|
|
13
|
+
vantage6-client==5.0.0a14
|
|
14
14
|
|
|
15
15
|
[dev]
|
|
16
16
|
coverage==6.4.4
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7
|