Fix docker_cmd projection in backwards compatibility

Fix support to clear input/output models and docker_cmd in backwards compatibility mode
Fix schema
This commit is contained in:
allegroai 2021-05-03 18:06:39 +03:00
parent 3d73d60826
commit dc9623e964
5 changed files with 42 additions and 35 deletions

View File

@ -185,6 +185,7 @@ def escape_paths(paths: Sequence[str]) -> Sequence[str]:
for old_prefix, new_prefix in (
("execution.parameters", f"hyperparams.{hyperparams_default_section}"),
("execution.model_desc", f"configuration"),
("execution.docker_cmd", "container")
):
path: str
paths = [path.replace(old_prefix, new_prefix) for path in paths]

View File

@ -1,13 +1,11 @@
metadata {
type: array
items {
metadata_item {
type: object
properties {
key {
type: string
description: The key uniquely identifying the metadata item inside the given entity
}
tyoe {
type {
type: string
description: The type of the metadata item
}
@ -16,7 +14,6 @@ metadata {
description: The value stored in the metadata item
}
}
}
}
credentials {
type: object

View File

@ -92,6 +92,11 @@ _definitions {
type: object
additionalProperties: true
}
metadata {
type: array
description: "Model metadata"
items {"$ref": "#/definitions/metadata_item"}
}
}
}
published_task_item {
@ -473,8 +478,9 @@ create {
}
"2.13": ${create."2.1"} {
metadata {
type: array
description: "Model metadata"
"$ref": "#/definitions/metadata"
items {"$ref": "#/definitions/metadata_item"}
}
}
}
@ -567,8 +573,9 @@ edit {
}
"2.13": ${edit."2.1"} {
metadata {
type: array
description: "Model metadata"
"$ref": "#/definitions/metadata"
items {"$ref": "#/definitions/metadata_item"}
}
}
}
@ -649,8 +656,9 @@ update {
}
"2.13": ${update."2.1"} {
metadata {
type: array
description: "Model metadata"
"$ref": "#/definitions/metadata"
items {"$ref": "#/definitions/metadata_item"}
}
}
}
@ -904,8 +912,9 @@ add_or_update_metadata {
type: string
}
metadata {
type: array
description: "Metadata items to add or update"
"$ref": "#/definitions/metadata"
items {"$ref": "#/definitions/metadata_item"}
}
}
}

View File

@ -79,8 +79,9 @@ _definitions {
items { "$ref": "#/definitions/entry" }
}
metadata {
type: array
description: "Queue metadata"
"$ref": "#/definitions/metadata"
items {"$ref": "#/definitions/metadata_item"}
}
}
}
@ -581,8 +582,9 @@ add_or_update_metadata {
type: string
}
metadata {
type: array
description: "Metadata items to add or update"
"$ref": "#/definitions/metadata"
items {"$ref": "#/definitions/metadata_item"}
}
}
}

View File

@ -149,18 +149,16 @@ class ModelsBackwardsCompatibility:
for mode, field in cls.mode_to_fields.items():
value = nested_get(fields, field)
if value:
nested_set(
fields,
(cls.models_field, mode),
value=[
if value is None:
continue
val = [
dict(
name=TaskModelNames[mode],
model=value,
updated=datetime.utcnow(),
)
],
)
] if value else []
nested_set(fields, (cls.models_field, mode), value=val)
nested_delete(fields, field)
@ -195,7 +193,7 @@ class DockerCmdBackwardsCompatibility:
return
docker_cmd = nested_get(fields, cls.field)
if docker_cmd:
if docker_cmd is not None:
image, _, arguments = docker_cmd.partition(" ")
nested_set(fields, ("container", "image"), value=image)
nested_set(fields, ("container", "arguments"), value=arguments)