2019-10-25 12:36:58 +00:00
|
|
|
from jsonmodels import validators
|
|
|
|
from jsonmodels.fields import StringField, IntField, BoolField, FloatField
|
|
|
|
from jsonmodels.models import Base
|
|
|
|
|
2022-03-15 14:18:57 +00:00
|
|
|
from apiserver.apimodels import ListField, DictField
|
2021-05-03 14:50:25 +00:00
|
|
|
from apiserver.apimodels.metadata import (
|
|
|
|
MetadataItem,
|
|
|
|
DeleteMetadata,
|
|
|
|
AddOrUpdateMetadata,
|
|
|
|
)
|
2019-10-25 12:36:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
class GetDefaultResp(Base):
|
|
|
|
id = StringField(required=True)
|
|
|
|
name = StringField(required=True)
|
|
|
|
|
|
|
|
|
|
|
|
class CreateRequest(Base):
|
|
|
|
name = StringField(required=True)
|
|
|
|
tags = ListField(items_types=[str])
|
|
|
|
system_tags = ListField(items_types=[str])
|
2022-03-15 14:18:57 +00:00
|
|
|
metadata = DictField(value_types=[MetadataItem])
|
2019-10-25 12:36:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
class QueueRequest(Base):
|
|
|
|
queue = StringField(required=True)
|
|
|
|
|
|
|
|
|
2022-07-08 14:42:20 +00:00
|
|
|
class GetByIdRequest(QueueRequest):
|
|
|
|
max_task_entries = IntField()
|
|
|
|
|
|
|
|
|
2022-03-15 14:18:57 +00:00
|
|
|
class GetNextTaskRequest(QueueRequest):
|
|
|
|
queue = StringField(required=True)
|
|
|
|
get_task_info = BoolField(default=False)
|
|
|
|
|
|
|
|
|
2019-10-25 12:36:58 +00:00
|
|
|
class DeleteRequest(QueueRequest):
|
|
|
|
force = BoolField(default=False)
|
|
|
|
|
|
|
|
|
|
|
|
class UpdateRequest(QueueRequest):
|
|
|
|
name = StringField()
|
|
|
|
tags = ListField(items_types=[str])
|
|
|
|
system_tags = ListField(items_types=[str])
|
2022-03-15 14:18:57 +00:00
|
|
|
metadata = DictField(value_types=[MetadataItem])
|
2019-10-25 12:36:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TaskRequest(QueueRequest):
|
|
|
|
task = StringField(required=True)
|
|
|
|
|
|
|
|
|
|
|
|
class MoveTaskRequest(TaskRequest):
|
|
|
|
count = IntField(default=1)
|
|
|
|
|
|
|
|
|
|
|
|
class MoveTaskResponse(Base):
|
|
|
|
position = IntField()
|
|
|
|
|
|
|
|
|
|
|
|
class GetMetricsRequest(Base):
|
|
|
|
queue_ids = ListField([str])
|
|
|
|
from_date = FloatField(required=True, validators=validators.Min(0))
|
|
|
|
to_date = FloatField(required=True, validators=validators.Min(0))
|
|
|
|
interval = IntField(required=True, validators=validators.Min(1))
|
2022-07-08 14:36:46 +00:00
|
|
|
refresh = BoolField(default=False)
|
2019-10-25 12:36:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
class QueueMetrics(Base):
|
|
|
|
queue = StringField()
|
|
|
|
dates = ListField(int)
|
|
|
|
avg_waiting_times = ListField([float, int])
|
|
|
|
queue_lengths = ListField(int)
|
|
|
|
|
|
|
|
|
|
|
|
class GetMetricsResponse(Base):
|
|
|
|
queues = ListField(QueueMetrics)
|
2021-05-03 14:50:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DeleteMetadataRequest(DeleteMetadata):
|
|
|
|
queue = StringField(required=True)
|
|
|
|
|
|
|
|
|
|
|
|
class AddOrUpdateMetadataRequest(AddOrUpdateMetadata):
|
|
|
|
queue = StringField(required=True)
|