2023-07-26 15:21:16 +00:00
|
|
|
from enum import Enum, auto
|
2023-03-23 17:07:42 +00:00
|
|
|
|
2019-09-24 18:34:35 +00:00
|
|
|
from jsonmodels import models, fields
|
|
|
|
|
2022-03-15 14:28:59 +00:00
|
|
|
from apiserver.apimodels import ListField, ActualEnumField, DictField
|
2021-01-05 14:28:49 +00:00
|
|
|
from apiserver.apimodels.organization import TagsRequest
|
2021-01-05 17:02:48 +00:00
|
|
|
from apiserver.database.model import EntityVisibility
|
2023-07-26 15:21:16 +00:00
|
|
|
from apiserver.utilities.stringenum import StringEnum
|
2020-06-21 20:54:05 +00:00
|
|
|
|
2019-09-24 18:34:35 +00:00
|
|
|
|
2021-05-03 14:42:10 +00:00
|
|
|
class ProjectRequest(models.Base):
|
2021-05-03 14:39:13 +00:00
|
|
|
project = fields.StringField(required=True)
|
|
|
|
|
|
|
|
|
2021-05-03 14:42:10 +00:00
|
|
|
class MergeRequest(ProjectRequest):
|
|
|
|
destination_project = fields.StringField()
|
|
|
|
|
|
|
|
|
|
|
|
class MoveRequest(ProjectRequest):
|
|
|
|
new_location = fields.StringField()
|
|
|
|
|
|
|
|
|
|
|
|
class DeleteRequest(ProjectRequest):
|
2021-05-03 14:39:13 +00:00
|
|
|
force = fields.BoolField(default=False)
|
|
|
|
delete_contents = fields.BoolField(default=False)
|
2023-07-26 15:49:54 +00:00
|
|
|
delete_external_artifacts = fields.BoolField(default=True)
|
2019-09-24 18:34:35 +00:00
|
|
|
|
|
|
|
|
2021-05-03 14:44:54 +00:00
|
|
|
class ProjectOrNoneRequest(models.Base):
|
|
|
|
project = fields.StringField()
|
|
|
|
include_subprojects = fields.BoolField(default=True)
|
|
|
|
|
|
|
|
|
2023-05-25 16:17:40 +00:00
|
|
|
class GetUniqueMetricsRequest(ProjectOrNoneRequest):
|
|
|
|
model_metrics = fields.BoolField(default=False)
|
|
|
|
|
|
|
|
|
2022-02-13 17:59:58 +00:00
|
|
|
class GetParamsRequest(ProjectOrNoneRequest):
|
2019-09-24 18:34:35 +00:00
|
|
|
page = fields.IntField(default=0)
|
|
|
|
page_size = fields.IntField(default=500)
|
|
|
|
|
|
|
|
|
2020-06-21 20:54:05 +00:00
|
|
|
class ProjectTagsRequest(TagsRequest):
|
|
|
|
projects = ListField(str)
|
2021-01-05 16:49:25 +00:00
|
|
|
|
|
|
|
|
2021-05-03 14:42:10 +00:00
|
|
|
class MultiProjectRequest(models.Base):
|
2021-05-03 14:34:40 +00:00
|
|
|
projects = fields.ListField(str)
|
2021-05-03 14:44:54 +00:00
|
|
|
include_subprojects = fields.BoolField(default=True)
|
2021-05-03 14:34:40 +00:00
|
|
|
|
|
|
|
|
2021-05-03 14:42:10 +00:00
|
|
|
class ProjectTaskParentsRequest(MultiProjectRequest):
|
2021-01-05 17:02:48 +00:00
|
|
|
tasks_state = ActualEnumField(EntityVisibility)
|
2023-05-25 16:15:26 +00:00
|
|
|
task_name = fields.StringField()
|
2021-01-05 17:02:48 +00:00
|
|
|
|
2021-05-03 14:34:40 +00:00
|
|
|
|
2023-07-26 15:21:16 +00:00
|
|
|
class EntityTypeEnum(StringEnum):
|
|
|
|
task = auto()
|
|
|
|
model = auto()
|
|
|
|
|
|
|
|
|
|
|
|
class ProjectUserNamesRequest(MultiProjectRequest):
|
|
|
|
entity = ActualEnumField(EntityTypeEnum, default=EntityTypeEnum.task)
|
|
|
|
|
|
|
|
|
2023-07-26 15:38:11 +00:00
|
|
|
class MultiProjectPagedRequest(MultiProjectRequest):
|
|
|
|
allow_public = fields.BoolField(default=True)
|
|
|
|
page = fields.IntField(default=0)
|
|
|
|
page_size = fields.IntField(default=500)
|
|
|
|
|
|
|
|
|
|
|
|
class ProjectHyperparamValuesRequest(MultiProjectPagedRequest):
|
2021-05-03 14:34:40 +00:00
|
|
|
section = fields.StringField(required=True)
|
|
|
|
name = fields.StringField(required=True)
|
2023-11-17 07:34:13 +00:00
|
|
|
pattern = fields.StringField()
|
2021-05-03 14:36:04 +00:00
|
|
|
|
|
|
|
|
2023-07-26 15:38:11 +00:00
|
|
|
class ProjectModelMetadataValuesRequest(MultiProjectPagedRequest):
|
2022-03-15 14:28:59 +00:00
|
|
|
key = fields.StringField(required=True)
|
|
|
|
|
|
|
|
|
2023-03-23 17:07:42 +00:00
|
|
|
class ProjectChildrenType(Enum):
|
|
|
|
pipeline = "pipeline"
|
|
|
|
report = "report"
|
|
|
|
dataset = "dataset"
|
|
|
|
|
|
|
|
|
2021-05-03 14:36:04 +00:00
|
|
|
class ProjectsGetRequest(models.Base):
|
2022-07-08 14:45:03 +00:00
|
|
|
include_dataset_stats = fields.BoolField(default=False)
|
2021-05-03 14:36:04 +00:00
|
|
|
include_stats = fields.BoolField(default=False)
|
2022-03-15 14:28:59 +00:00
|
|
|
include_stats_filter = DictField()
|
2022-02-13 17:26:47 +00:00
|
|
|
stats_with_children = fields.BoolField(default=True)
|
2021-05-03 14:36:04 +00:00
|
|
|
stats_for_state = ActualEnumField(EntityVisibility, default=EntityVisibility.active)
|
2022-12-21 16:32:56 +00:00
|
|
|
non_public = fields.BoolField(default=False) # legacy, use allow_public instead
|
2021-05-03 14:36:04 +00:00
|
|
|
active_users = fields.ListField(str)
|
2021-05-03 15:12:44 +00:00
|
|
|
check_own_contents = fields.BoolField(default=False)
|
2021-05-03 14:42:10 +00:00
|
|
|
shallow_search = fields.BoolField(default=False)
|
2022-04-18 13:34:18 +00:00
|
|
|
search_hidden = fields.BoolField(default=False)
|
2022-12-21 16:32:56 +00:00
|
|
|
allow_public = fields.BoolField(default=True)
|
2023-03-23 17:07:42 +00:00
|
|
|
children_type = ActualEnumField(ProjectChildrenType)
|
2023-05-25 16:19:10 +00:00
|
|
|
children_tags = fields.ListField(str)
|