clearml-server/apiserver/apimodels/batch.py

26 lines
657 B
Python
Raw Normal View History

2021-05-03 14:52:54 +00:00
from typing import Sequence
2021-05-03 15:07:37 +00:00
from jsonmodels.fields import StringField
2021-05-03 14:52:54 +00:00
from jsonmodels.models import Base
from jsonmodels.validators import Length
2021-05-03 15:07:37 +00:00
from apiserver.apimodels import ListField
from apiserver.apimodels.base import UpdateResponse
2021-05-03 14:52:54 +00:00
class BatchRequest(Base):
ids: Sequence[str] = ListField([str], validators=Length(minimum_value=1))
class BatchResponse(Base):
2021-05-03 15:07:37 +00:00
succeeded: Sequence[dict] = ListField([dict])
failed: Sequence[dict] = ListField([dict])
class UpdateBatchItem(UpdateResponse):
id: str = StringField()
class UpdateBatchResponse(BatchResponse):
succeeded: Sequence[UpdateBatchItem] = ListField(UpdateBatchItem)