2022-12-21 16:30:54 +00:00
|
|
|
from typing import Sequence
|
|
|
|
|
|
|
|
from jsonmodels import validators
|
|
|
|
from jsonmodels.fields import StringField, ListField, BoolField, EmbeddedField, IntField
|
|
|
|
from jsonmodels.models import Base
|
|
|
|
from jsonmodels.validators import Length
|
|
|
|
|
|
|
|
from apiserver.apimodels.events import MetricVariants, HistogramRequestBase
|
|
|
|
|
|
|
|
|
|
|
|
class UpdateReportRequest(Base):
|
|
|
|
task = StringField(required=True)
|
|
|
|
name = StringField(nullable=True, validators=Length(minimum_value=3))
|
|
|
|
tags = ListField(items_types=[str])
|
|
|
|
comment = StringField()
|
|
|
|
report = StringField()
|
2023-03-23 17:09:03 +00:00
|
|
|
report_assets = ListField(items_types=[str])
|
2022-12-21 16:30:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
class CreateReportRequest(Base):
|
|
|
|
name = StringField(required=True, validators=Length(minimum_value=3))
|
|
|
|
tags = ListField(items_types=[str])
|
|
|
|
comment = StringField()
|
|
|
|
report = StringField()
|
|
|
|
project = StringField()
|
2023-03-23 17:09:03 +00:00
|
|
|
report_assets = ListField(items_types=[str])
|
2022-12-21 16:30:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PublishReportRequest(Base):
|
|
|
|
task = StringField(required=True)
|
|
|
|
message = StringField(default="")
|
|
|
|
|
|
|
|
|
|
|
|
class ArchiveReportRequest(Base):
|
|
|
|
task = StringField(required=True)
|
|
|
|
message = StringField(default="")
|
|
|
|
|
|
|
|
|
|
|
|
class ShareReportRequest(Base):
|
|
|
|
task = StringField(required=True)
|
|
|
|
share = BoolField(default=True)
|
|
|
|
|
|
|
|
|
|
|
|
class DeleteReportRequest(Base):
|
|
|
|
task = StringField(required=True)
|
|
|
|
force = BoolField(default=False)
|
|
|
|
|
|
|
|
|
|
|
|
class MoveReportRequest(Base):
|
|
|
|
task = StringField(required=True)
|
|
|
|
project = StringField()
|
|
|
|
project_name = StringField()
|
|
|
|
|
|
|
|
|
|
|
|
class EventsRequest(Base):
|
|
|
|
iters = IntField(default=1, validators=validators.Min(1))
|
|
|
|
metrics: Sequence[MetricVariants] = ListField(items_types=MetricVariants)
|
|
|
|
|
|
|
|
|
2023-07-26 15:34:30 +00:00
|
|
|
class PlotEventsRequest(EventsRequest):
|
|
|
|
last_iters_per_task_metric: bool = BoolField(default=True)
|
|
|
|
|
|
|
|
|
2022-12-21 16:30:54 +00:00
|
|
|
class ScalarMetricsIterHistogram(HistogramRequestBase):
|
|
|
|
metrics: Sequence[MetricVariants] = ListField(items_types=MetricVariants)
|
|
|
|
|
|
|
|
|
2023-05-25 16:18:24 +00:00
|
|
|
class SingleValueMetrics(Base):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2022-12-21 16:30:54 +00:00
|
|
|
class GetTasksDataRequest(Base):
|
|
|
|
debug_images: EventsRequest = EmbeddedField(EventsRequest)
|
2023-07-26 15:34:30 +00:00
|
|
|
plots: PlotEventsRequest = EmbeddedField(PlotEventsRequest)
|
2023-05-25 16:18:24 +00:00
|
|
|
scalar_metrics_iter_histogram: ScalarMetricsIterHistogram = EmbeddedField(
|
|
|
|
ScalarMetricsIterHistogram
|
|
|
|
)
|
|
|
|
single_value_metrics: SingleValueMetrics = EmbeddedField(SingleValueMetrics)
|
2022-12-21 16:30:54 +00:00
|
|
|
allow_public = BoolField(default=True)
|
2023-05-25 16:17:40 +00:00
|
|
|
model_events: bool = BoolField(default=False)
|
2022-12-21 16:30:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
class GetAllRequest(Base):
|
|
|
|
allow_public = BoolField(default=True)
|