vantage6 4.1.3__tar.gz → 4.2.0rc2__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.

Files changed (63) hide show
  1. {vantage6-4.1.3 → vantage6-4.2.0rc2}/PKG-INFO +1 -1
  2. {vantage6-4.1.3 → vantage6-4.2.0rc2}/setup.py +2 -1
  3. {vantage6-4.1.3 → vantage6-4.2.0rc2}/tests_cli/test_node_cli.py +1 -1
  4. {vantage6-4.1.3 → vantage6-4.2.0rc2}/tests_cli/test_server_cli.py +2 -13
  5. vantage6-4.2.0rc2/vantage6/cli/__build__ +1 -0
  6. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/_version.py +1 -1
  7. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/cli.py +18 -0
  8. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/dev/create.py +68 -14
  9. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/dev/remove.py +6 -7
  10. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/globals.py +3 -0
  11. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/node/start.py +116 -74
  12. vantage6-4.2.0rc2/vantage6/cli/server/remove.py +41 -0
  13. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/server/stop.py +0 -51
  14. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/template/node_config.j2 +1 -0
  15. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/template/server_config.j2 +2 -1
  16. vantage6-4.2.0rc2/vantage6/cli/test/common/diagnostic_runner.py +200 -0
  17. vantage6-4.2.0rc2/vantage6/cli/test/feature_tester.py +54 -0
  18. vantage6-4.2.0rc2/vantage6/cli/test/integration_test.py +82 -0
  19. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6.egg-info/PKG-INFO +1 -1
  20. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6.egg-info/SOURCES.txt +5 -1
  21. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6.egg-info/requires.txt +4 -3
  22. vantage6-4.1.3/vantage6/cli/__build__ +0 -1
  23. {vantage6-4.1.3 → vantage6-4.2.0rc2}/setup.cfg +0 -0
  24. {vantage6-4.1.3 → vantage6-4.2.0rc2}/tests_cli/__init__.py +0 -0
  25. {vantage6-4.1.3 → vantage6-4.2.0rc2}/tests_cli/test_example.py +0 -0
  26. {vantage6-4.1.3 → vantage6-4.2.0rc2}/tests_cli/test_wizard.py +0 -0
  27. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/__init__.py +0 -0
  28. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/algorithm/create.py +0 -0
  29. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/algorithm/update.py +0 -0
  30. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/configuration_manager.py +0 -0
  31. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/configuration_wizard.py +0 -0
  32. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/context.py +0 -0
  33. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/dev/start.py +0 -0
  34. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/dev/stop.py +0 -0
  35. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/node/attach.py +0 -0
  36. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/node/clean.py +0 -0
  37. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/node/common/__init__.py +0 -0
  38. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/node/create_private_key.py +0 -0
  39. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/node/files.py +0 -0
  40. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/node/list.py +0 -0
  41. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/node/new.py +0 -0
  42. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/node/remove.py +0 -0
  43. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/node/set_api_key.py +0 -0
  44. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/node/stop.py +0 -0
  45. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/node/version.py +0 -0
  46. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/rabbitmq/__init__.py +0 -0
  47. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/rabbitmq/definitions.py +0 -0
  48. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/rabbitmq/queue_manager.py +0 -0
  49. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/rabbitmq/rabbitmq.config +0 -0
  50. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/server/attach.py +0 -0
  51. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/server/common/__init__.py +0 -0
  52. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/server/files.py +0 -0
  53. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/server/import_.py +0 -0
  54. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/server/list.py +0 -0
  55. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/server/new.py +0 -0
  56. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/server/shell.py +0 -0
  57. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/server/start.py +0 -0
  58. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/server/version.py +0 -0
  59. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/template/server_import_config.j2 +0 -0
  60. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6/cli/utils.py +0 -0
  61. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6.egg-info/dependency_links.txt +0 -0
  62. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6.egg-info/entry_points.txt +0 -0
  63. {vantage6-4.1.3 → vantage6-4.2.0rc2}/vantage6.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vantage6
3
- Version: 4.1.3
3
+ Version: 4.2.0rc2
4
4
  Summary: vantage6 command line interface
5
5
  Home-page: https://github.com/vantage6/vantage6
6
6
  Requires-Python: >=3.10
@@ -40,8 +40,9 @@ setup(
40
40
  'copier==8.3.0',
41
41
  'docker==6.1.2',
42
42
  'ipython==8.10.0',
43
- 'jinja2==3.1.2',
43
+ 'jinja2==3.1.3',
44
44
  'questionary==1.10.0',
45
+ 'rich==13.5.2',
45
46
  'schema==0.7.5',
46
47
  'SQLAlchemy==1.4.46',
47
48
  f'vantage6-common == {version_ns["__version__"]}',
@@ -214,7 +214,7 @@ class NodeCLITest(unittest.TestCase):
214
214
  log_dir=Path("logs"),
215
215
  config_dir=Path("configs"),
216
216
  databases=[{
217
- "label": "some-label",
217
+ "label": "some_label",
218
218
  "uri": "data.csv",
219
219
  "type": "csv"
220
220
  }]
@@ -126,23 +126,14 @@ class ServerCLITest(unittest.TestCase):
126
126
  self.assertIsNone(result.exception)
127
127
  self.assertEqual(result.exit_code, 0)
128
128
 
129
- @patch("vantage6.cli.server.stop.ServerContext")
130
129
  @patch("vantage6.cli.server.stop.docker.from_env")
131
- @patch("vantage6.cli.server.stop.check_docker_running", return_value=True)
132
- def test_stop(self, docker_check, containers, context):
130
+ def test_stop(self, containers):
133
131
  """Stop server without errors."""
134
132
 
135
133
  container1 = MagicMock()
136
134
  container1.name = f"{APPNAME}-iknl-system-server"
137
135
  containers.containers.list.return_value = [container1]
138
136
 
139
- ctx = MagicMock(
140
- config={
141
- 'rabbitmq_uri': None
142
- }
143
- )
144
- context.return_value = ctx
145
-
146
137
  runner = CliRunner()
147
138
  result = runner.invoke(cli_server_stop, ["--name", "iknl"])
148
139
 
@@ -151,9 +142,7 @@ class ServerCLITest(unittest.TestCase):
151
142
 
152
143
  @patch("vantage6.cli.server.attach.time.sleep")
153
144
  @patch("docker.DockerClient.containers")
154
- @patch("vantage6.cli.server.attach.check_docker_running",
155
- return_value=True)
156
- def test_attach(self, docker_check, containers, sleep):
145
+ def test_attach(self, containers, sleep):
157
146
  """Attach log to the console without errors."""
158
147
  container1 = MagicMock()
159
148
  container1.name = f"{APPNAME}-iknl-system-server"
@@ -0,0 +1 @@
1
+ 2
@@ -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, 1, 3, 'final', __build__, 0)
10
+ version_info = (4, 2, 0, 'candidate', __build__, 0)
11
11
 
12
12
  # Module version stage suffix map
13
13
  _specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': ''}
@@ -5,6 +5,7 @@ from vantage6.cli.server.files import cli_server_files
5
5
  from vantage6.cli.server.import_ import cli_server_import
6
6
  from vantage6.cli.server.list import cli_server_configuration_list
7
7
  from vantage6.cli.server.new import cli_server_new
8
+ from vantage6.cli.server.remove import cli_server_remove
8
9
  from vantage6.cli.server.shell import cli_server_shell
9
10
  from vantage6.cli.server.start import cli_server_start
10
11
  from vantage6.cli.server.stop import cli_server_stop
@@ -26,6 +27,8 @@ from vantage6.cli.dev.start import start_demo_network
26
27
  from vantage6.cli.dev.stop import stop_demo_network
27
28
  from vantage6.cli.algorithm.create import cli_algorithm_create
28
29
  from vantage6.cli.algorithm.update import cli_algorithm_update
30
+ from vantage6.cli.test.feature_tester import cli_test_features
31
+ from vantage6.cli.test.integration_test import cli_test_integration
29
32
 
30
33
 
31
34
  # Define the server group
@@ -42,6 +45,7 @@ cli_server.add_command(cli_server_files, name='files')
42
45
  cli_server.add_command(cli_server_import, name='import')
43
46
  cli_server.add_command(cli_server_configuration_list, name='list')
44
47
  cli_server.add_command(cli_server_new, name='new')
48
+ cli_server.add_command(cli_server_remove, name='remove')
45
49
  cli_server.add_command(cli_server_shell, name='shell')
46
50
  cli_server.add_command(cli_server_start, name='start')
47
51
  cli_server.add_command(cli_server_stop, name='stop')
@@ -100,6 +104,19 @@ cli_algorithm.add_command(cli_algorithm_create, name="create")
100
104
  cli_algorithm.add_command(cli_algorithm_update, name="update")
101
105
 
102
106
 
107
+ # Define the test group
108
+ @click.group(name="test")
109
+ def cli_test() -> None:
110
+ """
111
+ Execute tests on your vantage6 infrastructure.
112
+ """
113
+
114
+
115
+ # Define the commands for the test group
116
+ cli_test.add_command(cli_test_features, name="feature-test")
117
+ cli_test.add_command(cli_test_integration, name="integration-test")
118
+
119
+
103
120
  # Define the overall group
104
121
  @click.group(name='cli')
105
122
  def cli_complete() -> None:
@@ -116,3 +133,4 @@ cli_complete.add_command(cli_node)
116
133
  cli_complete.add_command(cli_server)
117
134
  cli_complete.add_command(cli_dev)
118
135
  cli_complete.add_command(cli_algorithm)
136
+ cli_complete.add_command(cli_test)
@@ -69,7 +69,8 @@ def create_node_config_file(server_url: str, port: int, config: dict,
69
69
  port : int
70
70
  Port of the dummy server.
71
71
  config : dict
72
- Configuration dictionary containing org_id, api_key and node name.
72
+ Configuration dictionary containing org_id, api_key, node name and
73
+ additional user_defined_config.
73
74
  server_name : str
74
75
  Configuration name of the dummy server.
75
76
  """
@@ -103,7 +104,8 @@ def create_node_config_file(server_url: str, port: int, config: dict,
103
104
  },
104
105
  "port": port,
105
106
  "server_url": server_url,
106
- "task_dir": str(path_to_data_dir)
107
+ "task_dir": str(path_to_data_dir),
108
+ "user_provided_config": config['user_defined_config']
107
109
  })
108
110
 
109
111
  try:
@@ -117,9 +119,31 @@ def create_node_config_file(server_url: str, port: int, config: dict,
117
119
  f"{Style.RESET_ALL}")
118
120
 
119
121
 
120
- def generate_node_configs(num_nodes: int, server_url: str, port: int,
121
- server_name: str) \
122
- -> list[dict]:
122
+ def _read_extra_config_file(extra_config_file: Path | None) -> str:
123
+ """Reads extra configuration file.
124
+
125
+ Parameters
126
+ ----------
127
+ extra_config_file : Path | None
128
+ Path to file with additional configuration.
129
+
130
+ Returns
131
+ -------
132
+ str
133
+ Extra configuration file content
134
+ """
135
+ if extra_config_file:
136
+ # read the YAML file as string, so it can be appended to the
137
+ # configuration easily
138
+ with open(extra_config_file, 'r', encoding='utf-8') as f:
139
+ return f.read()
140
+ return ''
141
+
142
+
143
+ def generate_node_configs(
144
+ num_nodes: int, server_url: str, port: int, server_name: str,
145
+ extra_node_config: Path | None
146
+ ) -> list[dict]:
123
147
  """Generates ``num_nodes`` node configuration files.
124
148
 
125
149
  Parameters
@@ -132,6 +156,8 @@ def generate_node_configs(num_nodes: int, server_url: str, port: int,
132
156
  Port of the dummy server.
133
157
  server_name : str
134
158
  Configuration name of the dummy server.
159
+ extra_node_config : Path | None
160
+ Path to file with additional node configuration.
135
161
 
136
162
  Returns
137
163
  -------
@@ -139,11 +165,13 @@ def generate_node_configs(num_nodes: int, server_url: str, port: int,
139
165
  List of dictionaries containing node configurations.
140
166
  """
141
167
  configs = []
168
+ extra_config = _read_extra_config_file(extra_node_config)
142
169
  for i in range(num_nodes):
143
170
  config = {
144
171
  'org_id': i + 1,
145
172
  'api_key': generate_apikey(),
146
- 'node_name': f"{server_name}_node_{i + 1}"
173
+ 'node_name': f"{server_name}_node_{i + 1}",
174
+ "user_defined_config": extra_config
147
175
  }
148
176
  create_node_config_file(server_url, port, config, server_name)
149
177
  configs.append(config)
@@ -211,7 +239,9 @@ def create_vserver_import_config(node_configs: list[dict], server_name: str) \
211
239
  return full_path
212
240
 
213
241
 
214
- def create_vserver_config(server_name: str, port: int) -> Path:
242
+ def create_vserver_config(
243
+ server_name: str, port: int, extra_config_file: Path
244
+ ) -> Path:
215
245
  """Creates server configuration file (YAML).
216
246
 
217
247
  Parameters
@@ -220,6 +250,8 @@ def create_vserver_config(server_name: str, port: int) -> Path:
220
250
  Server name.
221
251
  port : int
222
252
  Server port.
253
+ extra_config_file : Path
254
+ Path to file with additional server configuration.
223
255
 
224
256
  Returns
225
257
  -------
@@ -229,10 +261,14 @@ def create_vserver_config(server_name: str, port: int) -> Path:
229
261
  environment = Environment(
230
262
  loader=FileSystemLoader(PACKAGE_FOLDER / APPNAME / "cli" / "template"),
231
263
  trim_blocks=True, lstrip_blocks=True, autoescape=True)
264
+
265
+ extra_config = _read_extra_config_file(extra_config_file)
266
+
232
267
  template = environment.get_template("server_config.j2")
233
268
  server_config = template.render(
234
269
  port=port,
235
- jwt_secret_key=generate_apikey()
270
+ jwt_secret_key=generate_apikey(),
271
+ user_provided_config=extra_config
236
272
  )
237
273
  folders = ServerContext.instance_folders(
238
274
  instance_type='server', instance_name=server_name,
@@ -257,8 +293,10 @@ def create_vserver_config(server_name: str, port: int) -> Path:
257
293
  return full_path
258
294
 
259
295
 
260
- def demo_network(num_nodes: int, server_url: str, server_port: int,
261
- server_name: str) -> tuple[list[dict], Path, Path]:
296
+ def demo_network(
297
+ num_nodes: int, server_url: str, server_port: int, server_name: str,
298
+ extra_server_config: Path, extra_node_config: Path
299
+ ) -> tuple[list[dict], Path, Path]:
262
300
  """Generates the demo network.
263
301
 
264
302
  Parameters
@@ -271,6 +309,10 @@ def demo_network(num_nodes: int, server_url: str, server_port: int,
271
309
  Port of the dummy server.
272
310
  server_name : str
273
311
  Server name.
312
+ extra_server_config : Path
313
+ Path to file with additional server configuration.
314
+ extra_node_config : Path
315
+ Path to file with additional node configuration.
274
316
 
275
317
  Returns
276
318
  -------
@@ -278,10 +320,11 @@ def demo_network(num_nodes: int, server_url: str, server_port: int,
278
320
  Tuple containing node, server import and server configurations.
279
321
  """
280
322
  node_configs = generate_node_configs(num_nodes, server_url, server_port,
281
- server_name)
323
+ server_name, extra_node_config)
282
324
  server_import_config = create_vserver_import_config(node_configs,
283
325
  server_name)
284
- server_config = create_vserver_config(server_name, server_port)
326
+ server_config = create_vserver_config(server_name, server_port,
327
+ extra_server_config)
285
328
  return (node_configs, server_import_config, server_config)
286
329
 
287
330
 
@@ -298,10 +341,18 @@ def demo_network(num_nodes: int, server_url: str, server_port: int,
298
341
  @click.option('-i', '--image', type=str, default=None,
299
342
  help='Server docker image to use when setting up resources for '
300
343
  'the development server')
344
+ @click.option('--extra-server-config', type=click.Path(exists=True),
345
+ default=None, help='YAML File with additional server '
346
+ 'configuration. This will be appended to the server '
347
+ 'configuration file')
348
+ @click.option('--extra-node-config', type=click.Path('rb'), default=None,
349
+ help='YAML File with additional node configuration. This will be'
350
+ ' appended to each of the node configuration files')
301
351
  @click.pass_context
302
352
  def create_demo_network(
303
353
  click_ctx: click.Context, name: str, num_nodes: int, server_url: str,
304
- server_port: int, image: str = None
354
+ server_port: int, image: str = None, extra_server_config: Path = None,
355
+ extra_node_config: Path = None
305
356
  ) -> dict:
306
357
  """Creates a demo network.
307
358
 
@@ -312,7 +363,10 @@ def create_demo_network(
312
363
  """
313
364
  server_name = prompt_config_name(name)
314
365
  if not ServerContext.config_exists(server_name):
315
- demo = demo_network(num_nodes, server_url, server_port, server_name)
366
+ demo = demo_network(
367
+ num_nodes, server_url, server_port, server_name,
368
+ extra_server_config, extra_node_config
369
+ )
316
370
  info(f"Created {Fore.GREEN}{len(demo[0])}{Style.RESET_ALL} node "
317
371
  f"configuration(s), attaching them to {Fore.GREEN}{server_name}"
318
372
  f"{Style.RESET_ALL}.")
@@ -8,15 +8,16 @@ import click
8
8
  from vantage6.common import info
9
9
  from vantage6.cli.context import ServerContext, NodeContext
10
10
  from vantage6.cli.server.common import click_insert_context
11
- from vantage6.cli.server.stop import vserver_remove
11
+ from vantage6.cli.server.remove import cli_server_remove
12
12
  from vantage6.cli.utils import remove_file
13
13
 
14
14
 
15
15
  @click.command()
16
16
  @click_insert_context
17
- @click.option('-f', "--force", type=bool, flag_value=True,
18
- help='Don\'t ask for confirmation')
19
- def remove_demo_network(ctx: ServerContext, force: bool) -> None:
17
+ @click.pass_context
18
+ def remove_demo_network(
19
+ click_ctx: click.Context, ctx: ServerContext
20
+ ) -> None:
20
21
  """ Remove all related demo network files and folders.
21
22
 
22
23
  Select a server configuration to remove that server and the nodes attached
@@ -26,7 +27,7 @@ def remove_demo_network(ctx: ServerContext, force: bool) -> None:
26
27
  # remove the server
27
28
  for handler in itertools.chain(ctx.log.handlers, ctx.log.root.handlers):
28
29
  handler.close()
29
- vserver_remove(ctx, ctx.name, True, force)
30
+ click_ctx.invoke(cli_server_remove, ctx=ctx, force=True)
30
31
 
31
32
  # removing the server import config
32
33
  info("Deleting demo import config file")
@@ -41,8 +42,6 @@ def remove_demo_network(ctx: ServerContext, force: bool) -> None:
41
42
  server_folder = server_configs['data']
42
43
  if server_folder.is_dir():
43
44
  rmtree(server_folder)
44
- # TODO BvB 2023-07-31 can it happen that the server folder is not a
45
- # directory? What then?
46
45
 
47
46
  # remove the nodes
48
47
  configs, _ = NodeContext.available_configurations(system_folders=False)
@@ -36,3 +36,6 @@ DEFAULT_UI_PORT = 5001
36
36
 
37
37
  # Location of repository to create new algorithm templates from
38
38
  ALGORITHM_TEMPLATE_REPO = "gh:vantage6/v6-algorithm-template.git"
39
+
40
+ # image to use for diagnostics in `v6 test` commands
41
+ DIAGNOSTICS_IMAGE = "harbor2.vantage6.ai/algorithms/diagnostic"