Skip to content

Commit

Permalink
feat: model registry create CLI (#787)
Browse files Browse the repository at this point in the history
  • Loading branch information
sidneyw committed Jun 29, 2020
1 parent 2e10c64 commit a6f4114
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cli/determined_cli/model.py
Expand Up @@ -11,6 +11,7 @@
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)],
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -74,6 +84,7 @@ def describe(args: Namespace) -> None:
),
Arg("--json", action="store_true", help="print as JSON"),
],
is_default=True,
),
Cmd(
"describe",
Expand All @@ -84,6 +95,16 @@ def describe(args: Namespace) -> None:
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]

0 comments on commit a6f4114

Please sign in to comment.