vantage6 5.0.0a33__py3-none-any.whl → 5.0.0a35__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.
- vantage6/cli/algostore/new.py +106 -47
- vantage6/cli/algostore/remove.py +18 -34
- vantage6/cli/algostore/start.py +36 -67
- vantage6/cli/algostore/stop.py +43 -46
- vantage6/cli/cli.py +31 -33
- vantage6/cli/common/new.py +85 -0
- vantage6/cli/common/remove.py +54 -0
- vantage6/cli/common/start.py +36 -213
- vantage6/cli/common/stop.py +78 -0
- vantage6/cli/common/utils.py +253 -16
- vantage6/cli/configuration_manager.py +90 -12
- vantage6/cli/configuration_wizard.py +49 -414
- vantage6/cli/context/algorithm_store.py +7 -6
- vantage6/cli/context/base_server.py +22 -30
- vantage6/cli/context/node.py +14 -17
- vantage6/cli/context/server.py +16 -7
- vantage6/cli/globals.py +29 -8
- vantage6/cli/node/attach.py +1 -0
- vantage6/cli/node/common/__init__.py +1 -1
- vantage6/cli/node/create_private_key.py +9 -6
- vantage6/cli/node/files.py +12 -25
- vantage6/cli/node/new.py +348 -28
- vantage6/cli/node/remove.py +14 -90
- vantage6/cli/node/restart.py +30 -51
- vantage6/cli/node/set_api_key.py +7 -4
- vantage6/cli/node/start.py +81 -304
- vantage6/cli/node/stop.py +36 -96
- vantage6/cli/server/import_.py +1 -2
- vantage6/cli/server/list.py +0 -3
- vantage6/cli/server/new.py +72 -42
- vantage6/cli/server/remove.py +12 -33
- vantage6/cli/server/shell.py +1 -1
- vantage6/cli/server/start.py +22 -20
- vantage6/cli/server/stop.py +37 -17
- vantage6/cli/template/algo_store_config.j2 +195 -22
- vantage6/cli/template/node_config.j2 +336 -33
- vantage6/cli/template/server_config.j2 +255 -33
- vantage6/cli/utils.py +0 -2
- {vantage6-5.0.0a33.dist-info → vantage6-5.0.0a35.dist-info}/METADATA +4 -4
- vantage6-5.0.0a35.dist-info/RECORD +75 -0
- vantage6/cli/node/clean.py +0 -46
- vantage6/cli/template/server_import_config.j2 +0 -31
- vantage6-5.0.0a33.dist-info/RECORD +0 -75
- {vantage6-5.0.0a33.dist-info → vantage6-5.0.0a35.dist-info}/WHEEL +0 -0
- {vantage6-5.0.0a33.dist-info → vantage6-5.0.0a35.dist-info}/entry_points.txt +0 -0
vantage6/cli/algostore/new.py
CHANGED
|
@@ -1,61 +1,120 @@
|
|
|
1
1
|
import click
|
|
2
|
-
|
|
2
|
+
import questionary as q
|
|
3
3
|
|
|
4
|
-
from vantage6.common import
|
|
5
|
-
|
|
4
|
+
from vantage6.common.globals import (
|
|
5
|
+
DEFAULT_API_PATH,
|
|
6
|
+
InstanceType,
|
|
7
|
+
Ports,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
from vantage6.cli.common.new import new
|
|
11
|
+
from vantage6.cli.configuration_wizard import add_common_server_config
|
|
6
12
|
from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS
|
|
7
|
-
from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
|
|
8
|
-
from vantage6.cli.configuration_wizard import configuration_wizard
|
|
9
|
-
from vantage6.cli.utils import check_config_name_allowed, prompt_config_name
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
@click.command()
|
|
13
16
|
@click.option(
|
|
14
|
-
"-n", "--name", default=None, help="
|
|
17
|
+
"-n", "--name", default=None, help="Name of the configuration you want to use."
|
|
18
|
+
)
|
|
19
|
+
@click.option(
|
|
20
|
+
"--system",
|
|
21
|
+
"system_folders",
|
|
22
|
+
flag_value=True,
|
|
23
|
+
help="Use system folders instead of user folders. This is the default",
|
|
24
|
+
)
|
|
25
|
+
@click.option(
|
|
26
|
+
"--user",
|
|
27
|
+
"system_folders",
|
|
28
|
+
flag_value=False,
|
|
29
|
+
default=DEFAULT_SERVER_SYSTEM_FOLDERS,
|
|
30
|
+
help="Use user folders instead of system folders",
|
|
15
31
|
)
|
|
16
|
-
@click.option("--
|
|
32
|
+
@click.option("--context", default=None, help="Kubernetes context to use")
|
|
17
33
|
@click.option(
|
|
18
|
-
"--
|
|
34
|
+
"--namespace",
|
|
35
|
+
default=None,
|
|
36
|
+
help="Kubernetes namespace to use",
|
|
19
37
|
)
|
|
20
|
-
def cli_algo_store_new(
|
|
38
|
+
def cli_algo_store_new(
|
|
39
|
+
name: str, system_folders: bool, namespace: str, context: str
|
|
40
|
+
) -> None:
|
|
21
41
|
"""
|
|
22
42
|
Create a new server configuration.
|
|
23
43
|
"""
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
error(f"Configuration {Fore.RED}{name}{Style.RESET_ALL} already " "exists!")
|
|
33
|
-
exit(1)
|
|
34
|
-
except Exception as e:
|
|
35
|
-
error(e)
|
|
36
|
-
exit(1)
|
|
37
|
-
|
|
38
|
-
# Check that we can write in this folder
|
|
39
|
-
if not ensure_config_dir_writable(system_folders):
|
|
40
|
-
error("Your user does not have write access to all folders. Exiting")
|
|
41
|
-
info(
|
|
42
|
-
f"Create a new server using '{Fore.GREEN}v6 algorithm-store new "
|
|
43
|
-
f"--user{Style.RESET_ALL}' instead!"
|
|
44
|
-
)
|
|
45
|
-
exit(1)
|
|
46
|
-
|
|
47
|
-
# create config in ctx location
|
|
48
|
-
try:
|
|
49
|
-
cfg_file = configuration_wizard(
|
|
50
|
-
InstanceType.ALGORITHM_STORE, name, system_folders
|
|
51
|
-
)
|
|
52
|
-
except KeyboardInterrupt:
|
|
53
|
-
error("Configuration creation aborted.")
|
|
54
|
-
exit(1)
|
|
55
|
-
info(f"New configuration created: {Fore.GREEN}{cfg_file}{Style.RESET_ALL}")
|
|
56
|
-
|
|
57
|
-
flag = "" if system_folders else "--user"
|
|
58
|
-
info(
|
|
59
|
-
f"You can start the algorithm store by running {Fore.GREEN}v6 "
|
|
60
|
-
f"algorithm-store start {flag}{Style.RESET_ALL}"
|
|
44
|
+
|
|
45
|
+
new(
|
|
46
|
+
questionnaire_function=algo_store_configuration_questionaire,
|
|
47
|
+
name=name,
|
|
48
|
+
system_folders=system_folders,
|
|
49
|
+
namespace=namespace,
|
|
50
|
+
context=context,
|
|
51
|
+
type_=InstanceType.ALGORITHM_STORE,
|
|
61
52
|
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def algo_store_configuration_questionaire(instance_name: str) -> dict:
|
|
56
|
+
"""
|
|
57
|
+
Questionary to generate a config file for the algorithm store server
|
|
58
|
+
instance.
|
|
59
|
+
|
|
60
|
+
Parameters
|
|
61
|
+
----------
|
|
62
|
+
instance_name : str
|
|
63
|
+
Name of the server instance.
|
|
64
|
+
|
|
65
|
+
Returns
|
|
66
|
+
-------
|
|
67
|
+
dict
|
|
68
|
+
Dictionary with the new server configuration
|
|
69
|
+
"""
|
|
70
|
+
config = {"store": {}, "database": {}}
|
|
71
|
+
|
|
72
|
+
config, is_production = add_common_server_config(
|
|
73
|
+
config, InstanceType.ALGORITHM_STORE, instance_name
|
|
74
|
+
)
|
|
75
|
+
if not is_production:
|
|
76
|
+
config["store"]["dev"] = {
|
|
77
|
+
"host_uri": "host.docker.internal",
|
|
78
|
+
"disable_review": True,
|
|
79
|
+
"review_own_algorithm": True,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
default_v6_server_uri = f"http://localhost:{Ports.DEV_SERVER}{DEFAULT_API_PATH}"
|
|
83
|
+
default_root_username = "admin"
|
|
84
|
+
|
|
85
|
+
v6_server_uri = q.text(
|
|
86
|
+
"What is the Vantage6 server linked to the algorithm store? "
|
|
87
|
+
"Provide the link to the server endpoint.",
|
|
88
|
+
default=default_v6_server_uri,
|
|
89
|
+
).unsafe_ask()
|
|
90
|
+
|
|
91
|
+
root_username = q.text(
|
|
92
|
+
"What is the username of the root user?",
|
|
93
|
+
default=default_root_username,
|
|
94
|
+
).unsafe_ask()
|
|
95
|
+
|
|
96
|
+
config["root_user"] = {
|
|
97
|
+
"v6_server_uri": v6_server_uri,
|
|
98
|
+
"username": root_username,
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
# ask about openness of the algorithm store
|
|
102
|
+
config["policies"] = {}
|
|
103
|
+
is_open = q.confirm(
|
|
104
|
+
"Do you want to open the algorithm store to the public? This will allow anyone "
|
|
105
|
+
"to view the algorithms, but they cannot modify them.",
|
|
106
|
+
default=False,
|
|
107
|
+
).unsafe_ask()
|
|
108
|
+
if is_open:
|
|
109
|
+
open_algos_policy = "public"
|
|
110
|
+
else:
|
|
111
|
+
is_open_to_whitelist = q.confirm(
|
|
112
|
+
"Do you want to allow all authenticated users to access "
|
|
113
|
+
"the algorithms in the store? If not allowing this, you will have to assign"
|
|
114
|
+
" the appropriate permissions to each user individually.",
|
|
115
|
+
default=True,
|
|
116
|
+
).unsafe_ask()
|
|
117
|
+
open_algos_policy = "authenticated" if is_open_to_whitelist else "private"
|
|
118
|
+
config["policies"]["algorithm_view"] = open_algos_policy
|
|
119
|
+
|
|
120
|
+
return config
|
vantage6/cli/algostore/remove.py
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import itertools
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from shutil import rmtree
|
|
4
1
|
import click
|
|
5
|
-
import questionary as q
|
|
6
2
|
|
|
7
|
-
from vantage6.common import
|
|
8
|
-
|
|
3
|
+
from vantage6.common.globals import InstanceType
|
|
4
|
+
|
|
9
5
|
from vantage6.cli.common.decorator import click_insert_context
|
|
6
|
+
from vantage6.cli.common.remove import execute_remove
|
|
10
7
|
from vantage6.cli.context import AlgorithmStoreContext
|
|
11
|
-
from vantage6.cli.
|
|
12
|
-
from vantage6.common.globals import InstanceType
|
|
8
|
+
from vantage6.cli.globals import InfraComponentName
|
|
13
9
|
|
|
14
10
|
|
|
15
11
|
@click.command()
|
|
16
|
-
@click_insert_context(
|
|
12
|
+
@click_insert_context(
|
|
13
|
+
type_=InstanceType.ALGORITHM_STORE, include_name=True, include_system_folders=True
|
|
14
|
+
)
|
|
17
15
|
@click.option("-f", "--force", "force", flag_value=True)
|
|
18
|
-
def cli_algo_store_remove(
|
|
16
|
+
def cli_algo_store_remove(
|
|
17
|
+
ctx: AlgorithmStoreContext, name: str, system_folders: bool, force: bool
|
|
18
|
+
) -> None:
|
|
19
19
|
"""
|
|
20
20
|
Function to remove an algorithm store.
|
|
21
21
|
|
|
@@ -26,27 +26,11 @@ def cli_algo_store_remove(ctx: AlgorithmStoreContext, force: bool) -> None:
|
|
|
26
26
|
force : bool
|
|
27
27
|
Whether to ask for confirmation before removing or not
|
|
28
28
|
"""
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
info("Algorithm store will not be deleted")
|
|
38
|
-
exit(0)
|
|
39
|
-
|
|
40
|
-
# now remove the folders...
|
|
41
|
-
remove_file(ctx.config_file, "configuration")
|
|
42
|
-
|
|
43
|
-
# ensure log files are closed before removing
|
|
44
|
-
log_dir = Path(ctx.log_file.parent)
|
|
45
|
-
info(f"Removing log directory: {log_dir}")
|
|
46
|
-
for handler in itertools.chain(ctx.log.handlers, ctx.log.root.handlers):
|
|
47
|
-
handler.close()
|
|
48
|
-
# remove the whole folder with all the log files (if it exists)
|
|
49
|
-
try:
|
|
50
|
-
rmtree(log_dir)
|
|
51
|
-
except FileNotFoundError:
|
|
52
|
-
pass
|
|
29
|
+
execute_remove(
|
|
30
|
+
ctx,
|
|
31
|
+
InstanceType.ALGORITHM_STORE,
|
|
32
|
+
InfraComponentName.ALGORITHM_STORE,
|
|
33
|
+
name,
|
|
34
|
+
system_folders,
|
|
35
|
+
force,
|
|
36
|
+
)
|
vantage6/cli/algostore/start.py
CHANGED
|
@@ -2,106 +2,75 @@ import click
|
|
|
2
2
|
|
|
3
3
|
from vantage6.common import info
|
|
4
4
|
from vantage6.common.globals import (
|
|
5
|
-
APPNAME,
|
|
6
|
-
DEFAULT_ALGO_STORE_IMAGE,
|
|
7
5
|
InstanceType,
|
|
8
6
|
Ports,
|
|
9
7
|
)
|
|
10
8
|
|
|
11
9
|
from vantage6.cli.common.decorator import click_insert_context
|
|
12
10
|
from vantage6.cli.common.start import (
|
|
11
|
+
helm_install,
|
|
12
|
+
prestart_checks,
|
|
13
|
+
start_port_forward,
|
|
14
|
+
)
|
|
15
|
+
from vantage6.cli.common.utils import (
|
|
13
16
|
attach_logs,
|
|
14
|
-
|
|
15
|
-
get_image,
|
|
16
|
-
mount_config_file,
|
|
17
|
-
mount_database,
|
|
18
|
-
mount_source,
|
|
19
|
-
pull_infra_image,
|
|
17
|
+
create_directory_if_not_exists,
|
|
20
18
|
)
|
|
21
19
|
from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
|
|
20
|
+
from vantage6.cli.globals import ChartName
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
@click.command()
|
|
24
|
+
@click.option("--context", default=None, help="Kubernetes context to use")
|
|
25
|
+
@click.option("--namespace", default=None, help="Kubernetes namespace to use")
|
|
25
26
|
@click.option("--ip", default=None, help="IP address to listen on")
|
|
26
27
|
@click.option("-p", "--port", default=None, type=int, help="Port to listen on")
|
|
27
|
-
@click.option("-i", "--image", default=None, help="Algorithm store Docker image to use")
|
|
28
|
-
@click.option(
|
|
29
|
-
"--keep/--auto-remove",
|
|
30
|
-
default=False,
|
|
31
|
-
help="Keep image after algorithm store has been stopped. Useful for debugging",
|
|
32
|
-
)
|
|
33
|
-
@click.option(
|
|
34
|
-
"--mount-src",
|
|
35
|
-
default="",
|
|
36
|
-
help="Override vantage6 source code in container with the source code in this path",
|
|
37
|
-
)
|
|
38
28
|
@click.option(
|
|
39
29
|
"--attach/--detach",
|
|
40
30
|
default=False,
|
|
41
31
|
help="Print server logs to the console after start",
|
|
42
32
|
)
|
|
43
|
-
@click_insert_context(
|
|
33
|
+
@click_insert_context(
|
|
34
|
+
InstanceType.ALGORITHM_STORE, include_name=True, include_system_folders=True
|
|
35
|
+
)
|
|
44
36
|
def cli_algo_store_start(
|
|
45
37
|
ctx: AlgorithmStoreContext,
|
|
38
|
+
name: str,
|
|
39
|
+
system_folders: bool,
|
|
40
|
+
context: str,
|
|
41
|
+
namespace: str,
|
|
46
42
|
ip: str,
|
|
47
43
|
port: int,
|
|
48
|
-
image: str,
|
|
49
|
-
keep: bool,
|
|
50
|
-
mount_src: str,
|
|
51
44
|
attach: bool,
|
|
52
45
|
) -> None:
|
|
53
46
|
"""
|
|
54
|
-
Start the algorithm store
|
|
47
|
+
Start the algorithm store.
|
|
55
48
|
"""
|
|
56
49
|
info("Starting algorithm store...")
|
|
57
|
-
docker_client = check_for_start(ctx, InstanceType.ALGORITHM_STORE)
|
|
58
|
-
|
|
59
|
-
image = get_image(image, ctx, "algorithm-store", DEFAULT_ALGO_STORE_IMAGE)
|
|
60
|
-
|
|
61
|
-
info("Pulling algorithm store image...")
|
|
62
|
-
pull_infra_image(docker_client, image, InstanceType.ALGORITHM_STORE)
|
|
63
50
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
src_mount = mount_source(mount_src)
|
|
68
|
-
if src_mount:
|
|
69
|
-
mounts.append(src_mount)
|
|
51
|
+
prestart_checks(
|
|
52
|
+
ctx, InstanceType.ALGORITHM_STORE, name, system_folders, context, namespace
|
|
53
|
+
)
|
|
70
54
|
|
|
71
|
-
|
|
72
|
-
if mount:
|
|
73
|
-
mounts.append(mount)
|
|
55
|
+
create_directory_if_not_exists(ctx.log_dir)
|
|
74
56
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"--wsgi-file /vantage6/vantage6-algorithm-store/vantage6/algorithm"
|
|
82
|
-
f"/store/wsgi.py --pyargv {config_file}"
|
|
57
|
+
helm_install(
|
|
58
|
+
release_name=ctx.helm_release_name,
|
|
59
|
+
chart_name=ChartName.ALGORITHM_STORE,
|
|
60
|
+
values_file=ctx.config_file,
|
|
61
|
+
context=context,
|
|
62
|
+
namespace=namespace,
|
|
83
63
|
)
|
|
84
|
-
info(cmd)
|
|
85
64
|
|
|
86
|
-
info("
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
f"{APPNAME}-type": InstanceType.ALGORITHM_STORE.value,
|
|
95
|
-
"name": ctx.config_file_name,
|
|
96
|
-
},
|
|
97
|
-
environment=environment_vars,
|
|
98
|
-
ports={f"{internal_port}/tcp": (ip, port_)},
|
|
99
|
-
name=ctx.docker_container_name,
|
|
100
|
-
auto_remove=not keep,
|
|
101
|
-
tty=True,
|
|
65
|
+
info("Port forwarding for algorithm store")
|
|
66
|
+
start_port_forward(
|
|
67
|
+
service_name=f"{ctx.helm_release_name}-store-service",
|
|
68
|
+
service_port=ctx.config["store"].get("port", Ports.DEV_ALGO_STORE.value),
|
|
69
|
+
port=port or ctx.config["store"].get("port", Ports.DEV_ALGO_STORE.value),
|
|
70
|
+
ip=ip,
|
|
71
|
+
context=context,
|
|
72
|
+
namespace=namespace,
|
|
102
73
|
)
|
|
103
74
|
|
|
104
|
-
info(f"Success! container id = {container.id}")
|
|
105
|
-
|
|
106
75
|
if attach:
|
|
107
|
-
attach_logs(
|
|
76
|
+
attach_logs("app=store", "component=store-server")
|
vantage6/cli/algostore/stop.py
CHANGED
|
@@ -1,61 +1,58 @@
|
|
|
1
1
|
import click
|
|
2
|
-
import docker
|
|
3
|
-
from colorama import Fore, Style
|
|
4
2
|
|
|
5
|
-
from vantage6.common import
|
|
6
|
-
from vantage6.common.
|
|
7
|
-
check_docker_running,
|
|
8
|
-
remove_container_if_exists,
|
|
9
|
-
)
|
|
10
|
-
from vantage6.common.globals import APPNAME, InstanceType
|
|
3
|
+
from vantage6.common import info
|
|
4
|
+
from vantage6.common.globals import InstanceType
|
|
11
5
|
|
|
12
|
-
from vantage6.cli.common.
|
|
13
|
-
from vantage6.cli.
|
|
6
|
+
from vantage6.cli.common.stop import execute_stop, helm_uninstall, stop_port_forward
|
|
7
|
+
from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS, InfraComponentName
|
|
14
8
|
|
|
15
9
|
|
|
16
10
|
@click.command()
|
|
17
|
-
@
|
|
11
|
+
@click.option("-n", "--name", default=None, help="Configuration name")
|
|
12
|
+
@click.option("--context", default=None, help="Kubernetes context to use")
|
|
13
|
+
@click.option("--namespace", default=None, help="Kubernetes namespace to use")
|
|
14
|
+
@click.option(
|
|
15
|
+
"--system",
|
|
16
|
+
"system_folders",
|
|
17
|
+
flag_value=True,
|
|
18
|
+
default=DEFAULT_SERVER_SYSTEM_FOLDERS,
|
|
19
|
+
help="Search for configuration in system folders instead of user folders. "
|
|
20
|
+
"This is the default.",
|
|
21
|
+
)
|
|
22
|
+
@click.option(
|
|
23
|
+
"--user",
|
|
24
|
+
"system_folders",
|
|
25
|
+
flag_value=False,
|
|
26
|
+
help="Search for configuration in the user folders instead of system folders.",
|
|
27
|
+
)
|
|
18
28
|
@click.option("--all", "all_stores", flag_value=True, help="Stop all algorithm stores")
|
|
19
|
-
def cli_algo_store_stop(
|
|
29
|
+
def cli_algo_store_stop(
|
|
30
|
+
name: str,
|
|
31
|
+
context: str,
|
|
32
|
+
namespace: str,
|
|
33
|
+
system_folders: bool,
|
|
34
|
+
all_stores: bool,
|
|
35
|
+
):
|
|
20
36
|
"""
|
|
21
|
-
Stop one or all running
|
|
37
|
+
Stop one or all running algorithm store(s).
|
|
22
38
|
"""
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
39
|
+
execute_stop(
|
|
40
|
+
stop_function=_stop_store,
|
|
41
|
+
instance_type=InstanceType.ALGORITHM_STORE,
|
|
42
|
+
infra_component=InfraComponentName.ALGORITHM_STORE,
|
|
43
|
+
stop_all=all_stores,
|
|
44
|
+
to_stop=name,
|
|
45
|
+
namespace=namespace,
|
|
46
|
+
context=context,
|
|
47
|
+
system_folders=system_folders,
|
|
28
48
|
)
|
|
29
49
|
|
|
30
|
-
if not running_stores:
|
|
31
|
-
warning("No algorithm stores are currently running.")
|
|
32
|
-
return
|
|
33
50
|
|
|
34
|
-
|
|
51
|
+
def _stop_store(store_name: str, namespace: str, context: str) -> None:
|
|
52
|
+
info(f"Stopping store {store_name}...")
|
|
35
53
|
|
|
36
|
-
|
|
37
|
-
for container_name in running_store_names:
|
|
38
|
-
_stop_algorithm_store(client, container_name)
|
|
39
|
-
return
|
|
54
|
+
helm_uninstall(release_name=store_name, context=context, namespace=namespace)
|
|
40
55
|
|
|
41
|
-
|
|
42
|
-
if container_name not in running_store_names:
|
|
43
|
-
error(f"{Fore.RED}{ctx.name}{Style.RESET_ALL} is not running!")
|
|
44
|
-
return
|
|
56
|
+
stop_port_forward(service_name=f"{store_name}-store-service")
|
|
45
57
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def _stop_algorithm_store(client, container_name) -> None:
|
|
50
|
-
"""
|
|
51
|
-
Stop the algorithm store server.
|
|
52
|
-
|
|
53
|
-
Parameters
|
|
54
|
-
----------
|
|
55
|
-
client : DockerClient
|
|
56
|
-
The docker client
|
|
57
|
-
container_name : str
|
|
58
|
-
The name of the container to stop
|
|
59
|
-
"""
|
|
60
|
-
remove_container_if_exists(client, name=container_name)
|
|
61
|
-
info(f"Stopped the {Fore.GREEN}{container_name}{Style.RESET_ALL} server.")
|
|
58
|
+
info(f"Store {store_name} stopped successfully.")
|
vantage6/cli/cli.py
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import click
|
|
2
2
|
|
|
3
|
-
from vantage6.cli.
|
|
4
|
-
from vantage6.cli.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
from vantage6.cli.
|
|
8
|
-
from vantage6.cli.
|
|
9
|
-
from vantage6.cli.
|
|
10
|
-
from vantage6.cli.
|
|
11
|
-
from vantage6.cli.
|
|
12
|
-
from vantage6.cli.
|
|
3
|
+
from vantage6.cli.algorithm.create import cli_algorithm_create
|
|
4
|
+
from vantage6.cli.algorithm.generate_algorithm_json import (
|
|
5
|
+
cli_algorithm_generate_algorithm_json,
|
|
6
|
+
)
|
|
7
|
+
from vantage6.cli.algorithm.update import cli_algorithm_update
|
|
8
|
+
from vantage6.cli.algostore.attach import cli_algo_store_attach
|
|
9
|
+
from vantage6.cli.algostore.files import cli_algo_store_files
|
|
10
|
+
from vantage6.cli.algostore.list import cli_algo_store_configuration_list
|
|
11
|
+
from vantage6.cli.algostore.new import cli_algo_store_new
|
|
12
|
+
from vantage6.cli.algostore.remove import cli_algo_store_remove
|
|
13
|
+
from vantage6.cli.algostore.start import cli_algo_store_start
|
|
14
|
+
from vantage6.cli.algostore.stop import cli_algo_store_stop
|
|
15
|
+
from vantage6.cli.globals import CLICommandName
|
|
13
16
|
from vantage6.cli.node.attach import cli_node_attach
|
|
14
|
-
from vantage6.cli.node.clean import cli_node_clean
|
|
15
17
|
from vantage6.cli.node.create_private_key import cli_node_create_private_key
|
|
16
18
|
from vantage6.cli.node.files import cli_node_files
|
|
17
19
|
from vantage6.cli.node.list import cli_node_list
|
|
@@ -22,29 +24,26 @@ from vantage6.cli.node.set_api_key import cli_node_set_api_key
|
|
|
22
24
|
from vantage6.cli.node.start import cli_node_start
|
|
23
25
|
from vantage6.cli.node.stop import cli_node_stop
|
|
24
26
|
from vantage6.cli.node.version import cli_node_version
|
|
25
|
-
from vantage6.cli.
|
|
26
|
-
from vantage6.cli.
|
|
27
|
-
from vantage6.cli.
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
from vantage6.cli.server.attach import cli_server_attach
|
|
28
|
+
from vantage6.cli.server.files import cli_server_files
|
|
29
|
+
from vantage6.cli.server.import_ import cli_server_import
|
|
30
|
+
from vantage6.cli.server.list import cli_server_configuration_list
|
|
31
|
+
from vantage6.cli.server.new import cli_server_new
|
|
32
|
+
from vantage6.cli.server.remove import cli_server_remove
|
|
33
|
+
from vantage6.cli.server.shell import cli_server_shell
|
|
34
|
+
from vantage6.cli.server.start import cli_server_start
|
|
35
|
+
from vantage6.cli.server.stop import cli_server_stop
|
|
36
|
+
from vantage6.cli.server.version import cli_server_version
|
|
30
37
|
|
|
31
38
|
# from vantage6.cli.test.client_script import cli_test_client_script
|
|
32
|
-
from vantage6.cli.test.feature_tester import cli_test_features
|
|
33
|
-
|
|
34
39
|
# from vantage6.cli.test.integration_test import cli_test_integration
|
|
35
|
-
from vantage6.cli.
|
|
36
|
-
from vantage6.cli.algostore.new import cli_algo_store_new
|
|
37
|
-
from vantage6.cli.algostore.start import cli_algo_store_start
|
|
38
|
-
from vantage6.cli.algostore.stop import cli_algo_store_stop
|
|
39
|
-
from vantage6.cli.algostore.files import cli_algo_store_files
|
|
40
|
-
from vantage6.cli.algostore.list import cli_algo_store_configuration_list
|
|
41
|
-
from vantage6.cli.algostore.remove import cli_algo_store_remove
|
|
40
|
+
from vantage6.cli.test.feature_tester import cli_test_features
|
|
42
41
|
from vantage6.cli.use.context import cli_use_context
|
|
43
42
|
from vantage6.cli.use.namespace import cli_use_namespace
|
|
44
43
|
|
|
45
44
|
|
|
46
45
|
# Define the server group
|
|
47
|
-
@click.group(name=
|
|
46
|
+
@click.group(name=CLICommandName.SERVER.value)
|
|
48
47
|
def cli_server() -> None:
|
|
49
48
|
"""
|
|
50
49
|
Manage your vantage6 server instances.
|
|
@@ -65,7 +64,7 @@ cli_server.add_command(cli_server_version, name="version")
|
|
|
65
64
|
|
|
66
65
|
|
|
67
66
|
# Define the node group
|
|
68
|
-
@click.group(name=
|
|
67
|
+
@click.group(name=CLICommandName.NODE.value)
|
|
69
68
|
def cli_node() -> None:
|
|
70
69
|
"""
|
|
71
70
|
Manage your vantage6 node instances.
|
|
@@ -74,7 +73,6 @@ def cli_node() -> None:
|
|
|
74
73
|
|
|
75
74
|
# Define the commands for the node group
|
|
76
75
|
cli_node.add_command(cli_node_attach, name="attach")
|
|
77
|
-
cli_node.add_command(cli_node_clean, name="clean")
|
|
78
76
|
cli_node.add_command(cli_node_create_private_key, name="create-private-key")
|
|
79
77
|
cli_node.add_command(cli_node_files, name="files")
|
|
80
78
|
cli_node.add_command(cli_node_list, name="list")
|
|
@@ -88,7 +86,7 @@ cli_node.add_command(cli_node_version, name="version")
|
|
|
88
86
|
|
|
89
87
|
|
|
90
88
|
# Define the dev group
|
|
91
|
-
@click.group(name=
|
|
89
|
+
@click.group(name=CLICommandName.DEV.value)
|
|
92
90
|
def cli_dev() -> None:
|
|
93
91
|
"""
|
|
94
92
|
Quickly manage a test network with a server and several nodes.
|
|
@@ -101,7 +99,7 @@ def cli_dev() -> None:
|
|
|
101
99
|
|
|
102
100
|
|
|
103
101
|
# Define the algorithm group
|
|
104
|
-
@click.group(name=
|
|
102
|
+
@click.group(name=CLICommandName.ALGORITHM.value)
|
|
105
103
|
def cli_algorithm() -> None:
|
|
106
104
|
"""
|
|
107
105
|
Manage your vantage6 algorithms.
|
|
@@ -117,7 +115,7 @@ cli_algorithm.add_command(
|
|
|
117
115
|
|
|
118
116
|
|
|
119
117
|
# Define the test group
|
|
120
|
-
@click.group(name=
|
|
118
|
+
@click.group(name=CLICommandName.TEST.value)
|
|
121
119
|
def cli_test() -> None:
|
|
122
120
|
"""
|
|
123
121
|
Execute tests on your vantage6 infrastructure.
|
|
@@ -131,7 +129,7 @@ cli_test.add_command(cli_test_features, name="feature-test")
|
|
|
131
129
|
|
|
132
130
|
|
|
133
131
|
# Define the algorithm-store group
|
|
134
|
-
@click.group(name=
|
|
132
|
+
@click.group(name=CLICommandName.ALGORITHM_STORE.value)
|
|
135
133
|
def cli_algo_store() -> None:
|
|
136
134
|
"""
|
|
137
135
|
Manage your vantage6 algorithm store server instances.
|
|
@@ -149,7 +147,7 @@ cli_algo_store.add_command(cli_algo_store_remove, name="remove")
|
|
|
149
147
|
|
|
150
148
|
|
|
151
149
|
# Add the use group
|
|
152
|
-
@click.group(name=
|
|
150
|
+
@click.group(name=CLICommandName.USE.value)
|
|
153
151
|
def cli_use() -> None:
|
|
154
152
|
"""
|
|
155
153
|
Manage Kubernetes context and namespace.
|