feat: model registry create CLI
@@ -11,6 +11,7 @@ from .declarative_argparse import Arg, Cmd
def render_model(model: Model) -> None:
table = [
["Name", model.name],
+ ["Description", model.description],
["Creation Time", model.creation_time],
["Last Updated Time", model.last_updated_time],
["Metadata", json.dumps(model.metadata or {}, indent=4)],
@@ -38,6 +39,15 @@ def list_models(args: Namespace) -> None:
render.tabulate_or_csv(headers, values, False)
+def create(args: Namespace) -> None:
+ model = Determined(args.master, None).create_model(args.name, args.description)
+
+ if args.json:
+ print(json.dumps(model.to_json(), indent=2))
+ else:
+ render_model(model)
+
+
def describe(args: Namespace) -> None:
model = Determined(args.master, None).get_model(args.name)
@@ -74,6 +84,7 @@ args_description = [
),
Arg("--json", action="store_true", help="print as JSON"),
],
+ is_default=True,
),
Cmd(
"describe",
@@ -84,6 +95,16 @@ args_description = [
Arg("--json", action="store_true", help="print as JSON"),
],
),
+ Cmd(
+ "create",
+ create,
+ "create model",
+ [
+ Arg("name", type=str, help="unique name of the model"),
+ Arg("--description", type=str, help="description of the model"),
+ Arg("--json", action="store_true", help="print as JSON"),
+ ],
+ ),
],
)
] # type: List[Any]
