• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vantage6 / vantage6 / 18191710511

02 Oct 2025 11:30AM UTC coverage: 29.08%. First build
18191710511

Pull #2287

github

web-flow
Merge 3e2880106 into d88a9c354
Pull Request #2287: Change/#1510 and reinstate the dev network commands

17 of 48 new or added lines in 10 files covered. (35.42%)

196 of 674 relevant lines covered (29.08%)

0.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.36
/vantage6/vantage6/cli/configuration_manager.py
1
from typing import Self
1✔
2

3
from schema import And, Use
1✔
4

5
from vantage6.common.configuration_manager import Configuration, ConfigurationManager
1✔
6

7
from vantage6.cli.globals import (
1✔
8
    ALGO_STORE_TEMPLATE_FILE,
9
    AUTH_TEMPLATE_FILE,
10
    NODE_TEMPLATE_FILE,
11
    SERVER_TEMPLATE_FILE,
12
)
13

14
LOGGING_VALIDATORS = {
1✔
15
    "level": And(
16
        Use(str), lambda lvl: lvl in ("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL")
17
    ),
18
    "use_console": Use(bool),
19
    "backup_count": And(Use(int), lambda n: n > 0),
20
    "max_size": And(Use(int), lambda b: b > 16),
21
    "format": Use(str),
22
    "datefmt": Use(str),
23
}
24

25

26
class ServerConfiguration(Configuration):
1✔
27
    """
28
    Stores the server's configuration and defines a set of server-specific
29
    validators.
30
    """
31

32
    # TODO: explore how to validate helm values.yaml files, see issue 2105
33
    VALIDATORS = {}
1✔
34

35

36
class AlgorithmStoreConfiguration(Configuration):
1✔
37
    """
38
    Stores the algorithm store's configuration and defines a set of algorithm store-specific
39
    validators.
40
    """
41

42
    VALIDATORS = {}
1✔
43

44

45
class NodeConfiguration(Configuration):
1✔
46
    """
47
    Stores the node's configuration and defines a set of node-specific
48
    validators.
49
    """
50

51
    # TODO perhaps we can remove these classes and do validation of the configuration
52
    # file more easily with helm values.yaml checks.
53
    VALIDATORS = {
1✔
54
        # # TODO enable validators for node. To see if it works, use v6 node list
55
        # "node": {
56
        #     "server_url": Use(str),
57
        #     "port": Or(Use(int), None),
58
        #     "task_dir": Use(str),
59
        #     # TODO: remove `dict` validation from databases
60
        #     "api_path": Use(str),
61
        #     "logging": LOGGING_VALIDATORS,
62
        #     "encryption": {"enabled": bool, Optional("private_key"): Use(str)},
63
        #     Optional("node_extra_env"): dict,
64
        #     Optional("node_extra_mounts"): [str],
65
        #     Optional("node_extra_hosts"): dict,
66
        #     Optional("share_algorithm_logs"): Use(bool),
67
        # }
68
    }
69

70

71
class AuthConfiguration(Configuration):
1✔
72
    VALIDATORS = {}
1✔
73

74

75
class TestConfiguration(Configuration):
1✔
76
    VALIDATORS = {}
1✔
77

78

79
class NodeConfigurationManager(ConfigurationManager):
1✔
80
    """
81
    Maintains the node's configuration.
82

83
    Parameters
84
    ----------
85
    name : str
86
        Name of the configuration file.
87
    """
88

89
    def __init__(self, name, is_sandbox: bool = False, *args, **kwargs) -> None:
1✔
NEW
90
        super().__init__(conf_class=NodeConfiguration, name=name, is_sandbox=is_sandbox)
×
91

92
    @classmethod
1✔
93
    def from_file(cls, path: str, is_sandbox: bool = False) -> Self:
1✔
94
        """
95
        Create a new instance of the NodeConfigurationManager from a
96
        configuration file.
97

98
        Parameters
99
        ----------
100
        path : str
101
            Path to the configuration file.
102

103
        Returns
104
        -------
105
        NodeConfigurationManager
106
            A new instance of the NodeConfigurationManager.
107
        """
NEW
108
        return super().from_file(
×
109
            path, conf_class=NodeConfiguration, is_sandbox=is_sandbox
110
        )
111

112
    def get_config_template(self) -> str:
1✔
113
        """
114
        Get the configuration template for the node.
115
        """
116
        return super()._get_config_template(NODE_TEMPLATE_FILE)
×
117

118

119
class ServerConfigurationManager(ConfigurationManager):
1✔
120
    """
121
    Maintains the server's configuration.
122

123
    Parameters
124
    ----------
125
    name : str
126
        Name of the configuration file.
127
    """
128

129
    def __init__(self, name, is_sandbox: bool = False, *args, **kwargs) -> None:
1✔
NEW
130
        super().__init__(
×
131
            conf_class=ServerConfiguration, name=name, is_sandbox=is_sandbox
132
        )
133

134
    @classmethod
1✔
135
    def from_file(cls, path, is_sandbox: bool = False) -> Self:
1✔
136
        """
137
        Create a new instance of the ServerConfigurationManager from a
138
        configuration file.
139

140
        Parameters
141
        ----------
142
        path : str
143
            Path to the configuration file.
144

145
        Returns
146
        -------
147
        ServerConfigurationManager
148
            A new instance of the ServerConfigurationManager.
149
        """
NEW
150
        return super().from_file(
×
151
            path, conf_class=ServerConfiguration, is_sandbox=is_sandbox
152
        )
153

154
    def get_config_template(self) -> str:
1✔
155
        """
156
        Get the configuration template for the server.
157

158
        Returns
159
        -------
160
        str
161
            The configuration template for the server.
162
        """
163
        return super()._get_config_template(SERVER_TEMPLATE_FILE)
×
164

165

166
class AlgorithmStoreConfigurationManager(ConfigurationManager):
1✔
167
    """
168
    Maintains the algorithm store's configuration.
169

170
    Parameters
171
    ----------
172
    name : str
173
        Name of the configuration file.
174
    """
175

176
    def __init__(self, name, is_sandbox: bool = False, *args, **kwargs) -> None:
1✔
NEW
177
        super().__init__(
×
178
            conf_class=AlgorithmStoreConfiguration, name=name, is_sandbox=is_sandbox
179
        )
180

181
    @classmethod
1✔
182
    def from_file(cls, path: str, is_sandbox: bool = False) -> Self:
1✔
183
        """
184
        Create a new instance of the AlgorithmStoreConfigurationManager from a
185
        configuration file.
186

187
        Parameters
188
        ----------
189
        path : str
190
            Path to the configuration file.
191

192
        Returns
193
        -------
194
        AlgorithmStoreConfigurationManager
195
            A new instance of the AlgorithmStoreConfigurationManager.
196
        """
NEW
197
        return super().from_file(
×
198
            path, conf_class=AlgorithmStoreConfiguration, is_sandbox=is_sandbox
199
        )
200

201
    def get_config_template(self) -> str:
1✔
202
        """
203
        Get the configuration template for the algorithm store.
204

205
        Returns
206
        -------
207
        str
208
            The configuration template for the algorithm store.
209
        """
210
        return super()._get_config_template(ALGO_STORE_TEMPLATE_FILE)
×
211

212

213
class AuthConfigurationManager(ConfigurationManager):
1✔
214
    """
215
    Maintains the auth's configuration.
216

217
    Parameters
218
    ----------
219
    name : str
220
        Name of the configuration file.
221
    """
222

223
    def __init__(self, name, is_sandbox: bool = False, *args, **kwargs):
1✔
NEW
224
        super().__init__(conf_class=AuthConfiguration, name=name, is_sandbox=is_sandbox)
×
225

226
    @classmethod
1✔
227
    def from_file(cls, path: str, is_sandbox: bool = False) -> Self:
1✔
228
        """
229
        Create a new instance of the AuthConfigurationManager from a
230
        configuration file.
231
        """
NEW
232
        return super().from_file(
×
233
            path, conf_class=AuthConfiguration, is_sandbox=is_sandbox
234
        )
235

236
    def get_config_template(self) -> str:
1✔
237
        """
238
        Get the configuration template for the auth.
239
        """
240
        return super()._get_config_template(AUTH_TEMPLATE_FILE)
×
241

242

243
class TestingConfigurationManager(ConfigurationManager):
1✔
244
    def __init__(self, name, *args, **kwargs):
1✔
245
        super().__init__(conf_class=TestConfiguration, name=name)
1✔
246

247
    @classmethod
1✔
248
    def from_file(cls, path, is_sandbox: bool = False):
1✔
249
        return super().from_file(
1✔
250
            path, conf_class=TestConfiguration, is_sandbox=is_sandbox
251
        )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc