clearml-server/apiserver/apimodels/models.py

83 lines
2.3 KiB
Python
Raw Normal View History

2019-06-10 21:24:35 +00:00
from jsonmodels import models, fields
from six import string_types
2021-01-05 14:28:49 +00:00
from apiserver.apimodels import ListField, DictField
from apiserver.apimodels.base import UpdateResponse
2021-05-03 15:07:37 +00:00
from apiserver.apimodels.batch import BatchRequest
from apiserver.apimodels.metadata import (
MetadataItem,
DeleteMetadata,
AddOrUpdateMetadata,
)
2019-06-10 21:24:35 +00:00
2020-07-06 18:50:43 +00:00
class GetFrameworksRequest(models.Base):
projects = fields.ListField(items_types=[str])
2019-06-10 21:24:35 +00:00
class CreateModelRequest(models.Base):
name = fields.StringField(required=True)
uri = fields.StringField(required=True)
labels = DictField(value_types=string_types + (int,))
2019-06-10 21:24:35 +00:00
tags = ListField(items_types=string_types)
system_tags = ListField(items_types=string_types)
2019-06-10 21:24:35 +00:00
comment = fields.StringField()
public = fields.BoolField(default=False)
project = fields.StringField()
parent = fields.StringField()
framework = fields.StringField()
design = DictField()
ready = fields.BoolField(default=True)
ui_cache = DictField()
task = fields.StringField()
metadata = DictField(value_types=[MetadataItem])
2019-06-10 21:24:35 +00:00
class CreateModelResponse(models.Base):
id = fields.StringField(required=True)
created = fields.BoolField(required=True)
class ModelRequest(models.Base):
2019-06-10 21:24:35 +00:00
model = fields.StringField(required=True)
class DeleteModelRequest(ModelRequest):
force = fields.BoolField(default=False)
2021-05-03 14:52:54 +00:00
class ModelsDeleteManyRequest(BatchRequest):
force = fields.BoolField(default=False)
class PublishModelRequest(ModelRequest):
2019-06-10 21:24:35 +00:00
force_publish_task = fields.BoolField(default=False)
publish_task = fields.BoolField(default=True)
class ModelTaskPublishResponse(models.Base):
id = fields.StringField(required=True)
2021-05-03 15:07:37 +00:00
data = fields.EmbeddedField(UpdateResponse)
2019-06-10 21:24:35 +00:00
class PublishModelResponse(UpdateResponse):
published_task = fields.EmbeddedField(ModelTaskPublishResponse)
2021-05-03 14:52:54 +00:00
class ModelsPublishManyRequest(BatchRequest):
force_publish_task = fields.BoolField(default=False)
publish_task = fields.BoolField(default=True)
class DeleteMetadataRequest(DeleteMetadata):
model = fields.StringField(required=True)
class AddOrUpdateMetadataRequest(AddOrUpdateMetadata):
model = fields.StringField(required=True)
2022-07-08 14:39:41 +00:00
class ModelsGetRequest(models.Base):
include_stats = fields.BoolField(default=False)
allow_public = fields.BoolField(default=True)