nufi-python 1.0.0__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.
Files changed (52) hide show
  1. nufi/__init__.py +52 -0
  2. nufi/auth.py +364 -0
  3. nufi/cli/__init__.py +0 -0
  4. nufi/cli/commands/__init__.py +1 -0
  5. nufi/cli/commands/auth.py +113 -0
  6. nufi/cli/commands/common.py +198 -0
  7. nufi/cli/commands/compiles.py +507 -0
  8. nufi/cli/commands/custom_evaluation_templates.py +206 -0
  9. nufi/cli/commands/datasets.py +697 -0
  10. nufi/cli/commands/evaluations.py +854 -0
  11. nufi/cli/commands/leaderboards.py +763 -0
  12. nufi/cli/commands/models.py +1347 -0
  13. nufi/cli/commands/monitoring.py +350 -0
  14. nufi/cli/commands/profile.py +123 -0
  15. nufi/cli/commands/projects.py +308 -0
  16. nufi/cli/commands/servings.py +306 -0
  17. nufi/cli/main.py +66 -0
  18. nufi/client.py +103 -0
  19. nufi/config.py +281 -0
  20. nufi/evaluator.py +559 -0
  21. nufi/exceptions.py +58 -0
  22. nufi/http_utils.py +51 -0
  23. nufi/models/__init__.py +185 -0
  24. nufi/models/compiles.py +79 -0
  25. nufi/models/custom_evaluation_templates.py +111 -0
  26. nufi/models/datasets.py +94 -0
  27. nufi/models/evaluations.py +253 -0
  28. nufi/models/leaderboards.py +178 -0
  29. nufi/models/monitoring.py +179 -0
  30. nufi/models/pagination.py +33 -0
  31. nufi/models/projects.py +32 -0
  32. nufi/models/registry.py +138 -0
  33. nufi/models/servings.py +27 -0
  34. nufi/py.typed +1 -0
  35. nufi/resources/__init__.py +34 -0
  36. nufi/resources/base.py +190 -0
  37. nufi/resources/compiles.py +193 -0
  38. nufi/resources/custom_evaluation_templates.py +126 -0
  39. nufi/resources/datasets.py +786 -0
  40. nufi/resources/evaluations.py +428 -0
  41. nufi/resources/leaderboards.py +413 -0
  42. nufi/resources/models.py +726 -0
  43. nufi/resources/monitoring.py +82 -0
  44. nufi/resources/projects.py +114 -0
  45. nufi/resources/servings.py +80 -0
  46. nufi/transport.py +248 -0
  47. nufi_python-1.0.0.dist-info/METADATA +228 -0
  48. nufi_python-1.0.0.dist-info/RECORD +52 -0
  49. nufi_python-1.0.0.dist-info/WHEEL +5 -0
  50. nufi_python-1.0.0.dist-info/entry_points.txt +2 -0
  51. nufi_python-1.0.0.dist-info/licenses/LICENSE +21 -0
  52. nufi_python-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1347 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from contextlib import contextmanager
5
+ from typing import Annotated, Any
6
+ from urllib.parse import urlsplit
7
+
8
+ import typer
9
+ from rich.markup import escape
10
+
11
+ from nufi import auth, config
12
+ from nufi.cli.commands import common
13
+ from nufi.exceptions import NotFoundError, ValidationError
14
+
15
+ EXAMPLES = "Examples: nufi model list; nufi model get llama; nufi model version --help"
16
+
17
+ app = typer.Typer(
18
+ help="Manage NuFi models.",
19
+ epilog=EXAMPLES,
20
+ invoke_without_command=True,
21
+ context_settings=common.CONTEXT_SETTINGS,
22
+ )
23
+ version_app = typer.Typer(
24
+ help="Manage model versions.",
25
+ epilog="Examples: nufi model version list llama; nufi model version get llama v1",
26
+ invoke_without_command=True,
27
+ context_settings=common.CONTEXT_SETTINGS,
28
+ )
29
+ artifact_app = typer.Typer(
30
+ help="Manage model artifacts.",
31
+ epilog=(
32
+ "Examples: nufi model artifact list llama v1; "
33
+ "nufi model artifact get llama v1 base"
34
+ ),
35
+ invoke_without_command=True,
36
+ context_settings=common.CONTEXT_SETTINGS,
37
+ )
38
+ import_app = typer.Typer(
39
+ help="Import models from supported providers.",
40
+ epilog="Examples: nufi model import huggingface --help; nufi model import mlflow --help",
41
+ invoke_without_command=True,
42
+ context_settings=common.CONTEXT_SETTINGS,
43
+ )
44
+ huggingface_app = typer.Typer(
45
+ help="Import models from Hugging Face.",
46
+ epilog=(
47
+ "Examples: nufi model import huggingface list; "
48
+ "nufi model import huggingface wait 42"
49
+ ),
50
+ invoke_without_command=True,
51
+ context_settings=common.CONTEXT_SETTINGS,
52
+ )
53
+ mlflow_app = typer.Typer(
54
+ help="Import models from MLflow.",
55
+ epilog=("Examples: nufi model import mlflow list; nufi model import mlflow get 42"),
56
+ invoke_without_command=True,
57
+ context_settings=common.CONTEXT_SETTINGS,
58
+ )
59
+
60
+ app.add_typer(version_app, name="version")
61
+ app.add_typer(artifact_app, name="artifact")
62
+ app.add_typer(import_app, name="import")
63
+ import_app.add_typer(huggingface_app, name="huggingface")
64
+ import_app.add_typer(mlflow_app, name="mlflow")
65
+
66
+ ProjectOption = Annotated[
67
+ str | None,
68
+ typer.Option("--project", help="Project name.", show_default=False),
69
+ ]
70
+ ProjectIDOption = Annotated[
71
+ int | None,
72
+ typer.Option("--project-id", min=1, help="Project ID.", show_default=False),
73
+ ]
74
+ ProfileOption = Annotated[
75
+ str | None,
76
+ typer.Option("--profile", help="Profile name.", show_default=False),
77
+ ]
78
+ OutputOption = Annotated[
79
+ common.OutputChoice,
80
+ typer.Option("--output", help="Output format."),
81
+ ]
82
+ VerboseOption = Annotated[
83
+ bool,
84
+ typer.Option("--verbose", help="Show detailed errors."),
85
+ ]
86
+ PageOption = Annotated[
87
+ int | None,
88
+ typer.Option("--page", min=1, help="Page number.", show_default=False),
89
+ ]
90
+ LimitOption = Annotated[
91
+ int | None,
92
+ typer.Option(
93
+ "--limit",
94
+ min=1,
95
+ max=100,
96
+ help="Items per page.",
97
+ show_default=False,
98
+ ),
99
+ ]
100
+
101
+
102
+ @app.callback()
103
+ def models(ctx: typer.Context):
104
+ common.show_help_if_no_subcommand(ctx)
105
+
106
+
107
+ @version_app.callback()
108
+ def model_versions(ctx: typer.Context):
109
+ common.show_help_if_no_subcommand(ctx)
110
+
111
+
112
+ @artifact_app.callback()
113
+ def model_artifacts(ctx: typer.Context):
114
+ common.show_help_if_no_subcommand(ctx)
115
+
116
+
117
+ @import_app.callback()
118
+ def model_imports(ctx: typer.Context):
119
+ common.show_help_if_no_subcommand(ctx)
120
+
121
+
122
+ @huggingface_app.callback()
123
+ def huggingface_imports(ctx: typer.Context):
124
+ common.show_help_if_no_subcommand(ctx)
125
+
126
+
127
+ @mlflow_app.callback()
128
+ def mlflow_imports(ctx: typer.Context):
129
+ common.show_help_if_no_subcommand(ctx)
130
+
131
+
132
+ @contextmanager
133
+ def _client(
134
+ project: str | None,
135
+ project_id: int | None,
136
+ profile_name: str | None,
137
+ verbose: bool,
138
+ ):
139
+ client = None
140
+ try:
141
+ resolved_project = common.resolve_cli_project(
142
+ project,
143
+ project_id,
144
+ profile_name=profile_name,
145
+ )
146
+ client = common.make_client(profile_name)
147
+ yield client, resolved_project
148
+ except typer.Exit:
149
+ raise
150
+ except Exception as exc:
151
+ common.handle_cli_error(exc, verbose=verbose)
152
+ finally:
153
+ if client is not None:
154
+ client.close()
155
+
156
+
157
+ def _json_object(value: str | None, option: str) -> dict[str, Any] | None:
158
+ if value is None:
159
+ return None
160
+ try:
161
+ parsed = json.loads(value)
162
+ except json.JSONDecodeError as exc:
163
+ raise typer.BadParameter(f"{option} must be a JSON object.") from exc
164
+ if not isinstance(parsed, dict):
165
+ raise typer.BadParameter(f"{option} must be a JSON object.")
166
+ return parsed
167
+
168
+
169
+ def _resolve_model_name(client, target: str, project: str | int) -> str:
170
+ return common.resolve_named_resource(
171
+ client.models.iter_all(project=project),
172
+ target,
173
+ resource="model",
174
+ ).name
175
+
176
+
177
+ def _resolve_version_name(client, model: str, target: str, project: str | int) -> str:
178
+ return common.resolve_named_resource(
179
+ client.models.versions.iter_all(model, project=project),
180
+ target,
181
+ resource="model version",
182
+ name_attribute="version",
183
+ ).version
184
+
185
+
186
+ def _resolve_artifact_name(
187
+ client, model: str, version: str, target: str, project: str | int
188
+ ) -> str:
189
+ return common.resolve_named_resource(
190
+ client.models.artifacts.iter_all(model, version, project=project),
191
+ target,
192
+ resource="model artifact",
193
+ ).name
194
+
195
+
196
+ def _profile_author(profile_name: str | None) -> str:
197
+ resolved_name, _ = config.resolve_profile(profile_name)
198
+ claims = auth.get_token_claims(resolved_name)
199
+ author = claims.get("preferred_username") or claims.get("name") or claims.get("sub")
200
+ if not isinstance(author, str) or not author:
201
+ raise ValidationError("Current profile has no usable username claim.")
202
+ return author
203
+
204
+
205
+ def _resolve_import_target(
206
+ client,
207
+ target: str,
208
+ version: str,
209
+ project: str | int,
210
+ *,
211
+ require_existing: bool,
212
+ description: str | None,
213
+ ) -> tuple[str, str]:
214
+ models = list(client.models.iter_all(project=project))
215
+ try:
216
+ model = common.resolve_named_resource(
217
+ models,
218
+ target,
219
+ resource="model",
220
+ )
221
+ except NotFoundError:
222
+ if require_existing:
223
+ raise ValidationError(f"Existing model required: {target}") from None
224
+ return target, "new"
225
+
226
+ if description:
227
+ raise ValidationError(
228
+ "--target-model-description is only valid for a new model."
229
+ )
230
+ if any(
231
+ item.version == version
232
+ for item in client.models.versions.iter_all(model.name, project=project)
233
+ ):
234
+ raise ValidationError(f"Model version already exists: {model.name}/{version}")
235
+ return model.name, "existing"
236
+
237
+
238
+ def _resolved_uri(uri: str, resolved_root: str | None) -> str:
239
+ if not resolved_root:
240
+ return uri
241
+ parsed = urlsplit(uri)
242
+ if parsed.scheme != "pvc" or not parsed.netloc:
243
+ return uri
244
+ return f"pvc://{parsed.netloc}/{resolved_root.lstrip('/')}"
245
+
246
+
247
+ def _volume_uri(volume: str, path: str) -> str:
248
+ volume = volume.strip()
249
+ path = path.strip()
250
+ if not volume:
251
+ raise typer.BadParameter("--volume must not be empty.")
252
+ if not path:
253
+ raise typer.BadParameter("--path must not be empty.")
254
+ return f"pvc://{volume}/{path.lstrip('/')}"
255
+
256
+
257
+ def _print_object(
258
+ value: Any,
259
+ output: common.OutputChoice,
260
+ rows: list[list[Any]],
261
+ ) -> None:
262
+ if output == common.OutputChoice.json:
263
+ common.print_json(value)
264
+ else:
265
+ common.print_table(["Field", "Value"], rows)
266
+
267
+
268
+ def _model_rows(model) -> list[list[Any]]:
269
+ return [
270
+ ["ID", model.id],
271
+ ["Name", model.name],
272
+ ["Description", model.description or ""],
273
+ ["Author", model.author or ""],
274
+ ["Versions", model.version_count],
275
+ ["Created", model.created_at],
276
+ ["Updated", model.updated_at],
277
+ ]
278
+
279
+
280
+ def _version_rows(version) -> list[list[Any]]:
281
+ return [
282
+ ["ID", version.id],
283
+ ["Version", version.version],
284
+ ["State", version.state],
285
+ ["Description", version.description or ""],
286
+ ["Author", version.author or ""],
287
+ ["Source Type", version.source_type or ""],
288
+ ["Source Ref", version.source_ref or ""],
289
+ ["Artifacts", len(version.artifacts)],
290
+ ["Created", version.created_at],
291
+ ["Updated", version.updated_at],
292
+ ]
293
+
294
+
295
+ def _artifact_rows(artifact) -> list[list[Any]]:
296
+ return [
297
+ ["ID", artifact.id],
298
+ ["Name", artifact.name],
299
+ ["Format", artifact.format or ""],
300
+ ["Platform", artifact.platform or ""],
301
+ ["URI", artifact.uri or ""],
302
+ ["Storage Key", artifact.storage_key or ""],
303
+ ["Size Bytes", artifact.size_bytes or ""],
304
+ ["Created", artifact.created_at or ""],
305
+ ["Updated", artifact.updated_at or ""],
306
+ ]
307
+
308
+
309
+ def _bounded_error(value: str | None) -> str:
310
+ return common.bounded_error(value)
311
+
312
+
313
+ def _import_payload(job) -> dict[str, Any]:
314
+ payload = common.serialize(job)
315
+ payload["errorMessage"] = _bounded_error(payload.get("errorMessage"))
316
+ return payload
317
+
318
+
319
+ def _import_rows(job) -> list[list[Any]]:
320
+ return [
321
+ ["ID", job.id],
322
+ ["Source Type", job.source_type],
323
+ ["Source Ref", job.source_ref],
324
+ ["Target Model", job.target_model],
325
+ ["Target Version", job.target_version],
326
+ ["Storage PVC", job.storage_pvc],
327
+ ["State", job.state],
328
+ ["Error", _bounded_error(job.error_message)],
329
+ ["Artifact URI", job.artifact_uri or ""],
330
+ ["Created", job.created_at],
331
+ ["Updated", job.updated_at],
332
+ ]
333
+
334
+
335
+ def _print_import(job, output: common.OutputChoice) -> None:
336
+ if output == common.OutputChoice.json:
337
+ common.print_json(_import_payload(job))
338
+ else:
339
+ common.print_table(["Field", "Value"], _import_rows(job))
340
+ if job.state == "failed":
341
+ raise typer.Exit(code=1)
342
+
343
+
344
+ @app.command("list")
345
+ def list_models(
346
+ project: ProjectOption = None,
347
+ project_id: ProjectIDOption = None,
348
+ search: str | None = typer.Option(
349
+ None, "--search", help="Search model names.", show_default=False
350
+ ),
351
+ page: PageOption = None,
352
+ limit: LimitOption = None,
353
+ profile_name: ProfileOption = None,
354
+ output: OutputOption = common.OutputChoice.table,
355
+ verbose: VerboseOption = False,
356
+ ):
357
+ with _client(project, project_id, profile_name, verbose) as (
358
+ client,
359
+ resolved_project,
360
+ ):
361
+ kwargs = {
362
+ "project": resolved_project,
363
+ "page": page,
364
+ "limit": limit,
365
+ }
366
+ if search is not None:
367
+ kwargs["search"] = search
368
+ result_page = client.models.list_page(**kwargs)
369
+
370
+ if output == common.OutputChoice.json:
371
+ common.print_json(result_page)
372
+ return
373
+ common.print_page_table(
374
+ result_page,
375
+ ["ID", "Name", "Description", "Versions"],
376
+ [
377
+ [
378
+ str(model.id),
379
+ model.name,
380
+ model.description or "",
381
+ str(model.version_count),
382
+ ]
383
+ for model in result_page.items
384
+ ],
385
+ )
386
+
387
+
388
+ @app.command("get")
389
+ def get_model(
390
+ target: str = typer.Argument(..., help="Model name or ID."),
391
+ project: ProjectOption = None,
392
+ project_id: ProjectIDOption = None,
393
+ profile_name: ProfileOption = None,
394
+ output: OutputOption = common.OutputChoice.table,
395
+ verbose: VerboseOption = False,
396
+ ):
397
+ with _client(project, project_id, profile_name, verbose) as (
398
+ client,
399
+ resolved_project,
400
+ ):
401
+ name = _resolve_model_name(client, target, resolved_project)
402
+ result = client.models.get(name, project=resolved_project)
403
+ _print_object(result, output, _model_rows(result))
404
+
405
+
406
+ @app.command("create")
407
+ def create_model(
408
+ name: str = typer.Argument(..., help="Model name."),
409
+ project: ProjectOption = None,
410
+ project_id: ProjectIDOption = None,
411
+ description: str | None = typer.Option(
412
+ None, "--description", help="Model description.", show_default=False
413
+ ),
414
+ author: str | None = typer.Option(
415
+ None, "--author", help="Model author.", show_default=False
416
+ ),
417
+ profile_name: ProfileOption = None,
418
+ output: OutputOption = common.OutputChoice.table,
419
+ verbose: VerboseOption = False,
420
+ ):
421
+ with _client(project, project_id, profile_name, verbose) as (
422
+ client,
423
+ resolved_project,
424
+ ):
425
+ kwargs: dict[str, Any] = {
426
+ "project": resolved_project,
427
+ "description": description,
428
+ }
429
+ if author is not None:
430
+ kwargs["author"] = author
431
+ result = client.models.create(name, **kwargs)
432
+ if output == common.OutputChoice.json:
433
+ common.print_json(result)
434
+ else:
435
+ common.console.print(f"[bold green]Model created:[/] {escape(result.name)}")
436
+
437
+
438
+ @app.command("update")
439
+ def update_model(
440
+ target: str = typer.Argument(..., help="Model name or ID."),
441
+ description: str = typer.Option(..., "--description", help="Model description."),
442
+ project: ProjectOption = None,
443
+ project_id: ProjectIDOption = None,
444
+ profile_name: ProfileOption = None,
445
+ output: OutputOption = common.OutputChoice.table,
446
+ verbose: VerboseOption = False,
447
+ ):
448
+ with _client(project, project_id, profile_name, verbose) as (
449
+ client,
450
+ resolved_project,
451
+ ):
452
+ name = _resolve_model_name(client, target, resolved_project)
453
+ result = client.models.update(
454
+ name,
455
+ project=resolved_project,
456
+ description=description,
457
+ )
458
+ _print_object(result, output, _model_rows(result))
459
+
460
+
461
+ @app.command("validate")
462
+ def validate_model(
463
+ uri: str = typer.Argument(..., help="Artifact PVC URI."),
464
+ project: ProjectOption = None,
465
+ project_id: ProjectIDOption = None,
466
+ platform: str | None = typer.Option(
467
+ None, "--platform", help="Target platform.", show_default=False
468
+ ),
469
+ model_name: str | None = typer.Option(
470
+ None, "--model", help="Model name.", show_default=False
471
+ ),
472
+ version: str | None = typer.Option(
473
+ None, "--version", help="Model version.", show_default=False
474
+ ),
475
+ force: bool = typer.Option(False, "--force", help="Force supported validation."),
476
+ profile_name: ProfileOption = None,
477
+ output: OutputOption = common.OutputChoice.table,
478
+ verbose: VerboseOption = False,
479
+ ):
480
+ with _client(project, project_id, profile_name, verbose) as (
481
+ client,
482
+ resolved_project,
483
+ ):
484
+ kwargs = {
485
+ "project": resolved_project,
486
+ "platform": platform,
487
+ "model_name": model_name,
488
+ "version": version,
489
+ }
490
+ if force:
491
+ kwargs["force"] = True
492
+ result = client.models.validate(uri, **kwargs)
493
+ _print_object(
494
+ result,
495
+ output,
496
+ [
497
+ ["URI", result.uri],
498
+ ["Format", result.format],
499
+ ["Size Bytes", result.size_bytes or ""],
500
+ ["Resolved Root", result.resolved_root or ""],
501
+ ["Model Files", result.model_file_count or ""],
502
+ ["Warnings", "; ".join(result.warnings)],
503
+ ],
504
+ )
505
+
506
+
507
+ @app.command("delete")
508
+ def delete_model(
509
+ target: str = typer.Argument(..., help="Model name or ID."),
510
+ project: ProjectOption = None,
511
+ project_id: ProjectIDOption = None,
512
+ profile_name: ProfileOption = None,
513
+ yes: bool = typer.Option(False, "--yes", help="Skip delete confirmation."),
514
+ verbose: VerboseOption = False,
515
+ ):
516
+ try:
517
+ resolved_project = common.resolve_cli_project(
518
+ project,
519
+ project_id,
520
+ profile_name=profile_name,
521
+ )
522
+ except Exception as exc:
523
+ common.handle_cli_error(exc, verbose=verbose)
524
+ common.confirm_delete(
525
+ resource="model",
526
+ target=f"{resolved_project}/{target}",
527
+ profile_name=profile_name,
528
+ yes=yes,
529
+ )
530
+ with _client(project, project_id, profile_name, verbose) as (
531
+ client,
532
+ resolved_project,
533
+ ):
534
+ name = _resolve_model_name(client, target, resolved_project)
535
+ client.models.delete(name, project=resolved_project)
536
+ common.console.print(f"[bold green]Model deleted:[/] {escape(name)}")
537
+
538
+
539
+ @version_app.command("list")
540
+ def list_versions(
541
+ model: str = typer.Argument(..., help="Model name or ID."),
542
+ project: ProjectOption = None,
543
+ project_id: ProjectIDOption = None,
544
+ page: PageOption = None,
545
+ limit: LimitOption = None,
546
+ profile_name: ProfileOption = None,
547
+ output: OutputOption = common.OutputChoice.table,
548
+ verbose: VerboseOption = False,
549
+ ):
550
+ with _client(project, project_id, profile_name, verbose) as (
551
+ client,
552
+ resolved_project,
553
+ ):
554
+ model_name = _resolve_model_name(client, model, resolved_project)
555
+ result_page = client.models.versions.list_page(
556
+ model_name,
557
+ project=resolved_project,
558
+ page=page,
559
+ limit=limit,
560
+ )
561
+ if output == common.OutputChoice.json:
562
+ common.print_json(result_page)
563
+ return
564
+ common.print_page_table(
565
+ result_page,
566
+ ["ID", "Version", "State", "Description", "Artifacts"],
567
+ [
568
+ [
569
+ str(item.id),
570
+ item.version,
571
+ item.state,
572
+ item.description or "",
573
+ str(len(item.artifacts)),
574
+ ]
575
+ for item in result_page.items
576
+ ],
577
+ )
578
+
579
+
580
+ @version_app.command("get")
581
+ def get_version(
582
+ model: str = typer.Argument(..., help="Model name or ID."),
583
+ version: str = typer.Argument(..., help="Version name or ID."),
584
+ project: ProjectOption = None,
585
+ project_id: ProjectIDOption = None,
586
+ profile_name: ProfileOption = None,
587
+ output: OutputOption = common.OutputChoice.table,
588
+ verbose: VerboseOption = False,
589
+ ):
590
+ with _client(project, project_id, profile_name, verbose) as (
591
+ client,
592
+ resolved_project,
593
+ ):
594
+ model_name = _resolve_model_name(client, model, resolved_project)
595
+ version_name = _resolve_version_name(
596
+ client, model_name, version, resolved_project
597
+ )
598
+ result = client.models.versions.get(
599
+ model_name,
600
+ version_name,
601
+ project=resolved_project,
602
+ )
603
+ _print_object(result, output, _version_rows(result))
604
+
605
+
606
+ @version_app.command("create")
607
+ def create_version(
608
+ model: str = typer.Argument(..., help="Model name or ID."),
609
+ version: str = typer.Argument(..., help="New version name."),
610
+ project: ProjectOption = None,
611
+ project_id: ProjectIDOption = None,
612
+ volume: str = typer.Option(..., "--volume", help="Volume name."),
613
+ path: str = typer.Option(..., "--path", help="Existing artifact path."),
614
+ format: str | None = typer.Option(
615
+ None, "--format", help="Artifact format.", show_default=False
616
+ ),
617
+ description: str | None = typer.Option(
618
+ None, "--description", help="Version description.", show_default=False
619
+ ),
620
+ skip_validation: bool = typer.Option(
621
+ False,
622
+ "--skip-validation",
623
+ help="Create without validating the artifact URI.",
624
+ ),
625
+ profile_name: ProfileOption = None,
626
+ output: OutputOption = common.OutputChoice.table,
627
+ verbose: VerboseOption = False,
628
+ ):
629
+ uri = _volume_uri(volume, path)
630
+ with _client(project, project_id, profile_name, verbose) as (
631
+ client,
632
+ resolved_project,
633
+ ):
634
+ model_name = _resolve_model_name(client, model, resolved_project)
635
+ resolved_uri = uri
636
+ resolved_format = format
637
+ resolved_metadata = None
638
+ if not skip_validation:
639
+ validation = client.models.validate(
640
+ uri,
641
+ project=resolved_project,
642
+ model_name=model_name,
643
+ version=version,
644
+ )
645
+ resolved_uri = _resolved_uri(uri, validation.resolved_root)
646
+ resolved_format = resolved_format or validation.format
647
+ resolved_metadata = validation.metadata
648
+ artifact = {
649
+ "uri": resolved_uri,
650
+ "format": resolved_format,
651
+ "metadata": resolved_metadata,
652
+ }
653
+ artifact = {key: value for key, value in artifact.items() if value is not None}
654
+ result = client.models.versions.create(
655
+ model_name,
656
+ version,
657
+ artifact=artifact,
658
+ project=resolved_project,
659
+ description=description,
660
+ author=_profile_author(profile_name),
661
+ )
662
+ if output == common.OutputChoice.json:
663
+ common.print_json(result)
664
+ else:
665
+ common.console.print(
666
+ f"[bold green]Model version created:[/] "
667
+ f"{escape(model_name)}/{escape(result.version)}"
668
+ )
669
+
670
+
671
+ @version_app.command("update")
672
+ def update_version(
673
+ model: str = typer.Argument(..., help="Model name or ID."),
674
+ version: str = typer.Argument(..., help="Version name or ID."),
675
+ project: ProjectOption = None,
676
+ project_id: ProjectIDOption = None,
677
+ description: str | None = typer.Option(
678
+ None, "--description", help="Version description.", show_default=False
679
+ ),
680
+ metadata: str | None = typer.Option(
681
+ None, "--metadata", help="Version metadata JSON object.", show_default=False
682
+ ),
683
+ profile_name: ProfileOption = None,
684
+ output: OutputOption = common.OutputChoice.table,
685
+ verbose: VerboseOption = False,
686
+ ):
687
+ if description is None and metadata is None:
688
+ raise typer.BadParameter("Provide --description or --metadata.")
689
+ parsed_metadata = _json_object(metadata, "--metadata")
690
+ with _client(project, project_id, profile_name, verbose) as (
691
+ client,
692
+ resolved_project,
693
+ ):
694
+ model_name = _resolve_model_name(client, model, resolved_project)
695
+ version_name = _resolve_version_name(
696
+ client, model_name, version, resolved_project
697
+ )
698
+ result = client.models.versions.update(
699
+ model_name,
700
+ version_name,
701
+ project=resolved_project,
702
+ description=description,
703
+ metadata=parsed_metadata,
704
+ )
705
+ _print_object(result, output, _version_rows(result))
706
+
707
+
708
+ @version_app.command("delete")
709
+ def delete_version(
710
+ model: str = typer.Argument(..., help="Model name or ID."),
711
+ version: str = typer.Argument(..., help="Version name or ID."),
712
+ project: ProjectOption = None,
713
+ project_id: ProjectIDOption = None,
714
+ profile_name: ProfileOption = None,
715
+ yes: bool = typer.Option(False, "--yes", help="Skip delete confirmation."),
716
+ verbose: VerboseOption = False,
717
+ ):
718
+ try:
719
+ resolved_project = common.resolve_cli_project(
720
+ project,
721
+ project_id,
722
+ profile_name=profile_name,
723
+ )
724
+ except Exception as exc:
725
+ common.handle_cli_error(exc, verbose=verbose)
726
+ common.confirm_delete(
727
+ resource="model version",
728
+ target=f"{resolved_project}/{model}/{version}",
729
+ profile_name=profile_name,
730
+ yes=yes,
731
+ )
732
+ with _client(project, project_id, profile_name, verbose) as (
733
+ client,
734
+ resolved_project,
735
+ ):
736
+ model_name = _resolve_model_name(client, model, resolved_project)
737
+ version_name = _resolve_version_name(
738
+ client, model_name, version, resolved_project
739
+ )
740
+ client.models.versions.delete(
741
+ model_name,
742
+ version_name,
743
+ project=resolved_project,
744
+ )
745
+ common.console.print(
746
+ f"[bold green]Model version deleted:[/] "
747
+ f"{escape(model_name)}/{escape(version_name)}"
748
+ )
749
+
750
+
751
+ @artifact_app.command("list")
752
+ def list_artifacts(
753
+ model: str = typer.Argument(..., help="Model name or ID."),
754
+ version: str = typer.Argument(..., help="Version name or ID."),
755
+ project: ProjectOption = None,
756
+ project_id: ProjectIDOption = None,
757
+ include_trial_artifacts: bool = typer.Option(
758
+ False,
759
+ "--include-trial-artifacts",
760
+ help="Include optimizer trial artifacts.",
761
+ ),
762
+ profile_name: ProfileOption = None,
763
+ output: OutputOption = common.OutputChoice.table,
764
+ verbose: VerboseOption = False,
765
+ ):
766
+ with _client(project, project_id, profile_name, verbose) as (
767
+ client,
768
+ resolved_project,
769
+ ):
770
+ model_name = _resolve_model_name(client, model, resolved_project)
771
+ version_name = _resolve_version_name(
772
+ client, model_name, version, resolved_project
773
+ )
774
+ result_page = client.models.artifacts.list_page(
775
+ model_name,
776
+ version_name,
777
+ project=resolved_project,
778
+ include_trial_artifacts=include_trial_artifacts,
779
+ )
780
+ if output == common.OutputChoice.json:
781
+ common.print_json(result_page)
782
+ return
783
+ common.print_page_table(
784
+ result_page,
785
+ ["ID", "Name", "Format", "Platform", "URI", "Size Bytes"],
786
+ [
787
+ [
788
+ str(item.id),
789
+ item.name,
790
+ item.format or "",
791
+ item.platform or "",
792
+ item.uri or "",
793
+ str(item.size_bytes or ""),
794
+ ]
795
+ for item in result_page.items
796
+ ],
797
+ )
798
+
799
+
800
+ @artifact_app.command("get")
801
+ def get_artifact(
802
+ model: str = typer.Argument(..., help="Model name or ID."),
803
+ version: str = typer.Argument(..., help="Version name or ID."),
804
+ artifact: str = typer.Argument(..., help="Artifact name or ID."),
805
+ project: ProjectOption = None,
806
+ project_id: ProjectIDOption = None,
807
+ profile_name: ProfileOption = None,
808
+ output: OutputOption = common.OutputChoice.table,
809
+ verbose: VerboseOption = False,
810
+ ):
811
+ with _client(project, project_id, profile_name, verbose) as (
812
+ client,
813
+ resolved_project,
814
+ ):
815
+ model_name = _resolve_model_name(client, model, resolved_project)
816
+ version_name = _resolve_version_name(
817
+ client, model_name, version, resolved_project
818
+ )
819
+ artifact_name = _resolve_artifact_name(
820
+ client,
821
+ model_name,
822
+ version_name,
823
+ artifact,
824
+ resolved_project,
825
+ )
826
+ result = client.models.artifacts.get(
827
+ model_name,
828
+ version_name,
829
+ artifact_name,
830
+ project=resolved_project,
831
+ )
832
+ _print_object(result, output, _artifact_rows(result))
833
+
834
+
835
+ @artifact_app.command("create")
836
+ def create_artifact(
837
+ model: str = typer.Argument(..., help="Model name or ID."),
838
+ version: str = typer.Argument(..., help="Version name or ID."),
839
+ name: str = typer.Argument(..., help="Artifact name."),
840
+ project: ProjectOption = None,
841
+ project_id: ProjectIDOption = None,
842
+ volume: str = typer.Option(..., "--volume", help="Volume name."),
843
+ path: str = typer.Option(..., "--path", help="Existing artifact path."),
844
+ format: str | None = typer.Option(
845
+ None, "--format", help="Artifact format.", show_default=False
846
+ ),
847
+ platform: str | None = typer.Option(
848
+ None, "--platform", help="Artifact platform.", show_default=False
849
+ ),
850
+ skip_validation: bool = typer.Option(
851
+ False,
852
+ "--skip-validation",
853
+ help="Create without validating the artifact URI.",
854
+ ),
855
+ profile_name: ProfileOption = None,
856
+ output: OutputOption = common.OutputChoice.table,
857
+ verbose: VerboseOption = False,
858
+ ):
859
+ uri = _volume_uri(volume, path)
860
+ with _client(project, project_id, profile_name, verbose) as (
861
+ client,
862
+ resolved_project,
863
+ ):
864
+ model_name = _resolve_model_name(client, model, resolved_project)
865
+ version_name = _resolve_version_name(
866
+ client, model_name, version, resolved_project
867
+ )
868
+ resolved_uri = uri
869
+ resolved_format = format
870
+ resolved_metadata = None
871
+ if not skip_validation:
872
+ validation = client.models.validate(
873
+ uri,
874
+ project=resolved_project,
875
+ platform=platform,
876
+ model_name=model_name,
877
+ version=version_name,
878
+ )
879
+ resolved_uri = _resolved_uri(uri, validation.resolved_root)
880
+ resolved_format = resolved_format or validation.format
881
+ resolved_metadata = validation.metadata
882
+ kwargs = {
883
+ "format": resolved_format,
884
+ "platform": platform,
885
+ "metadata": resolved_metadata,
886
+ }
887
+ result = client.models.artifacts.create(
888
+ model_name,
889
+ version_name,
890
+ name,
891
+ resolved_uri,
892
+ project=resolved_project,
893
+ **{key: value for key, value in kwargs.items() if value is not None},
894
+ )
895
+ if output == common.OutputChoice.json:
896
+ common.print_json(result)
897
+ else:
898
+ common.console.print(
899
+ f"[bold green]Model artifact created:[/] "
900
+ f"{escape(model_name)}/{escape(version_name)}/{escape(result.name)}"
901
+ )
902
+
903
+
904
+ @artifact_app.command("delete")
905
+ def delete_artifact(
906
+ model: str = typer.Argument(..., help="Model name or ID."),
907
+ version: str = typer.Argument(..., help="Version name or ID."),
908
+ artifact: str = typer.Argument(..., help="Artifact name or ID."),
909
+ project: ProjectOption = None,
910
+ project_id: ProjectIDOption = None,
911
+ profile_name: ProfileOption = None,
912
+ yes: bool = typer.Option(False, "--yes", help="Skip delete confirmation."),
913
+ verbose: VerboseOption = False,
914
+ ):
915
+ try:
916
+ resolved_project = common.resolve_cli_project(
917
+ project,
918
+ project_id,
919
+ profile_name=profile_name,
920
+ )
921
+ except Exception as exc:
922
+ common.handle_cli_error(exc, verbose=verbose)
923
+ common.confirm_delete(
924
+ resource="model artifact",
925
+ target=f"{resolved_project}/{model}/{version}/{artifact}",
926
+ profile_name=profile_name,
927
+ yes=yes,
928
+ )
929
+ with _client(project, project_id, profile_name, verbose) as (
930
+ client,
931
+ resolved_project,
932
+ ):
933
+ model_name = _resolve_model_name(client, model, resolved_project)
934
+ version_name = _resolve_version_name(
935
+ client, model_name, version, resolved_project
936
+ )
937
+ artifact_name = _resolve_artifact_name(
938
+ client,
939
+ model_name,
940
+ version_name,
941
+ artifact,
942
+ resolved_project,
943
+ )
944
+ client.models.artifacts.delete(
945
+ model_name,
946
+ version_name,
947
+ artifact_name,
948
+ project=resolved_project,
949
+ )
950
+ common.console.print(
951
+ f"[bold green]Model artifact deleted:[/] "
952
+ f"{escape(model_name)}/{escape(version_name)}/{escape(artifact_name)}"
953
+ )
954
+
955
+
956
+ def _import_list(
957
+ provider,
958
+ *,
959
+ project,
960
+ project_id,
961
+ page,
962
+ limit,
963
+ profile_name,
964
+ output,
965
+ verbose,
966
+ ) -> None:
967
+ with _client(project, project_id, profile_name, verbose) as (
968
+ client,
969
+ resolved_project,
970
+ ):
971
+ resource = getattr(client.models.imports, provider)
972
+ result_page = resource.list_page(
973
+ project=resolved_project,
974
+ page=page,
975
+ limit=limit,
976
+ )
977
+ if output == common.OutputChoice.json:
978
+ payload = common.serialize(result_page)
979
+ payload["items"] = [_import_payload(item) for item in result_page.items]
980
+ common.print_json(payload)
981
+ return
982
+ common.print_page_table(
983
+ result_page,
984
+ ["ID", "Source", "Target Model", "Target Version", "State", "Error"],
985
+ [
986
+ [
987
+ str(item.id),
988
+ item.source_ref,
989
+ item.target_model,
990
+ item.target_version,
991
+ item.state,
992
+ _bounded_error(item.error_message),
993
+ ]
994
+ for item in result_page.items
995
+ ],
996
+ )
997
+
998
+
999
+ def _import_wait(
1000
+ provider,
1001
+ import_id,
1002
+ *,
1003
+ project,
1004
+ project_id,
1005
+ timeout,
1006
+ interval,
1007
+ profile_name,
1008
+ output,
1009
+ verbose,
1010
+ ) -> None:
1011
+ with _client(project, project_id, profile_name, verbose) as (
1012
+ client,
1013
+ resolved_project,
1014
+ ):
1015
+ resource = getattr(client.models.imports, provider)
1016
+ result = resource.wait(
1017
+ import_id,
1018
+ project=resolved_project,
1019
+ timeout=timeout,
1020
+ interval=interval,
1021
+ )
1022
+ _print_import(result, output)
1023
+
1024
+
1025
+ @huggingface_app.command("create")
1026
+ def create_huggingface_import(
1027
+ repository: str = typer.Argument(..., help="Hugging Face repository."),
1028
+ target_model: str = typer.Option(
1029
+ ..., "--target-model", help="Target model name or ID."
1030
+ ),
1031
+ target_version: str = typer.Option(
1032
+ ..., "--target-version", help="Target version name."
1033
+ ),
1034
+ project: ProjectOption = None,
1035
+ project_id: ProjectIDOption = None,
1036
+ target_model_description: str | None = typer.Option(
1037
+ None,
1038
+ "--target-model-description",
1039
+ help="Description when creating a new model.",
1040
+ show_default=False,
1041
+ ),
1042
+ storage_pvc: str | None = typer.Option(
1043
+ None, "--storage-pvc", help="Destination PVC.", show_default=False
1044
+ ),
1045
+ require_existing_model: bool = typer.Option(
1046
+ False,
1047
+ "--require-existing-model",
1048
+ help="Fail instead of creating a missing target model.",
1049
+ ),
1050
+ wait: bool = typer.Option(False, "--wait", help="Wait for terminal state."),
1051
+ timeout: float = typer.Option(
1052
+ 1800, "--timeout", min=0.001, help="Wait timeout in seconds."
1053
+ ),
1054
+ interval: float = typer.Option(
1055
+ 5, "--interval", min=0.001, help="Polling interval in seconds."
1056
+ ),
1057
+ profile_name: ProfileOption = None,
1058
+ output: OutputOption = common.OutputChoice.table,
1059
+ verbose: VerboseOption = False,
1060
+ ):
1061
+ with _client(project, project_id, profile_name, verbose) as (
1062
+ client,
1063
+ resolved_project,
1064
+ ):
1065
+ target_model_description = (
1066
+ target_model_description.strip() or None
1067
+ if target_model_description is not None
1068
+ else None
1069
+ )
1070
+ resolved_target, target_model_mode = _resolve_import_target(
1071
+ client,
1072
+ target_model,
1073
+ target_version,
1074
+ resolved_project,
1075
+ require_existing=require_existing_model,
1076
+ description=target_model_description,
1077
+ )
1078
+ resource = client.models.imports.huggingface
1079
+ result = resource.create(
1080
+ repository,
1081
+ target_model_mode=target_model_mode,
1082
+ target_model=resolved_target,
1083
+ target_model_description=(
1084
+ target_model_description if target_model_mode == "new" else None
1085
+ ),
1086
+ target_version=target_version,
1087
+ storage_pvc=storage_pvc,
1088
+ project=resolved_project,
1089
+ )
1090
+ if wait:
1091
+ typer.echo(
1092
+ f"Import created: {result.id} state={result.state}; resume with "
1093
+ f"'nufi model import huggingface wait {result.id}'",
1094
+ err=True,
1095
+ )
1096
+ result = resource.wait(
1097
+ result.id,
1098
+ project=resolved_project,
1099
+ timeout=timeout,
1100
+ interval=interval,
1101
+ )
1102
+ _print_import(result, output)
1103
+
1104
+
1105
+ @huggingface_app.command("list")
1106
+ def list_huggingface_imports(
1107
+ project: ProjectOption = None,
1108
+ project_id: ProjectIDOption = None,
1109
+ page: PageOption = None,
1110
+ limit: LimitOption = None,
1111
+ profile_name: ProfileOption = None,
1112
+ output: OutputOption = common.OutputChoice.table,
1113
+ verbose: VerboseOption = False,
1114
+ ):
1115
+ _import_list(
1116
+ "huggingface",
1117
+ project=project,
1118
+ project_id=project_id,
1119
+ page=page,
1120
+ limit=limit,
1121
+ profile_name=profile_name,
1122
+ output=output,
1123
+ verbose=verbose,
1124
+ )
1125
+
1126
+
1127
+ @huggingface_app.command("wait")
1128
+ def wait_huggingface_import(
1129
+ import_id: int = typer.Argument(..., min=1, help="Import ID."),
1130
+ project: ProjectOption = None,
1131
+ project_id: ProjectIDOption = None,
1132
+ timeout: float = typer.Option(
1133
+ 1800, "--timeout", min=0.001, help="Wait timeout in seconds."
1134
+ ),
1135
+ interval: float = typer.Option(
1136
+ 5, "--interval", min=0.001, help="Polling interval in seconds."
1137
+ ),
1138
+ profile_name: ProfileOption = None,
1139
+ output: OutputOption = common.OutputChoice.table,
1140
+ verbose: VerboseOption = False,
1141
+ ):
1142
+ _import_wait(
1143
+ "huggingface",
1144
+ import_id,
1145
+ project=project,
1146
+ project_id=project_id,
1147
+ timeout=timeout,
1148
+ interval=interval,
1149
+ profile_name=profile_name,
1150
+ output=output,
1151
+ verbose=verbose,
1152
+ )
1153
+
1154
+
1155
+ @huggingface_app.command("mappings")
1156
+ def list_huggingface_mappings(
1157
+ project: ProjectOption = None,
1158
+ project_id: ProjectIDOption = None,
1159
+ profile_name: ProfileOption = None,
1160
+ output: OutputOption = common.OutputChoice.table,
1161
+ verbose: VerboseOption = False,
1162
+ ):
1163
+ with _client(project, project_id, profile_name, verbose) as (
1164
+ client,
1165
+ resolved_project,
1166
+ ):
1167
+ result = client.models.imports.huggingface.mappings(project=resolved_project)
1168
+ if output == common.OutputChoice.json:
1169
+ common.print_json(result)
1170
+ return
1171
+ common.print_table(
1172
+ [
1173
+ "Import ID",
1174
+ "Repository",
1175
+ "Revision",
1176
+ "Commit",
1177
+ "Target Model",
1178
+ "Target Version",
1179
+ "Artifact URI",
1180
+ ],
1181
+ [
1182
+ [
1183
+ str(item.import_job_id),
1184
+ item.repository,
1185
+ item.revision,
1186
+ item.commit,
1187
+ item.target_model,
1188
+ item.target_version,
1189
+ item.artifact_uri,
1190
+ ]
1191
+ for item in result
1192
+ ],
1193
+ )
1194
+
1195
+
1196
+ @mlflow_app.command("create")
1197
+ def create_mlflow_import(
1198
+ mlflow_url: str = typer.Argument(..., help="MLflow base URL."),
1199
+ run_id: str = typer.Argument(..., help="MLflow run ID."),
1200
+ artifact_path: str = typer.Argument(..., help="MLflow artifact path."),
1201
+ target_model: str = typer.Option(
1202
+ ..., "--target-model", help="Target model name or ID."
1203
+ ),
1204
+ target_version: str = typer.Option(
1205
+ ..., "--target-version", help="Target version name."
1206
+ ),
1207
+ project: ProjectOption = None,
1208
+ project_id: ProjectIDOption = None,
1209
+ target_model_description: str | None = typer.Option(
1210
+ None,
1211
+ "--target-model-description",
1212
+ help="Description when creating a new model.",
1213
+ show_default=False,
1214
+ ),
1215
+ storage_pvc: str | None = typer.Option(
1216
+ None, "--storage-pvc", help="Destination PVC.", show_default=False
1217
+ ),
1218
+ require_existing_model: bool = typer.Option(
1219
+ False,
1220
+ "--require-existing-model",
1221
+ help="Fail instead of creating a missing target model.",
1222
+ ),
1223
+ wait: bool = typer.Option(False, "--wait", help="Wait for terminal state."),
1224
+ timeout: float = typer.Option(
1225
+ 1800, "--timeout", min=0.001, help="Wait timeout in seconds."
1226
+ ),
1227
+ interval: float = typer.Option(
1228
+ 5, "--interval", min=0.001, help="Polling interval in seconds."
1229
+ ),
1230
+ profile_name: ProfileOption = None,
1231
+ output: OutputOption = common.OutputChoice.table,
1232
+ verbose: VerboseOption = False,
1233
+ ):
1234
+ with _client(project, project_id, profile_name, verbose) as (
1235
+ client,
1236
+ resolved_project,
1237
+ ):
1238
+ target_model_description = (
1239
+ target_model_description.strip() or None
1240
+ if target_model_description is not None
1241
+ else None
1242
+ )
1243
+ resolved_target, target_model_mode = _resolve_import_target(
1244
+ client,
1245
+ target_model,
1246
+ target_version,
1247
+ resolved_project,
1248
+ require_existing=require_existing_model,
1249
+ description=target_model_description,
1250
+ )
1251
+ resource = client.models.imports.mlflow
1252
+ result = resource.create(
1253
+ mlflow_url,
1254
+ run_id,
1255
+ artifact_path,
1256
+ target_model_mode=target_model_mode,
1257
+ target_model=resolved_target,
1258
+ target_model_description=(
1259
+ target_model_description if target_model_mode == "new" else None
1260
+ ),
1261
+ target_version=target_version,
1262
+ storage_pvc=storage_pvc,
1263
+ project=resolved_project,
1264
+ )
1265
+ if wait:
1266
+ typer.echo(
1267
+ f"Import created: {result.id} state={result.state}; resume with "
1268
+ f"'nufi model import mlflow wait {result.id}'",
1269
+ err=True,
1270
+ )
1271
+ result = resource.wait(
1272
+ result.id,
1273
+ project=resolved_project,
1274
+ timeout=timeout,
1275
+ interval=interval,
1276
+ )
1277
+ _print_import(result, output)
1278
+
1279
+
1280
+ @mlflow_app.command("list")
1281
+ def list_mlflow_imports(
1282
+ project: ProjectOption = None,
1283
+ project_id: ProjectIDOption = None,
1284
+ page: PageOption = None,
1285
+ limit: LimitOption = None,
1286
+ profile_name: ProfileOption = None,
1287
+ output: OutputOption = common.OutputChoice.table,
1288
+ verbose: VerboseOption = False,
1289
+ ):
1290
+ _import_list(
1291
+ "mlflow",
1292
+ project=project,
1293
+ project_id=project_id,
1294
+ page=page,
1295
+ limit=limit,
1296
+ profile_name=profile_name,
1297
+ output=output,
1298
+ verbose=verbose,
1299
+ )
1300
+
1301
+
1302
+ @mlflow_app.command("get")
1303
+ def get_mlflow_import(
1304
+ import_id: int = typer.Argument(..., min=1, help="Import ID."),
1305
+ project: ProjectOption = None,
1306
+ project_id: ProjectIDOption = None,
1307
+ profile_name: ProfileOption = None,
1308
+ output: OutputOption = common.OutputChoice.table,
1309
+ verbose: VerboseOption = False,
1310
+ ):
1311
+ with _client(project, project_id, profile_name, verbose) as (
1312
+ client,
1313
+ resolved_project,
1314
+ ):
1315
+ result = client.models.imports.mlflow.get(
1316
+ import_id,
1317
+ project=resolved_project,
1318
+ )
1319
+ _print_object(result, output, _import_rows(result))
1320
+
1321
+
1322
+ @mlflow_app.command("wait")
1323
+ def wait_mlflow_import(
1324
+ import_id: int = typer.Argument(..., min=1, help="Import ID."),
1325
+ project: ProjectOption = None,
1326
+ project_id: ProjectIDOption = None,
1327
+ timeout: float = typer.Option(
1328
+ 1800, "--timeout", min=0.001, help="Wait timeout in seconds."
1329
+ ),
1330
+ interval: float = typer.Option(
1331
+ 5, "--interval", min=0.001, help="Polling interval in seconds."
1332
+ ),
1333
+ profile_name: ProfileOption = None,
1334
+ output: OutputOption = common.OutputChoice.table,
1335
+ verbose: VerboseOption = False,
1336
+ ):
1337
+ _import_wait(
1338
+ "mlflow",
1339
+ import_id,
1340
+ project=project,
1341
+ project_id=project_id,
1342
+ timeout=timeout,
1343
+ interval=interval,
1344
+ profile_name=profile_name,
1345
+ output=output,
1346
+ verbose=verbose,
1347
+ )