intellif-aihub 0.1.2__tar.gz → 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of intellif-aihub might be problematic. Click here for more details.
- {intellif_aihub-0.1.2/src/intellif_aihub.egg-info → intellif_aihub-0.1.4}/PKG-INFO +2 -2
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/pyproject.toml +3 -2
- intellif_aihub-0.1.4/src/aihub/__init__.py +1 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/client.py +19 -11
- intellif_aihub-0.1.4/src/aihub/models/eval.py +17 -0
- intellif_aihub-0.1.4/src/aihub/models/labelfree.py +53 -0
- intellif_aihub-0.1.4/src/aihub/models/model_training_platform.py +234 -0
- intellif_aihub-0.1.4/src/aihub/models/quota_schedule_management.py +239 -0
- intellif_aihub-0.1.4/src/aihub/models/tag_resource_management.py +50 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/models/task_center.py +10 -10
- intellif_aihub-0.1.4/src/aihub/models/user_system.py +262 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/services/artifact.py +29 -8
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/services/dataset_management.py +1 -1
- intellif_aihub-0.1.4/src/aihub/services/eval.py +68 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/services/labelfree.py +1 -1
- intellif_aihub-0.1.4/src/aihub/services/model_training_platform.py +209 -0
- intellif_aihub-0.1.4/src/aihub/services/quota_schedule_management.py +182 -0
- intellif_aihub-0.1.4/src/aihub/services/tag_resource_management.py +55 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/services/task_center.py +16 -16
- intellif_aihub-0.1.4/src/aihub/services/user_system.py +339 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4/src/intellif_aihub.egg-info}/PKG-INFO +2 -2
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/intellif_aihub.egg-info/SOURCES.txt +13 -5
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/intellif_aihub.egg-info/requires.txt +1 -1
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/tests/test_artifact.py +3 -4
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/tests/test_document_center.py +2 -2
- intellif_aihub-0.1.4/tests/test_model_training_platform.py +76 -0
- intellif_aihub-0.1.4/tests/test_quota_schedule_management.py +76 -0
- intellif_aihub-0.1.4/tests/test_tag_resource_management.py +18 -0
- intellif_aihub-0.1.4/tests/test_task_center.py +57 -0
- intellif_aihub-0.1.4/tests/test_user_system.py +112 -0
- intellif_aihub-0.1.2/src/aihub/__init__.py +0 -1
- intellif_aihub-0.1.2/src/aihub/models/labelfree.py +0 -31
- intellif_aihub-0.1.2/src/aihub/models/quota_schedule_management.py +0 -0
- intellif_aihub-0.1.2/src/aihub/models/tag_management.py +0 -21
- intellif_aihub-0.1.2/src/aihub/models/user.py +0 -46
- intellif_aihub-0.1.2/src/aihub/services/quota_schedule_management.py +0 -18
- intellif_aihub-0.1.2/src/aihub/services/tag_management.py +0 -35
- intellif_aihub-0.1.2/src/aihub/services/user.py +0 -47
- intellif_aihub-0.1.2/tests/test_task_center.py +0 -31
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/LICENSE +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/README.md +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/setup.cfg +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/exceptions.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/models/__init__.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/models/artifact.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/models/common.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/models/dataset_management.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/models/document_center.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/services/__init__.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/services/document_center.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/services/reporter.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/utils/__init__.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/utils/download.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/utils/http.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/aihub/utils/s3.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/intellif_aihub.egg-info/dependency_links.txt +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/src/intellif_aihub.egg-info/top_level.txt +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/tests/test_dataset_management.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/tests/test_labelfree.py +0 -0
- {intellif_aihub-0.1.2 → intellif_aihub-0.1.4}/tests/test_s3.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: intellif-aihub
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: Intellif AI-hub SDK.
|
|
5
5
|
Author-email: Platform Team <aihub@example.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -13,7 +13,7 @@ License-File: LICENSE
|
|
|
13
13
|
Requires-Dist: httpx<0.28,>=0.27
|
|
14
14
|
Requires-Dist: pydantic<3.0,>=2.5.3
|
|
15
15
|
Requires-Dist: typing-extensions<5.0,>=4.13.2
|
|
16
|
-
Requires-Dist: pyarrow<16.0,>=15.0
|
|
16
|
+
Requires-Dist: pyarrow<16.0,>=15.0.2
|
|
17
17
|
Requires-Dist: tqdm<5.0,>=4.66
|
|
18
18
|
Requires-Dist: loguru>=0.7.3
|
|
19
19
|
Requires-Dist: minio>=7.2.7
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "intellif-aihub"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.4"
|
|
4
4
|
description = "Intellif AI-hub SDK."
|
|
5
5
|
readme = {file = "README.md", content-type = "text/markdown"}
|
|
6
6
|
requires-python = ">=3.8"
|
|
@@ -15,7 +15,7 @@ dependencies = [
|
|
|
15
15
|
"httpx>=0.27,<0.28",
|
|
16
16
|
"pydantic>=2.5.3,<3.0",
|
|
17
17
|
"typing-extensions>=4.13.2,<5.0",
|
|
18
|
-
|
|
18
|
+
"pyarrow>=15.0.2,<16.0",
|
|
19
19
|
"tqdm>=4.66,<5.0",
|
|
20
20
|
"loguru>=0.7.3",
|
|
21
21
|
"minio>=7.2.7",
|
|
@@ -41,6 +41,7 @@ default = true
|
|
|
41
41
|
[dependency-groups]
|
|
42
42
|
dev = [
|
|
43
43
|
"black>=24.8.0",
|
|
44
|
+
"griffe-pydantic; python_version>='3.9'",
|
|
44
45
|
"mkdocs-glightbox>=0.4.0",
|
|
45
46
|
"mkdocs-material>=9.6.15",
|
|
46
47
|
"mkdocstrings-python>=1.11.1",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.4"
|
|
@@ -9,14 +9,20 @@ from .services import artifact
|
|
|
9
9
|
from .services import dataset_management
|
|
10
10
|
from .services import document_center
|
|
11
11
|
from .services import labelfree
|
|
12
|
-
from .services import
|
|
12
|
+
from .services import model_training_platform
|
|
13
|
+
from .services import quota_schedule_management
|
|
14
|
+
from .services import tag_resource_management
|
|
13
15
|
from .services import task_center
|
|
16
|
+
from .services import user_system
|
|
14
17
|
from .services.artifact import ArtifactService
|
|
15
18
|
from .services.dataset_management import DatasetManagementService
|
|
16
19
|
from .services.document_center import DocumentCenterService
|
|
17
20
|
from .services.labelfree import LabelfreeService
|
|
18
|
-
from .services.
|
|
21
|
+
from .services.model_training_platform import ModelTrainingPlatformService
|
|
22
|
+
from .services.quota_schedule_management import QuotaScheduleManagementService
|
|
23
|
+
from .services.tag_resource_management import TagResourceManagementService
|
|
19
24
|
from .services.task_center import TaskCenterService
|
|
25
|
+
from .services.user_system import UserSystemService
|
|
20
26
|
|
|
21
27
|
|
|
22
28
|
class Client:
|
|
@@ -31,15 +37,16 @@ class Client:
|
|
|
31
37
|
"""
|
|
32
38
|
|
|
33
39
|
labelfree: LabelfreeService = None
|
|
34
|
-
|
|
40
|
+
tag_resource_management: TagResourceManagementService = None
|
|
35
41
|
document_center: DocumentCenterService = None
|
|
36
42
|
task_center: TaskCenterService = None
|
|
37
43
|
dataset_management: DatasetManagementService = None
|
|
38
44
|
artifact: ArtifactService = None
|
|
45
|
+
user_system: UserSystemService = None
|
|
46
|
+
model_training_platform: ModelTrainingPlatformService = None
|
|
47
|
+
quota_schedule_management: QuotaScheduleManagementService = None
|
|
39
48
|
|
|
40
|
-
def __init__(
|
|
41
|
-
self, *, base_url: str, token: str | None = None, timeout: float = 60.0
|
|
42
|
-
):
|
|
49
|
+
def __init__(self, *, base_url: str, token: str | None = None, timeout: float = 60.0):
|
|
43
50
|
"""AI-HUB python SDK 客户端
|
|
44
51
|
|
|
45
52
|
Args:
|
|
@@ -54,7 +61,7 @@ class Client:
|
|
|
54
61
|
if not base_url:
|
|
55
62
|
raise ValueError("base_url必须填写")
|
|
56
63
|
|
|
57
|
-
token =
|
|
64
|
+
token = os.getenv("AI_HUB_TOKEN") or token
|
|
58
65
|
if not token:
|
|
59
66
|
raise ValueError("缺少token:请显式传入,或在环境变量AI_HUB_TOKEN中设置")
|
|
60
67
|
|
|
@@ -64,14 +71,15 @@ class Client:
|
|
|
64
71
|
headers={"Authorization": f"Bearer {token}"},
|
|
65
72
|
# event_hooks={"response": [self._raise_for_status]},
|
|
66
73
|
)
|
|
67
|
-
self.dataset_management = dataset_management.DatasetManagementService(
|
|
68
|
-
self._http
|
|
69
|
-
)
|
|
74
|
+
self.dataset_management = dataset_management.DatasetManagementService(self._http)
|
|
70
75
|
self.labelfree = labelfree.LabelfreeService(self._http)
|
|
71
|
-
self.
|
|
76
|
+
self.tag_resource_management = tag_resource_management.TagResourceManagementService(self._http)
|
|
72
77
|
self.document_center = document_center.DocumentCenterService(self._http)
|
|
73
78
|
self.task_center = task_center.TaskCenterService(self._http)
|
|
74
79
|
self.artifact = artifact.ArtifactService(self._http)
|
|
80
|
+
self.user_system = user_system.UserSystemService(self._http)
|
|
81
|
+
self.model_training_platform = model_training_platform.ModelTrainingPlatformService(self._http)
|
|
82
|
+
self.quota_schedule_management = quota_schedule_management.QuotaScheduleManagementService(self._http)
|
|
75
83
|
|
|
76
84
|
@staticmethod
|
|
77
85
|
def _raise_for_status(r: httpx.Response):
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# !/usr/bin/env python
|
|
2
|
+
# -*-coding:utf-8 -*-
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CreatEvalReq(BaseModel):
|
|
7
|
+
dataset_id: int
|
|
8
|
+
dataset_version_id: int
|
|
9
|
+
prediction_artifact_path: str
|
|
10
|
+
evaled_artifact_path: str
|
|
11
|
+
run_id: str
|
|
12
|
+
user_id: int = 0
|
|
13
|
+
report: dict = {}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class CreatEvalResp(BaseModel):
|
|
17
|
+
id: int
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Stats(BaseModel):
|
|
9
|
+
"""标注统计信息"""
|
|
10
|
+
|
|
11
|
+
total_annotations: int = Field(alias="total_annotations", description="总数据量")
|
|
12
|
+
labeled_annotations: int = Field(
|
|
13
|
+
alias="labeled_annotations", description="已标注数据量"
|
|
14
|
+
)
|
|
15
|
+
total_labels: int = Field(alias="total_labels", description="总标签量")
|
|
16
|
+
total_reviews: Optional[int] = Field(
|
|
17
|
+
None, alias="total_reviews", description="总质检量"
|
|
18
|
+
)
|
|
19
|
+
unlabeled_reviews: Optional[int] = Field(
|
|
20
|
+
None, alias="unlabeled_reviews", description="未质检量"
|
|
21
|
+
)
|
|
22
|
+
labeled_reviews: Optional[int] = Field(
|
|
23
|
+
None, alias="labeled_reviews", description="已质检量"
|
|
24
|
+
)
|
|
25
|
+
accepted_count: Optional[int] = Field(
|
|
26
|
+
None, alias="accepted_count", description="质检通过量"
|
|
27
|
+
)
|
|
28
|
+
rejected_count: Optional[int] = Field(
|
|
29
|
+
None, alias="rejected_count", description="质检打回量"
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class GetGlobalStatsResponse(BaseModel):
|
|
34
|
+
"""
|
|
35
|
+
标注统计概况
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
global_stats: Stats = Field(alias="global_stats")
|
|
39
|
+
valid_ten_percent: bool = Field(
|
|
40
|
+
alias="valid_ten_percent", description="是否完成验收10%"
|
|
41
|
+
)
|
|
42
|
+
valid_fifty_percent: bool = Field(
|
|
43
|
+
alias="valid_fifty_percent", description="是否完成验收50%"
|
|
44
|
+
)
|
|
45
|
+
valid_hundred_percent: bool = Field(
|
|
46
|
+
alias="valid_hundred_percent", description="是否完成验收100%"
|
|
47
|
+
)
|
|
48
|
+
data_exported_count: int = Field(
|
|
49
|
+
alias="data_exported_count", description="已导出数据次数"
|
|
50
|
+
)
|
|
51
|
+
exported_dataset_name: str = Field(
|
|
52
|
+
alias="exported_dataset_name", description="最新数据集名称"
|
|
53
|
+
)
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Env(BaseModel):
|
|
9
|
+
key: str
|
|
10
|
+
value: str
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Mount(BaseModel):
|
|
14
|
+
name: str
|
|
15
|
+
path: str
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Sku(BaseModel):
|
|
19
|
+
cpu: int
|
|
20
|
+
gpu: int
|
|
21
|
+
memory: int
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class VirtualCluster(BaseModel):
|
|
25
|
+
id: int
|
|
26
|
+
name: str
|
|
27
|
+
gpu_type: str = Field(alias="gpu_type")
|
|
28
|
+
label: str
|
|
29
|
+
sku: Sku
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class Storage(BaseModel):
|
|
33
|
+
id: int
|
|
34
|
+
name: str
|
|
35
|
+
path: str
|
|
36
|
+
server_path: str = Field(alias="server_path")
|
|
37
|
+
server_host: str = Field(alias="server_host")
|
|
38
|
+
server_type: str = Field(alias="server_type")
|
|
39
|
+
permission: str
|
|
40
|
+
description: str
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class Category(BaseModel):
|
|
44
|
+
id: int
|
|
45
|
+
name: str
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class Project(BaseModel):
|
|
49
|
+
id: int
|
|
50
|
+
name: str
|
|
51
|
+
description: str
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class User(BaseModel):
|
|
55
|
+
id: int
|
|
56
|
+
name: str
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class Department(BaseModel):
|
|
60
|
+
id: int
|
|
61
|
+
name: str
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class CreateTrainingRequest(BaseModel):
|
|
65
|
+
framework: str
|
|
66
|
+
name: str
|
|
67
|
+
description: Optional[str] = None
|
|
68
|
+
command: Optional[str] = None
|
|
69
|
+
image: str
|
|
70
|
+
virtual_cluster_id: int = Field(alias="virtual_cluster_id")
|
|
71
|
+
sku_cnt: int = Field(alias="sku_cnt")
|
|
72
|
+
enable_ssh: Optional[bool] = Field(False, alias="enable_ssh")
|
|
73
|
+
envs: Optional[List[Env]] = Field(default_factory=list, alias="envs")
|
|
74
|
+
storage_ids: Optional[List[int]] = Field(default_factory=list, alias="storage_ids")
|
|
75
|
+
instances: int
|
|
76
|
+
use_ib_network: Optional[bool] = Field(False, alias="use_ib_network")
|
|
77
|
+
always_pull_image: Optional[bool] = Field(False, alias="always_pull_image")
|
|
78
|
+
shm: Optional[int] = None
|
|
79
|
+
category_id: int = Field(alias="category_id")
|
|
80
|
+
project_id: int = Field(alias="project_id")
|
|
81
|
+
estimate_run_time: Optional[int] = Field(None, alias="estimate_run_time")
|
|
82
|
+
is_vip: Optional[bool] = Field(False, alias="is_vip")
|
|
83
|
+
preempt_policy: Optional[int] = Field(None, alias="preempt_policy")
|
|
84
|
+
vip_node_names: Optional[List[str]] = Field(default_factory=list, alias="vip_node_names")
|
|
85
|
+
is_quota_schedule: Optional[bool] = Field(False, alias="is_quota_schedule")
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class CreateTrainingResponse(BaseModel):
|
|
89
|
+
id: int
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class ListTrainingsRequest(BaseModel):
|
|
93
|
+
page_size: int = Field(20, alias="page_size")
|
|
94
|
+
page_num: int = Field(1, alias="page_num")
|
|
95
|
+
user_id: Optional[int] = Field(None, alias="user_id")
|
|
96
|
+
name: Optional[str] = None
|
|
97
|
+
virtual_cluster_id: Optional[int] = Field(None, alias="virtual_cluster_id")
|
|
98
|
+
status: Optional[int] = None
|
|
99
|
+
category_id: Optional[int] = Field(None, alias="category_id")
|
|
100
|
+
project_id: Optional[int] = Field(None, alias="project_id")
|
|
101
|
+
is_quota_schedule: Optional[bool] = Field(None, alias="is_quota_schedule")
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class Training(BaseModel):
|
|
105
|
+
"""训练任务"""
|
|
106
|
+
|
|
107
|
+
id: int
|
|
108
|
+
framework: str
|
|
109
|
+
name: str
|
|
110
|
+
description: str
|
|
111
|
+
command: str
|
|
112
|
+
image: str
|
|
113
|
+
virtual_cluster: VirtualCluster = Field(alias="virtual_cluster")
|
|
114
|
+
sku_cnt: int = Field(alias="sku_cnt")
|
|
115
|
+
enable_ssh: bool = Field(alias="enable_ssh")
|
|
116
|
+
envs: Optional[List[Env]] = Field(None, alias="envs")
|
|
117
|
+
storages: Optional[List[Storage]] = Field(None, alias="storages")
|
|
118
|
+
instances: int
|
|
119
|
+
created_at: int = Field(alias="created_at")
|
|
120
|
+
username: str
|
|
121
|
+
user_id: int = Field(alias="user_id")
|
|
122
|
+
namespace: str
|
|
123
|
+
res_name: str = Field(alias="res_name")
|
|
124
|
+
status: int
|
|
125
|
+
use_ib_network: bool = Field(alias="use_ib_network")
|
|
126
|
+
always_pull_image: bool = Field(alias="always_pull_image")
|
|
127
|
+
shm: int
|
|
128
|
+
category: Category
|
|
129
|
+
project: Project
|
|
130
|
+
avg_gpu_util: float = Field(alias="avg_gpu_util")
|
|
131
|
+
finished_at: int = Field(alias="finished_at")
|
|
132
|
+
started_at: int = Field(alias="started_at")
|
|
133
|
+
estimate_run_time: int = Field(alias="estimate_run_time")
|
|
134
|
+
is_vip: bool = Field(alias="is_vip")
|
|
135
|
+
cluster_partition: str = Field(alias="cluster_partition")
|
|
136
|
+
preempt_policy: int = Field(alias="preempt_policy")
|
|
137
|
+
vip_node_names: List[str] = Field(alias="vip_node_names")
|
|
138
|
+
stop_op_user: Optional[User] = Field(None, alias="stop_op_user")
|
|
139
|
+
use_new_log: bool = Field(alias="use_new_log")
|
|
140
|
+
is_quota_schedule: bool = Field(alias="is_quota_schedule")
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class ListTrainingsResponse(BaseModel):
|
|
144
|
+
total: int
|
|
145
|
+
page_size: int = Field(alias="page_size")
|
|
146
|
+
page_num: int = Field(alias="page_num")
|
|
147
|
+
data: List[Training]
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class Pod(BaseModel):
|
|
151
|
+
"""训练任务容器"""
|
|
152
|
+
|
|
153
|
+
id: int
|
|
154
|
+
namespace: str
|
|
155
|
+
name: str
|
|
156
|
+
status: str
|
|
157
|
+
created_at: int = Field(alias="created_at")
|
|
158
|
+
started_at: int = Field(alias="started_at")
|
|
159
|
+
finished_at: int = Field(alias="finished_at")
|
|
160
|
+
host_ip: str = Field(alias="host_ip")
|
|
161
|
+
node_name: str = Field(alias="node_name")
|
|
162
|
+
ssh_port: int = Field(alias="ssh_port")
|
|
163
|
+
ssh_info: str = Field(alias="ssh_info")
|
|
164
|
+
use_new_log: bool = Field(alias="use_new_log")
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class ListTrainingPodsRequest(BaseModel):
|
|
168
|
+
page_size: int = Field(20, alias="page_size")
|
|
169
|
+
page_num: int = Field(1, alias="page_num")
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class ListTrainingPodsResponse(BaseModel):
|
|
173
|
+
total: int
|
|
174
|
+
page_size: int = Field(alias="page_size")
|
|
175
|
+
page_num: int = Field(alias="page_num")
|
|
176
|
+
data: List[Pod]
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class PodLogInfo(BaseModel):
|
|
180
|
+
name: str
|
|
181
|
+
url: str
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
class GetTrainingPodLogsNewResponse(BaseModel):
|
|
185
|
+
logs: List[PodLogInfo]
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class GetTrainingPodSpecResponse(BaseModel):
|
|
189
|
+
spec: str
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class GetTrainingPodEventsResponse(BaseModel):
|
|
193
|
+
events: str
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class TrainingUser(BaseModel):
|
|
197
|
+
user_id: int = Field(alias="user_id")
|
|
198
|
+
username: str
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class ListTrainingUsersRequest(BaseModel):
|
|
202
|
+
page_size: int = Field(20, alias="page_size")
|
|
203
|
+
page_num: int = Field(1, alias="page_num")
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
class ListTrainingUsersResponse(BaseModel):
|
|
207
|
+
total: int
|
|
208
|
+
page_size: int = Field(alias="page_size")
|
|
209
|
+
page_num: int = Field(alias="page_num")
|
|
210
|
+
data: Optional[List[TrainingUser]] = Field(default_factory=list)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
class Container(BaseModel):
|
|
214
|
+
namespace: str
|
|
215
|
+
pod_name: str = Field(alias="pod_name")
|
|
216
|
+
container_name: str = Field(alias="container_name")
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
class TrainingContainer(BaseModel):
|
|
220
|
+
training_id: int = Field(alias="training_id")
|
|
221
|
+
training_name: str = Field(alias="training_name")
|
|
222
|
+
containers: List[Container]
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class ListTrainingContainersRequest(BaseModel):
|
|
226
|
+
page_size: int = Field(20, alias="page_size")
|
|
227
|
+
page_num: int = Field(1, alias="page_num")
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
class ListTrainingContainersResponse(BaseModel):
|
|
231
|
+
total: int
|
|
232
|
+
page_size: int = Field(alias="page_size")
|
|
233
|
+
page_num: int = Field(alias="page_num")
|
|
234
|
+
data: Optional[List[TrainingContainer]] = Field(default_factory=list)
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Env(BaseModel):
|
|
9
|
+
key: str
|
|
10
|
+
value: str
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Sku(BaseModel):
|
|
14
|
+
cpu: int
|
|
15
|
+
gpu: int
|
|
16
|
+
memory: int
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class VirtualCluster(BaseModel):
|
|
20
|
+
id: int
|
|
21
|
+
name: str
|
|
22
|
+
gpu_type: str = Field(alias="gpu_type")
|
|
23
|
+
label: str
|
|
24
|
+
sku: Sku
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class Storage(BaseModel):
|
|
28
|
+
id: int
|
|
29
|
+
name: str
|
|
30
|
+
path: str
|
|
31
|
+
server_path: str = Field(alias="server_path")
|
|
32
|
+
server_host: str = Field(alias="server_host")
|
|
33
|
+
server_type: str = Field(alias="server_type")
|
|
34
|
+
permission: str
|
|
35
|
+
description: str
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class Category(BaseModel):
|
|
39
|
+
id: int
|
|
40
|
+
name: str
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class Project(BaseModel):
|
|
44
|
+
id: int
|
|
45
|
+
name: str
|
|
46
|
+
description: str
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class User(BaseModel):
|
|
50
|
+
id: int
|
|
51
|
+
name: str
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class SourceTask(BaseModel):
|
|
55
|
+
id: int
|
|
56
|
+
name: str
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class CreateTaskRequest(BaseModel):
|
|
60
|
+
priority: int
|
|
61
|
+
framework: str
|
|
62
|
+
name: str
|
|
63
|
+
description: Optional[str] = None
|
|
64
|
+
command: Optional[str] = None
|
|
65
|
+
image: str
|
|
66
|
+
virtual_cluster_id: int = Field(alias="virtual_cluster_id")
|
|
67
|
+
sku_cnt: int = Field(alias="sku_cnt")
|
|
68
|
+
enable_ssh: Optional[bool] = Field(False, alias="enable_ssh")
|
|
69
|
+
envs: Optional[List[Env]] = Field(default_factory=list, alias="envs")
|
|
70
|
+
storage_ids: Optional[List[int]] = Field(default_factory=list, alias="storage_ids")
|
|
71
|
+
instances: int
|
|
72
|
+
use_ib_network: Optional[bool] = Field(False, alias="use_ib_network")
|
|
73
|
+
always_pull_image: Optional[bool] = Field(False, alias="always_pull_image")
|
|
74
|
+
shm: Optional[int] = None
|
|
75
|
+
category_id: int = Field(alias="category_id")
|
|
76
|
+
project_id: int = Field(alias="project_id")
|
|
77
|
+
estimate_run_time: Optional[int] = Field(None, alias="estimate_run_time")
|
|
78
|
+
is_vip: Optional[bool] = Field(False, alias="is_vip")
|
|
79
|
+
preempt_policy: Optional[int] = Field(None, alias="preempt_policy")
|
|
80
|
+
vip_node_names: Optional[List[str]] = Field(default_factory=list, alias="vip_node_names")
|
|
81
|
+
enable_reschedule: Optional[bool] = Field(False, alias="enable_reschedule")
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class CreateTaskResponse(BaseModel):
|
|
85
|
+
id: int
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class Task(BaseModel):
|
|
89
|
+
id: int
|
|
90
|
+
priority: int
|
|
91
|
+
mtp_id: int = Field(alias="mtp_id")
|
|
92
|
+
framework: str
|
|
93
|
+
name: str
|
|
94
|
+
description: str
|
|
95
|
+
command: str
|
|
96
|
+
image: str
|
|
97
|
+
virtual_cluster: VirtualCluster = Field(alias="virtual_cluster")
|
|
98
|
+
sku_cnt: int = Field(alias="sku_cnt")
|
|
99
|
+
enable_ssh: bool = Field(alias="enable_ssh")
|
|
100
|
+
envs: Optional[List[Env]] = Field(default_factory=list, alias="envs")
|
|
101
|
+
storages: Optional[List[Storage]] = Field(default_factory=list, alias="storages")
|
|
102
|
+
instances: int
|
|
103
|
+
created_at: int = Field(alias="created_at")
|
|
104
|
+
username: str
|
|
105
|
+
user_id: int = Field(alias="user_id")
|
|
106
|
+
namespace: str
|
|
107
|
+
res_name: str = Field(alias="res_name")
|
|
108
|
+
status: int
|
|
109
|
+
use_ib_network: bool = Field(alias="use_ib_network")
|
|
110
|
+
always_pull_image: bool = Field(alias="always_pull_image")
|
|
111
|
+
shm: int
|
|
112
|
+
category: Category
|
|
113
|
+
project: Project
|
|
114
|
+
avg_gpu_util: float = Field(alias="avg_gpu_util")
|
|
115
|
+
finished_at: int = Field(alias="finished_at")
|
|
116
|
+
started_at: int = Field(alias="started_at")
|
|
117
|
+
estimate_run_time: int = Field(alias="estimate_run_time")
|
|
118
|
+
is_vip: bool = Field(alias="is_vip")
|
|
119
|
+
cluster_partition: str = Field(alias="cluster_partition")
|
|
120
|
+
preempt_policy: int = Field(alias="preempt_policy")
|
|
121
|
+
vip_node_names: Optional[List[str]] = Field(None, alias="vip_node_names")
|
|
122
|
+
stop_op_user: Optional[User] = Field(None, alias="stop_op_user")
|
|
123
|
+
use_new_log: bool = Field(alias="use_new_log")
|
|
124
|
+
is_quota_schedule: bool = Field(alias="is_quota_schedule")
|
|
125
|
+
enable_reschedule: bool = Field(alias="enable_reschedule")
|
|
126
|
+
remain_schedule_cnt: int = Field(alias="remain_schedule_cnt")
|
|
127
|
+
source_task: Optional[SourceTask] = Field(None, alias="source_task")
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
class ListTasksRequest(BaseModel):
|
|
131
|
+
page_size: int = Field(20, alias="page_size")
|
|
132
|
+
page_num: int = Field(1, alias="page_num")
|
|
133
|
+
user_id: Optional[int] = Field(None, alias="user_id")
|
|
134
|
+
name: Optional[str] = None
|
|
135
|
+
virtual_cluster_id: Optional[int] = Field(None, alias="virtual_cluster_id")
|
|
136
|
+
status: Optional[int] = None
|
|
137
|
+
category_id: Optional[int] = Field(None, alias="category_id")
|
|
138
|
+
project_id: Optional[int] = Field(None, alias="project_id")
|
|
139
|
+
priority: Optional[int] = None
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class ListTasksResponse(BaseModel):
|
|
143
|
+
total: int
|
|
144
|
+
page_size: int = Field(alias="page_size")
|
|
145
|
+
page_num: int = Field(alias="page_num")
|
|
146
|
+
data: List[Task] = Field(default_factory=list)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
class Pod(BaseModel):
|
|
150
|
+
id: int
|
|
151
|
+
namespace: str
|
|
152
|
+
name: str
|
|
153
|
+
status: str
|
|
154
|
+
created_at: int = Field(alias="created_at")
|
|
155
|
+
started_at: int = Field(alias="started_at")
|
|
156
|
+
finished_at: int = Field(alias="finished_at")
|
|
157
|
+
host_ip: str = Field(alias="host_ip")
|
|
158
|
+
node_name: str = Field(alias="node_name")
|
|
159
|
+
ssh_port: int = Field(alias="ssh_port")
|
|
160
|
+
ssh_info: str = Field(alias="ssh_info")
|
|
161
|
+
use_new_log: bool = Field(alias="use_new_log")
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class ListTaskPodsRequest(BaseModel):
|
|
165
|
+
page_size: int = Field(20, alias="page_size")
|
|
166
|
+
page_num: int = Field(1, alias="page_num")
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class ListTaskPodsResponse(BaseModel):
|
|
170
|
+
total: int
|
|
171
|
+
page_size: int = Field(alias="page_size")
|
|
172
|
+
page_num: int = Field(alias="page_num")
|
|
173
|
+
data: List[Pod] = Field(default_factory=list)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class PodLogInfo(BaseModel):
|
|
177
|
+
name: str
|
|
178
|
+
url: str
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class GetTaskPodLogsNewResponse(BaseModel):
|
|
182
|
+
logs: List[PodLogInfo]
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class GetTaskPodSpecResponse(BaseModel):
|
|
186
|
+
spec: str
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class GetTaskPodEventsResponse(BaseModel):
|
|
190
|
+
events: str
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class MachineOverview(BaseModel):
|
|
194
|
+
high: int
|
|
195
|
+
low: int
|
|
196
|
+
free: int
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class HighPrioritySummary(BaseModel):
|
|
200
|
+
group_id: int = Field(alias="group_id")
|
|
201
|
+
group_name: str = Field(alias="group_name")
|
|
202
|
+
used: int
|
|
203
|
+
total: int
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
class MetricsOverview(BaseModel):
|
|
207
|
+
vc_id: int = Field(alias="vc_id")
|
|
208
|
+
vc_name: str = Field(alias="vc_name")
|
|
209
|
+
machine: MachineOverview
|
|
210
|
+
high_priority: List[HighPrioritySummary] = Field(alias="high_priority")
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
class GetMetricsOverviewRequest(BaseModel):
|
|
214
|
+
page_size: int = Field(20, alias="page_size")
|
|
215
|
+
page_num: int = Field(1, alias="page_num")
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
class GetMetricsOverviewResponse(BaseModel):
|
|
219
|
+
total: int
|
|
220
|
+
page_size: int = Field(alias="page_size")
|
|
221
|
+
page_num: int = Field(alias="page_num")
|
|
222
|
+
data: List[MetricsOverview] = Field(default_factory=list)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class TaskUser(BaseModel):
|
|
226
|
+
user_id: int = Field(alias="user_id")
|
|
227
|
+
username: str
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
class ListTaskUsersRequest(BaseModel):
|
|
231
|
+
page_size: int = Field(20, alias="page_size")
|
|
232
|
+
page_num: int = Field(1, alias="page_num")
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
class ListTaskUsersResponse(BaseModel):
|
|
236
|
+
total: int
|
|
237
|
+
page_size: int = Field(alias="page_size")
|
|
238
|
+
page_num: int = Field(alias="page_num")
|
|
239
|
+
data: List[TaskUser] = Field(default_factory=list)
|