vantage6 5.0.0a7__py3-none-any.whl → 5.0.0a9__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 +4 -21
- tests_cli/test_server_cli.py +32 -11
- vantage6/cli/__build__ +1 -1
- vantage6/cli/algostore/attach.py +6 -42
- vantage6/cli/cli.py +4 -11
- vantage6/cli/common/utils.py +15 -0
- vantage6/cli/node/attach.py +5 -66
- vantage6/cli/server/attach.py +5 -55
- vantage6/cli/test/common/diagnostic_runner.py +2 -4
- vantage6/cli/test/integration_test.py +113 -113
- {vantage6-5.0.0a7.dist-info → vantage6-5.0.0a9.dist-info}/METADATA +3 -3
- {vantage6-5.0.0a7.dist-info → vantage6-5.0.0a9.dist-info}/RECORD +15 -20
- vantage6/cli/dev/create.py +0 -633
- vantage6/cli/dev/remove.py +0 -94
- vantage6/cli/dev/start.py +0 -123
- vantage6/cli/dev/stop.py +0 -47
- vantage6/cli/dev/utils.py +0 -24
- {vantage6-5.0.0a7.dist-info → vantage6-5.0.0a9.dist-info}/WHEEL +0 -0
- {vantage6-5.0.0a7.dist-info → vantage6-5.0.0a9.dist-info}/entry_points.txt +0 -0
- {vantage6-5.0.0a7.dist-info → vantage6-5.0.0a9.dist-info}/top_level.txt +0 -0
vantage6/cli/dev/remove.py
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import subprocess
|
|
2
|
-
import itertools
|
|
3
|
-
from shutil import rmtree
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
|
|
6
|
-
import click
|
|
7
|
-
|
|
8
|
-
from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
|
|
9
|
-
from vantage6.common import info
|
|
10
|
-
from vantage6.cli.context.server import ServerContext
|
|
11
|
-
from vantage6.cli.context.node import NodeContext
|
|
12
|
-
from vantage6.cli.server.remove import cli_server_remove
|
|
13
|
-
from vantage6.cli.utils import remove_file
|
|
14
|
-
from vantage6.common.globals import InstanceType
|
|
15
|
-
from vantage6.cli.dev.utils import get_dev_server_context
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@click.command()
|
|
19
|
-
@click.option("-n", "--name", default=None, help="Name of the configuration.")
|
|
20
|
-
@click.option(
|
|
21
|
-
"-c",
|
|
22
|
-
"--config",
|
|
23
|
-
default=None,
|
|
24
|
-
help="Path to configuration-file; overrides --name",
|
|
25
|
-
)
|
|
26
|
-
@click.pass_context
|
|
27
|
-
def remove_demo_network(
|
|
28
|
-
click_ctx: click.Context, name: str | None, config: str | None
|
|
29
|
-
) -> None:
|
|
30
|
-
"""Remove all related demo network files and folders.
|
|
31
|
-
|
|
32
|
-
Select a server configuration to remove that server and the nodes attached
|
|
33
|
-
to it.
|
|
34
|
-
"""
|
|
35
|
-
ctx = get_dev_server_context(config, name)
|
|
36
|
-
|
|
37
|
-
# remove the server
|
|
38
|
-
for handler in itertools.chain(ctx.log.handlers, ctx.log.root.handlers):
|
|
39
|
-
handler.close()
|
|
40
|
-
click_ctx.invoke(cli_server_remove, ctx=ctx, force=True)
|
|
41
|
-
|
|
42
|
-
# removing the server import config
|
|
43
|
-
info("Deleting demo import config file")
|
|
44
|
-
server_configs = ServerContext.instance_folders(
|
|
45
|
-
InstanceType.SERVER, ctx.name, system_folders=False
|
|
46
|
-
)
|
|
47
|
-
import_config_to_del = Path(server_configs["dev"]) / f"{ctx.name}.yaml"
|
|
48
|
-
remove_file(import_config_to_del, "import_configuration")
|
|
49
|
-
|
|
50
|
-
# also remove the server folder
|
|
51
|
-
server_configs = ServerContext.instance_folders(
|
|
52
|
-
InstanceType.SERVER, ctx.name, system_folders=False
|
|
53
|
-
)
|
|
54
|
-
server_folder = server_configs["data"]
|
|
55
|
-
if server_folder.is_dir():
|
|
56
|
-
rmtree(server_folder)
|
|
57
|
-
|
|
58
|
-
# remove the store folder
|
|
59
|
-
store_configs = AlgorithmStoreContext.instance_folders(
|
|
60
|
-
InstanceType.ALGORITHM_STORE, f"{ctx.name}_store", system_folders=False
|
|
61
|
-
)
|
|
62
|
-
store_folder = store_configs["data"]
|
|
63
|
-
if store_folder.is_dir():
|
|
64
|
-
rmtree(store_folder)
|
|
65
|
-
|
|
66
|
-
# remove the store config file
|
|
67
|
-
subprocess.run(
|
|
68
|
-
[
|
|
69
|
-
"v6",
|
|
70
|
-
"algorithm-store",
|
|
71
|
-
"remove",
|
|
72
|
-
"-n",
|
|
73
|
-
f"{ctx.name}_store",
|
|
74
|
-
"--force",
|
|
75
|
-
"--user",
|
|
76
|
-
]
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
# remove the nodes
|
|
80
|
-
configs, _ = NodeContext.available_configurations(system_folders=False)
|
|
81
|
-
node_names = [
|
|
82
|
-
config.name for config in configs if config.name.startswith(f"{ctx.name}_node_")
|
|
83
|
-
]
|
|
84
|
-
for name in node_names:
|
|
85
|
-
node_ctx = NodeContext(name, False)
|
|
86
|
-
for handler in itertools.chain(
|
|
87
|
-
node_ctx.log.handlers, node_ctx.log.root.handlers
|
|
88
|
-
):
|
|
89
|
-
handler.close()
|
|
90
|
-
subprocess.run(["v6", "node", "remove", "-n", name, "--user", "--force"])
|
|
91
|
-
|
|
92
|
-
# remove data files attached to the network
|
|
93
|
-
data_dirs_nodes = NodeContext.instance_folders("node", "", False)["dev"]
|
|
94
|
-
rmtree(Path(data_dirs_nodes / ctx.name))
|
vantage6/cli/dev/start.py
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import subprocess
|
|
2
|
-
import click
|
|
3
|
-
|
|
4
|
-
from vantage6.common import info
|
|
5
|
-
from vantage6.client import Client
|
|
6
|
-
from vantage6.cli.globals import COMMUNITY_STORE
|
|
7
|
-
from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
|
|
8
|
-
from vantage6.cli.context.node import NodeContext
|
|
9
|
-
from vantage6.cli.server.start import cli_server_start
|
|
10
|
-
from vantage6.cli.dev.utils import get_dev_server_context
|
|
11
|
-
from vantage6.common.globals import DEFAULT_API_PATH
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@click.command()
|
|
15
|
-
@click.option("-n", "--name", default=None, help="Name of the configuration.")
|
|
16
|
-
@click.option(
|
|
17
|
-
"-c",
|
|
18
|
-
"--config",
|
|
19
|
-
default=None,
|
|
20
|
-
help="Path to configuration-file; overrides --name",
|
|
21
|
-
)
|
|
22
|
-
@click.option(
|
|
23
|
-
"--server-image", type=str, default=None, help="Server Docker image to use"
|
|
24
|
-
)
|
|
25
|
-
@click.option("--node-image", type=str, default=None, help="Node Docker image to use")
|
|
26
|
-
@click.option(
|
|
27
|
-
"--store-image", type=str, default=None, help="Algorithm Store Docker image to use"
|
|
28
|
-
)
|
|
29
|
-
@click.pass_context
|
|
30
|
-
def start_demo_network(
|
|
31
|
-
click_ctx: click.Context,
|
|
32
|
-
name: str | None,
|
|
33
|
-
config: str | None,
|
|
34
|
-
server_image: str | None,
|
|
35
|
-
node_image: str | None,
|
|
36
|
-
store_image: str | None,
|
|
37
|
-
) -> None:
|
|
38
|
-
"""Starts running a demo-network.
|
|
39
|
-
|
|
40
|
-
Select a server configuration to run its demo network. You should choose a
|
|
41
|
-
server configuration that you created earlier for a demo network. If you
|
|
42
|
-
have not created a demo network, you can run `v6 dev create-demo-network` to
|
|
43
|
-
create one.
|
|
44
|
-
"""
|
|
45
|
-
ctx = get_dev_server_context(config, name)
|
|
46
|
-
|
|
47
|
-
# run the server
|
|
48
|
-
info("Starting server...")
|
|
49
|
-
click_ctx.invoke(
|
|
50
|
-
cli_server_start,
|
|
51
|
-
ctx=ctx,
|
|
52
|
-
ip=None,
|
|
53
|
-
port=None,
|
|
54
|
-
image=server_image,
|
|
55
|
-
start_ui=True,
|
|
56
|
-
ui_port=None,
|
|
57
|
-
start_rabbitmq=False,
|
|
58
|
-
rabbitmq_image=None,
|
|
59
|
-
keep=True,
|
|
60
|
-
mount_src="",
|
|
61
|
-
attach=False,
|
|
62
|
-
system_folders=False,
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
# run the store
|
|
66
|
-
info("Starting algorithm store...")
|
|
67
|
-
cmd = ["v6", "algorithm-store", "start", "--name", f"{ctx.name}_store", "--user"]
|
|
68
|
-
if store_image:
|
|
69
|
-
cmd.extend(["--image", store_image])
|
|
70
|
-
subprocess.run(cmd, check=True)
|
|
71
|
-
|
|
72
|
-
# run all nodes that belong to this server
|
|
73
|
-
configs, _ = NodeContext.available_configurations(system_folders=False)
|
|
74
|
-
node_names = [
|
|
75
|
-
config.name for config in configs if config.name.startswith(f"{ctx.name}_node_")
|
|
76
|
-
]
|
|
77
|
-
for name in node_names:
|
|
78
|
-
cmd = ["v6", "node", "start", "--name", name]
|
|
79
|
-
if node_image:
|
|
80
|
-
cmd.extend(["--image", node_image])
|
|
81
|
-
subprocess.run(cmd, check=True)
|
|
82
|
-
|
|
83
|
-
# now that both server and store have been started, couple them
|
|
84
|
-
info("Linking local algorithm store to server...")
|
|
85
|
-
store_ctxs, _ = AlgorithmStoreContext.available_configurations(system_folders=False)
|
|
86
|
-
store_ctx = [c for c in store_ctxs if c.name == f"{ctx.name}_store"][0]
|
|
87
|
-
client = Client(
|
|
88
|
-
"http://localhost",
|
|
89
|
-
ctx.config["port"],
|
|
90
|
-
ctx.config["api_path"],
|
|
91
|
-
log_level="warn",
|
|
92
|
-
)
|
|
93
|
-
# TODO these credentials are hardcoded and may change if changed elsewhere. Link
|
|
94
|
-
# them together so that they are guaranteed to be the same.
|
|
95
|
-
USERNAME = "dev_admin"
|
|
96
|
-
PASSWORD = "password"
|
|
97
|
-
client.authenticate(USERNAME, PASSWORD)
|
|
98
|
-
existing_stores = client.store.list().get("data", [])
|
|
99
|
-
existing_urls = [store["url"] for store in existing_stores]
|
|
100
|
-
api_path = store_ctx.config.get("api_path", DEFAULT_API_PATH)
|
|
101
|
-
local_store_url = f"http://localhost:{store_ctx.config['port']}{api_path}"
|
|
102
|
-
if not local_store_url in existing_urls:
|
|
103
|
-
client.store.create(
|
|
104
|
-
algorithm_store_url=local_store_url,
|
|
105
|
-
name="local store",
|
|
106
|
-
all_collaborations=True,
|
|
107
|
-
force=True, # required to link localhost store
|
|
108
|
-
)
|
|
109
|
-
# note that we do not need to register the user as root of the store: this is
|
|
110
|
-
# already handled in the store config file and is executed on store startup (and
|
|
111
|
-
# successful because server is already started up at that point)
|
|
112
|
-
info("Done!")
|
|
113
|
-
|
|
114
|
-
# link the community store also to the server
|
|
115
|
-
info("Linking community algorithm store to local server...")
|
|
116
|
-
if not COMMUNITY_STORE in existing_urls:
|
|
117
|
-
client.store.create(
|
|
118
|
-
algorithm_store_url=COMMUNITY_STORE,
|
|
119
|
-
name="Community store (read-only)",
|
|
120
|
-
all_collaborations=True,
|
|
121
|
-
force=True, # required to continue when linking localhost server
|
|
122
|
-
)
|
|
123
|
-
info("Done!")
|
vantage6/cli/dev/stop.py
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import click
|
|
2
|
-
|
|
3
|
-
from vantage6.cli.context.node import NodeContext
|
|
4
|
-
from vantage6.cli.server.stop import cli_server_stop
|
|
5
|
-
from vantage6.cli.node.stop import cli_node_stop
|
|
6
|
-
from vantage6.cli.algostore.stop import cli_algo_store_stop
|
|
7
|
-
from vantage6.cli.dev.utils import get_dev_server_context
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@click.command()
|
|
11
|
-
@click.option("-n", "--name", default=None, help="Name of the configuration.")
|
|
12
|
-
@click.option(
|
|
13
|
-
"-c",
|
|
14
|
-
"--config",
|
|
15
|
-
default=None,
|
|
16
|
-
help="Path to configuration-file; overrides --name",
|
|
17
|
-
)
|
|
18
|
-
@click.pass_context
|
|
19
|
-
def stop_demo_network(
|
|
20
|
-
click_ctx: click.Context, name: str | None, config: str | None
|
|
21
|
-
) -> None:
|
|
22
|
-
"""Stops a demo network's server and nodes.
|
|
23
|
-
|
|
24
|
-
Select a server configuration to stop that server and the nodes attached
|
|
25
|
-
to it.
|
|
26
|
-
"""
|
|
27
|
-
ctx = get_dev_server_context(config, name)
|
|
28
|
-
|
|
29
|
-
# stop the server
|
|
30
|
-
click_ctx.invoke(
|
|
31
|
-
cli_server_stop, name=ctx.name, system_folders=False, all_servers=False
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
# stop the algorithm store
|
|
35
|
-
click_ctx.invoke(
|
|
36
|
-
cli_algo_store_stop, name=f"{ctx.name}_store", system_folders=False
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
# stop the nodes
|
|
40
|
-
configs, _ = NodeContext.available_configurations(False)
|
|
41
|
-
node_names = [
|
|
42
|
-
config.name for config in configs if config.name.startswith(f"{ctx.name}_node_")
|
|
43
|
-
]
|
|
44
|
-
for name in node_names:
|
|
45
|
-
click_ctx.invoke(
|
|
46
|
-
cli_node_stop, name=name, system_folders=False, all_nodes=False, force=False
|
|
47
|
-
)
|
vantage6/cli/dev/utils.py
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
from vantage6.common.globals import InstanceType
|
|
2
|
-
from vantage6.cli.configuration_wizard import select_configuration_questionaire
|
|
3
|
-
from vantage6.cli.context import get_context
|
|
4
|
-
from vantage6.cli.context.server import ServerContext
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def get_dev_server_context(config: str | None, name: str | None) -> ServerContext:
|
|
8
|
-
"""
|
|
9
|
-
Get the server context for the development server.
|
|
10
|
-
|
|
11
|
-
Parameters
|
|
12
|
-
----------
|
|
13
|
-
config : str | None
|
|
14
|
-
Path to the configuration file. If None, the name will be used.
|
|
15
|
-
name : str | None
|
|
16
|
-
Name of the configuration. If None, a questionaire will be shown.
|
|
17
|
-
"""
|
|
18
|
-
if config:
|
|
19
|
-
return ServerContext.from_external_config_file(config)
|
|
20
|
-
if not name:
|
|
21
|
-
name = select_configuration_questionaire(
|
|
22
|
-
InstanceType.SERVER, system_folders=False
|
|
23
|
-
)
|
|
24
|
-
return get_context(InstanceType.SERVER, name, system_folders=False)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|