intellif-aihub 0.1.24__py3-none-any.whl → 0.1.25__py3-none-any.whl
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.
- aihub/__init__.py +1 -1
- aihub/client.py +4 -0
- aihub/models/notebook_management.py +167 -0
- aihub/services/notebook_management.py +248 -0
- {intellif_aihub-0.1.24.dist-info → intellif_aihub-0.1.25.dist-info}/METADATA +1 -1
- {intellif_aihub-0.1.24.dist-info → intellif_aihub-0.1.25.dist-info}/RECORD +10 -8
- {intellif_aihub-0.1.24.dist-info → intellif_aihub-0.1.25.dist-info}/WHEEL +0 -0
- {intellif_aihub-0.1.24.dist-info → intellif_aihub-0.1.25.dist-info}/entry_points.txt +0 -0
- {intellif_aihub-0.1.24.dist-info → intellif_aihub-0.1.25.dist-info}/licenses/LICENSE +0 -0
- {intellif_aihub-0.1.24.dist-info → intellif_aihub-0.1.25.dist-info}/top_level.txt +0 -0
aihub/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.25"
|
aihub/client.py
CHANGED
|
@@ -20,6 +20,7 @@ from .services import tag_resource_management
|
|
|
20
20
|
from .services import task_center
|
|
21
21
|
from .services import user_system
|
|
22
22
|
from .services import workflow_center
|
|
23
|
+
from .services import notebook_management
|
|
23
24
|
from .services.artifact import ArtifactService
|
|
24
25
|
from .services.data_warehouse import DataWarehouseService
|
|
25
26
|
from .services.dataset_management import DatasetManagementService
|
|
@@ -33,6 +34,7 @@ from .services.tag_resource_management import TagResourceManagementService
|
|
|
33
34
|
from .services.task_center import TaskCenterService
|
|
34
35
|
from .services.user_system import UserSystemService
|
|
35
36
|
from .services.workflow_center import WorkflowCenterService
|
|
37
|
+
from .services.notebook_management import NotebookManagementService
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
class Client:
|
|
@@ -66,6 +68,7 @@ class Client:
|
|
|
66
68
|
task_center: TaskCenterService = None
|
|
67
69
|
user_system: UserSystemService = None
|
|
68
70
|
workflow_center: WorkflowCenterService = None
|
|
71
|
+
notebook_management: NotebookManagementService = None
|
|
69
72
|
|
|
70
73
|
def __init__(
|
|
71
74
|
self,
|
|
@@ -121,6 +124,7 @@ class Client:
|
|
|
121
124
|
self.task_center = task_center.TaskCenterService(self._http)
|
|
122
125
|
self.user_system = user_system.UserSystemService(self._http)
|
|
123
126
|
self.workflow_center = workflow_center.WorkflowCenterService(self._http)
|
|
127
|
+
self.notebook_management = notebook_management.NotebookManagementService(self._http)
|
|
124
128
|
|
|
125
129
|
@staticmethod
|
|
126
130
|
def _raise_for_status(r: httpx.Response):
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
from enum import IntEnum
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, Field
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AppType(IntEnum):
|
|
10
|
+
"""应用类型:1-Notebook;2-VncSsh"""
|
|
11
|
+
Notebook = 1
|
|
12
|
+
VncSsh = 2
|
|
13
|
+
|
|
14
|
+
class HardwareType(IntEnum):
|
|
15
|
+
"""硬件类型:1-CPU;2-GPU"""
|
|
16
|
+
CPU = 1
|
|
17
|
+
GPU = 2
|
|
18
|
+
|
|
19
|
+
class Status(IntEnum):
|
|
20
|
+
"""应用状态:1-关闭;2-启动中;3-已启动"""
|
|
21
|
+
Closed = 1
|
|
22
|
+
Starting = 2
|
|
23
|
+
Started = 3
|
|
24
|
+
|
|
25
|
+
class Image(BaseModel):
|
|
26
|
+
"""项目"""
|
|
27
|
+
id: int = Field(description="镜像ID")
|
|
28
|
+
name: str = Field(description="镜像名称")
|
|
29
|
+
uri: str = Field(description="镜像地址")
|
|
30
|
+
app_type: AppType = Field(description="应用类型")
|
|
31
|
+
hardware_type: HardwareType = Field(description="硬件类型")
|
|
32
|
+
|
|
33
|
+
class ListImagesReq(BaseModel):
|
|
34
|
+
"""查询镜像列表请求"""
|
|
35
|
+
app_type: AppType = Field(description="应用类型")
|
|
36
|
+
hardware_type: HardwareType = Field(description="硬件类型")
|
|
37
|
+
|
|
38
|
+
model_config = {"use_enum_values": True}
|
|
39
|
+
|
|
40
|
+
class ListImagesResp(BaseModel):
|
|
41
|
+
"""查询镜像列表响应"""
|
|
42
|
+
data: List[Image] = Field(description="镜像列表")
|
|
43
|
+
|
|
44
|
+
class User(BaseModel):
|
|
45
|
+
"""用户信息"""
|
|
46
|
+
id: int = Field(description="用户ID")
|
|
47
|
+
name: str = Field(description="用户名称")
|
|
48
|
+
|
|
49
|
+
class Env(BaseModel):
|
|
50
|
+
"""环境变量"""
|
|
51
|
+
key: str = Field(description="环境变量键")
|
|
52
|
+
value: str = Field(description="环境变量值")
|
|
53
|
+
|
|
54
|
+
class Storage(BaseModel):
|
|
55
|
+
"""存储信息"""
|
|
56
|
+
id: int = Field(description="存储ID")
|
|
57
|
+
name: str = Field(description="存储名称")
|
|
58
|
+
path: str = Field(description="路径")
|
|
59
|
+
server_path: str = Field(description="服务器路径", alias="server_path")
|
|
60
|
+
server_host: str = Field(description="服务器主机", alias="server_host")
|
|
61
|
+
server_type: str = Field(description="服务器类型", alias="server_type")
|
|
62
|
+
permission: str = Field(description="权限")
|
|
63
|
+
description: str = Field(description="描述")
|
|
64
|
+
|
|
65
|
+
class Notebook(BaseModel):
|
|
66
|
+
"""笔记本信息"""
|
|
67
|
+
id: int = Field(description="笔记本ID")
|
|
68
|
+
image: Image = Field(description="镜像信息")
|
|
69
|
+
sku_cnt: int = Field(description="SKU数量", alias="sku_cnt")
|
|
70
|
+
envs: Optional[List[Env]] = Field(description="环境变量列表", alias="envs")
|
|
71
|
+
storages: List[Storage] = Field(description="存储列表", alias="storages")
|
|
72
|
+
shm: int = Field(description="共享内存大小", alias="shm")
|
|
73
|
+
hardware_type: HardwareType = Field(description="硬件类型", alias="hardware_type")
|
|
74
|
+
status: Status = Field(description="状态")
|
|
75
|
+
namespace: str = Field(description="命名空间")
|
|
76
|
+
pod: str = Field(description="Pod名称")
|
|
77
|
+
notebook_url: str = Field(description="笔记本URL", alias="notebook_url")
|
|
78
|
+
vscode_url: str = Field(description="VSCode URL", alias="vscode_url")
|
|
79
|
+
created_at: int = Field(description="创建时间", alias="created_at")
|
|
80
|
+
creator: User = Field(description="创建者信息")
|
|
81
|
+
app_type: AppType = Field(description="应用类型", alias="app_type")
|
|
82
|
+
vnc_web_url: str = Field(description="VNC Web URL", alias="vnc_web_url")
|
|
83
|
+
vnc_svr_addr: str = Field(description="VNC服务器地址", alias="vnc_svr_addr")
|
|
84
|
+
vnc_resolution: str = Field(description="VNC分辨率", alias="vnc_resolution")
|
|
85
|
+
ssh_info: str = Field(description="SSH信息", alias="ssh_info")
|
|
86
|
+
|
|
87
|
+
class ListNotebooksReq(BaseModel):
|
|
88
|
+
"""列出笔记本请求参数"""
|
|
89
|
+
hardware_type: Optional[int] = Field(None, description="硬件类型,可选", alias="hardware_type")
|
|
90
|
+
app_type: Optional[int] = Field(None, description="应用类型,可选", alias="app_type")
|
|
91
|
+
|
|
92
|
+
class ListNotebooksResp(BaseModel):
|
|
93
|
+
"""列出笔记本响应数据"""
|
|
94
|
+
data: List[Notebook] = Field(description="笔记本列表数据")
|
|
95
|
+
|
|
96
|
+
class GetNotebookReq(BaseModel):
|
|
97
|
+
"""获取笔记本请求参数"""
|
|
98
|
+
id: int = Field(description="笔记本ID", alias="id")
|
|
99
|
+
|
|
100
|
+
class CreateNotebookReq(BaseModel):
|
|
101
|
+
"""创建笔记本请求参数"""
|
|
102
|
+
hardware_type: int = Field(description="硬件类型", alias="hardware_type")
|
|
103
|
+
image_id: int = Field(description="镜像ID", alias="image_id")
|
|
104
|
+
sku_cnt: Optional[int] = Field(None, description="SKU数量,可选", alias="sku_cnt")
|
|
105
|
+
envs: Optional[List[Env]] = Field(None, description="环境变量列表,可选", alias="envs")
|
|
106
|
+
storage_ids: Optional[List[int]] = Field(None, description="存储ID列表,可选", alias="storage_ids")
|
|
107
|
+
shm: Optional[int] = Field(None, description="共享内存大小,可选", alias="shm")
|
|
108
|
+
app_type: int = Field(description="应用类型", alias="app_type")
|
|
109
|
+
resolution: Optional[str] = Field(None, description="分辨率,可选", alias="resolution")
|
|
110
|
+
|
|
111
|
+
class CreateNotebookResp(BaseModel):
|
|
112
|
+
"""创建笔记本响应数据"""
|
|
113
|
+
id: int = Field(description="创建的笔记本ID")
|
|
114
|
+
|
|
115
|
+
class EditNotebookReq(BaseModel):
|
|
116
|
+
"""编辑笔记本请求参数"""
|
|
117
|
+
id: int = Field(description="笔记本ID", alias="id")
|
|
118
|
+
image_id: int = Field(description="镜像ID", alias="image_id")
|
|
119
|
+
sku_cnt: Optional[int] = Field(None, description="SKU数量,可选", alias="sku_cnt")
|
|
120
|
+
envs: Optional[List[Env]] = Field(None, description="环境变量列表,可选", alias="envs")
|
|
121
|
+
storage_ids: Optional[List[int]] = Field(None, description="存储ID列表,可选", alias="storage_ids")
|
|
122
|
+
shm: Optional[int] = Field(None, description="共享内存大小,可选", alias="shm")
|
|
123
|
+
resolution: Optional[str] = Field(None, description="分辨率,可选", alias="resolution")
|
|
124
|
+
|
|
125
|
+
class EditNotebookResp(BaseModel):
|
|
126
|
+
"""编辑笔记本响应数据"""
|
|
127
|
+
pass
|
|
128
|
+
|
|
129
|
+
class DeleteNotebookReq(BaseModel):
|
|
130
|
+
"""删除笔记本请求参数"""
|
|
131
|
+
id: int = Field(description="笔记本ID", alias="id")
|
|
132
|
+
|
|
133
|
+
class DeleteNotebookResp(BaseModel):
|
|
134
|
+
"""删除笔记本响应数据"""
|
|
135
|
+
pass
|
|
136
|
+
|
|
137
|
+
class StartNotebookReq(BaseModel):
|
|
138
|
+
"""启动笔记本请求参数"""
|
|
139
|
+
id: int = Field(description="笔记本ID", alias="id")
|
|
140
|
+
|
|
141
|
+
class StartNotebookResp(BaseModel):
|
|
142
|
+
"""启动笔记本响应数据"""
|
|
143
|
+
pass
|
|
144
|
+
|
|
145
|
+
class StopNotebookReq(BaseModel):
|
|
146
|
+
"""停止笔记本请求参数"""
|
|
147
|
+
id: int = Field(description="笔记本ID", alias="id")
|
|
148
|
+
|
|
149
|
+
class StopNotebookResp(BaseModel):
|
|
150
|
+
"""停止笔记本响应数据"""
|
|
151
|
+
pass
|
|
152
|
+
|
|
153
|
+
class DefaultParams(BaseModel):
|
|
154
|
+
"""默认参数配置"""
|
|
155
|
+
image: Image = Field(description="镜像信息")
|
|
156
|
+
sku_cnt: int = Field(description="SKU数量", alias="sku_cnt")
|
|
157
|
+
storages: List[Storage] = Field(description="存储列表", alias="storages")
|
|
158
|
+
|
|
159
|
+
class GetConfigsReq(BaseModel):
|
|
160
|
+
"""获取配置请求参数"""
|
|
161
|
+
pass
|
|
162
|
+
|
|
163
|
+
class GetConfigsResp(BaseModel):
|
|
164
|
+
"""获取配置响应数据"""
|
|
165
|
+
cpu_notebook_default_params: DefaultParams = Field(description="CPU笔记本默认参数", alias="cpu_notebook_default_params")
|
|
166
|
+
gpu_notebook_default_params: DefaultParams = Field(description="GPU笔记本默认参数", alias="gpu_notebook_default_params")
|
|
167
|
+
vnc_svr_default_params: DefaultParams = Field(description="VNC服务器默认参数", alias="vnc_svr_default_params")
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# !/usr/bin/env python
|
|
2
|
+
# -*-coding:utf-8 -*-
|
|
3
|
+
"""我的应用模块(原我的Notebook)
|
|
4
|
+
|
|
5
|
+
封装 **notebook_management** 相关接口,核心能力包括:
|
|
6
|
+
|
|
7
|
+
- **查询我的应用卡片** - 支持根据应用类型和硬件类型查询应用卡片
|
|
8
|
+
- **查询我的应用详情** - 支持根据应用卡片ID查询应用详情
|
|
9
|
+
- **获取应用默认启动配置** - 支持获取各种应用的默认启动配置
|
|
10
|
+
- **启动我的应用** - 支持根据应用卡片ID启动应用
|
|
11
|
+
- **停止我的应用** - 支持根据应用卡片ID停止应用
|
|
12
|
+
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import httpx
|
|
18
|
+
|
|
19
|
+
from ..exceptions import APIError
|
|
20
|
+
from ..models.common import APIWrapper
|
|
21
|
+
from ..models.notebook_management import (
|
|
22
|
+
ListImagesReq, ListImagesResp,
|
|
23
|
+
ListNotebooksReq, ListNotebooksResp,
|
|
24
|
+
GetNotebookReq, Notebook,
|
|
25
|
+
CreateNotebookReq, CreateNotebookResp,
|
|
26
|
+
EditNotebookReq, EditNotebookResp,
|
|
27
|
+
DeleteNotebookReq, DeleteNotebookResp,
|
|
28
|
+
StartNotebookReq, StartNotebookResp,
|
|
29
|
+
StopNotebookReq, StopNotebookResp,
|
|
30
|
+
GetConfigsReq, GetConfigsResp
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
_BASE = "/notebook-management/api/v1"
|
|
34
|
+
|
|
35
|
+
class NotebookManagementService:
|
|
36
|
+
"""我的应用管理服务"""
|
|
37
|
+
|
|
38
|
+
def __init__(self, http: httpx.Client):
|
|
39
|
+
self._image_service = _ImageService(http)
|
|
40
|
+
self._notebook_service = _NotebookService(http)
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def image_service(self) -> _ImageService:
|
|
44
|
+
return self._image_service
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def notebook_service(self) -> _NotebookService:
|
|
48
|
+
return self._notebook_service
|
|
49
|
+
|
|
50
|
+
def list_images(self, payload: ListImagesReq) -> ListImagesResp:
|
|
51
|
+
"""获取镜像列表
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
list[Image]: 镜像列表
|
|
55
|
+
"""
|
|
56
|
+
return self._image_service.list_images(payload)
|
|
57
|
+
|
|
58
|
+
def list_notebooks(self, payload: ListNotebooksReq) -> ListNotebooksResp:
|
|
59
|
+
"""列出笔记本实例
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
payload (ListNotebooksReq): 列出笔记本实例请求
|
|
63
|
+
|
|
64
|
+
Returns:
|
|
65
|
+
ListNotebooksResp: 列出笔记本实例响应
|
|
66
|
+
"""
|
|
67
|
+
return self._notebook_service.list_notebooks(payload)
|
|
68
|
+
|
|
69
|
+
def get_notebook(self, payload: GetNotebookReq) -> Notebook:
|
|
70
|
+
"""获取笔记本详情
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
payload (GetNotebookReq): 获取笔记本详情请求
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
Notebook: 笔记本详情
|
|
77
|
+
"""
|
|
78
|
+
return self._notebook_service.get_notebook(payload)
|
|
79
|
+
|
|
80
|
+
def create_notebook(self, payload: CreateNotebookReq) -> CreateNotebookResp:
|
|
81
|
+
"""创建笔记本实例
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
payload (CreateNotebookReq): 创建笔记本实例请求
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
CreateNotebookResp: 创建笔记本实例响应
|
|
88
|
+
"""
|
|
89
|
+
return self._notebook_service.create_notebook(payload)
|
|
90
|
+
|
|
91
|
+
def edit_notebook(self, payload: EditNotebookReq) -> EditNotebookResp:
|
|
92
|
+
"""编辑笔记本实例
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
payload (EditNotebookReq): 编辑笔记本实例请求
|
|
96
|
+
|
|
97
|
+
Returns:
|
|
98
|
+
EditNotebookResp: 编辑笔记本实例响应
|
|
99
|
+
"""
|
|
100
|
+
return self._notebook_service.edit_notebook(payload)
|
|
101
|
+
|
|
102
|
+
def delete_notebook(self, payload: DeleteNotebookReq) -> DeleteNotebookResp:
|
|
103
|
+
"""删除笔记本实例
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
payload (DeleteNotebookReq): 删除笔记本实例请求
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
DeleteNotebookResp: 删除笔记本实例响应
|
|
110
|
+
"""
|
|
111
|
+
return self._notebook_service.delete_notebook(payload)
|
|
112
|
+
|
|
113
|
+
def start_notebook(self, payload: StartNotebookReq) -> StartNotebookResp:
|
|
114
|
+
"""启动笔记本实例
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
payload (StartNotebookReq): 启动笔记本实例请求
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
StartNotebookResp: 启动笔记本实例响应
|
|
121
|
+
"""
|
|
122
|
+
return self._notebook_service.start_notebook(payload)
|
|
123
|
+
|
|
124
|
+
def stop_notebook(self, payload: StopNotebookReq) -> StopNotebookResp:
|
|
125
|
+
"""停止笔记本实例
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
payload (StopNotebookReq): 停止笔记本实例请求
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
StopNotebookResp: 停止笔记本实例响应
|
|
132
|
+
"""
|
|
133
|
+
return self._notebook_service.stop_notebook(payload)
|
|
134
|
+
|
|
135
|
+
def get_configs(self, payload: GetConfigsReq) -> GetConfigsResp:
|
|
136
|
+
"""获取应用默认启动配置
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
payload (GetConfigsReq): 获取应用默认启动配置请求
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
GetConfigsResp: 获取应用默认启动配置响应
|
|
143
|
+
"""
|
|
144
|
+
return self._notebook_service.get_configs(payload)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class _ImageService:
|
|
148
|
+
def __init__(self, http: httpx.Client):
|
|
149
|
+
self._http = http
|
|
150
|
+
|
|
151
|
+
def list_images(self, payload: ListImagesReq) -> ListImagesResp:
|
|
152
|
+
resp = self._http.get(f"{_BASE}/images", params=payload.model_dump(by_alias=True, exclude_none=True))
|
|
153
|
+
wrapper = APIWrapper[ListImagesResp].model_validate(resp.json())
|
|
154
|
+
if wrapper.code != 0:
|
|
155
|
+
raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
|
|
156
|
+
return wrapper.data
|
|
157
|
+
|
|
158
|
+
class _NotebookService:
|
|
159
|
+
def __init__(self, http: httpx.Client):
|
|
160
|
+
self._http = http
|
|
161
|
+
|
|
162
|
+
def list_notebooks(self, payload: ListNotebooksReq) -> ListNotebooksResp:
|
|
163
|
+
"""列出笔记本实例"""
|
|
164
|
+
resp = self._http.get(
|
|
165
|
+
f"{_BASE}/notebooks",
|
|
166
|
+
params=payload.model_dump(by_alias=True, exclude_none=True)
|
|
167
|
+
)
|
|
168
|
+
wrapper = APIWrapper[ListNotebooksResp].model_validate(resp.json())
|
|
169
|
+
if wrapper.code != 0:
|
|
170
|
+
raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
|
|
171
|
+
return wrapper.data
|
|
172
|
+
|
|
173
|
+
def get_notebook(self, payload: GetNotebookReq) -> Notebook:
|
|
174
|
+
"""获取笔记本详情"""
|
|
175
|
+
resp = self._http.get(
|
|
176
|
+
f"{_BASE}/notebooks/{payload.id}",
|
|
177
|
+
params=payload.model_dump(by_alias=True, exclude_none=True)
|
|
178
|
+
)
|
|
179
|
+
wrapper = APIWrapper[Notebook].model_validate(resp.json())
|
|
180
|
+
if wrapper.code != 0:
|
|
181
|
+
raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
|
|
182
|
+
return wrapper.data
|
|
183
|
+
|
|
184
|
+
def create_notebook(self, payload: CreateNotebookReq) -> CreateNotebookResp:
|
|
185
|
+
"""创建笔记本实例"""
|
|
186
|
+
resp = self._http.post(
|
|
187
|
+
f"{_BASE}/notebooks",
|
|
188
|
+
json=payload.model_dump(by_alias=True, exclude_none=True)
|
|
189
|
+
)
|
|
190
|
+
wrapper = APIWrapper[CreateNotebookResp].model_validate(resp.json())
|
|
191
|
+
if wrapper.code != 0:
|
|
192
|
+
raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
|
|
193
|
+
return wrapper.data
|
|
194
|
+
|
|
195
|
+
def edit_notebook(self, payload: EditNotebookReq) -> EditNotebookResp:
|
|
196
|
+
"""编辑笔记本实例"""
|
|
197
|
+
resp = self._http.put(
|
|
198
|
+
f"{_BASE}/notebooks/{payload.id}",
|
|
199
|
+
json=payload.model_dump(by_alias=True, exclude_none=True)
|
|
200
|
+
)
|
|
201
|
+
wrapper = APIWrapper[EditNotebookResp].model_validate(resp.json())
|
|
202
|
+
if wrapper.code != 0:
|
|
203
|
+
raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
|
|
204
|
+
return wrapper.data
|
|
205
|
+
|
|
206
|
+
def delete_notebook(self, payload: DeleteNotebookReq) -> DeleteNotebookResp:
|
|
207
|
+
"""删除笔记本实例"""
|
|
208
|
+
resp = self._http.delete(
|
|
209
|
+
f"{_BASE}/notebooks/{payload.id}",
|
|
210
|
+
params=payload.model_dump(by_alias=True, exclude_none=True)
|
|
211
|
+
)
|
|
212
|
+
wrapper = APIWrapper[DeleteNotebookResp].model_validate(resp.json())
|
|
213
|
+
if wrapper.code != 0:
|
|
214
|
+
raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
|
|
215
|
+
return wrapper.data
|
|
216
|
+
|
|
217
|
+
def start_notebook(self, payload: StartNotebookReq) -> StartNotebookResp:
|
|
218
|
+
"""启动笔记本实例"""
|
|
219
|
+
resp = self._http.post(
|
|
220
|
+
f"{_BASE}/notebooks/{payload.id}/start",
|
|
221
|
+
json=payload.model_dump(by_alias=True, exclude_none=True)
|
|
222
|
+
)
|
|
223
|
+
wrapper = APIWrapper[StartNotebookResp].model_validate(resp.json())
|
|
224
|
+
if wrapper.code != 0:
|
|
225
|
+
raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
|
|
226
|
+
return wrapper.data
|
|
227
|
+
|
|
228
|
+
def stop_notebook(self, payload: StopNotebookReq) -> StopNotebookResp:
|
|
229
|
+
"""停止笔记本实例"""
|
|
230
|
+
resp = self._http.post(
|
|
231
|
+
f"{_BASE}/notebooks/{payload.id}/stop",
|
|
232
|
+
json=payload.model_dump(by_alias=True, exclude_none=True)
|
|
233
|
+
)
|
|
234
|
+
wrapper = APIWrapper[StopNotebookResp].model_validate(resp.json())
|
|
235
|
+
if wrapper.code != 0:
|
|
236
|
+
raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
|
|
237
|
+
return wrapper.data
|
|
238
|
+
|
|
239
|
+
def get_configs(self, payload: GetConfigsReq) -> GetConfigsResp:
|
|
240
|
+
"""获取配置信息"""
|
|
241
|
+
resp = self._http.get(
|
|
242
|
+
f"{_BASE}/configs",
|
|
243
|
+
params=payload.model_dump(by_alias=True, exclude_none=True)
|
|
244
|
+
)
|
|
245
|
+
wrapper = APIWrapper[GetConfigsResp].model_validate(resp.json())
|
|
246
|
+
if wrapper.code != 0:
|
|
247
|
+
raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
|
|
248
|
+
return wrapper.data
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
aihub/__init__.py,sha256=
|
|
2
|
-
aihub/client.py,sha256=
|
|
1
|
+
aihub/__init__.py,sha256=Ej7LsXg-6CASlaEHsZkUoLDpYEfHeFKdIeXMIM0esgA,23
|
|
2
|
+
aihub/client.py,sha256=NY6lIpYmZBAi-QbpuPTeTGma2430KWLqVuEjcgap7MA,5835
|
|
3
3
|
aihub/exceptions.py,sha256=l2cMAvipTqQOio3o11fXsCCSCevbuK4PTsxofkobFjk,500
|
|
4
4
|
aihub/cli/__init__.py,sha256=I6NwAccz4OA13yBkQNVGqdY4by3a9S4Nwc_Nb9myXqM,27
|
|
5
5
|
aihub/cli/__main__.py,sha256=0O3_NGUh4DfaofAxxjmJnyTNSLljwWTclJHQTXrnCco,139
|
|
@@ -16,6 +16,7 @@ aihub/models/eval.py,sha256=eebUv31GJ_gf7-vCYCLknN6utsPZw9G3t6ikZb9gK0I,4865
|
|
|
16
16
|
aihub/models/labelfree.py,sha256=YUnUv0tjYSFAFzYtmbnLOha8rnDe32sb50HkPOclAzU,2016
|
|
17
17
|
aihub/models/model_center.py,sha256=q-ga1Khnb-WbA_gbLHbhwqGPuQ2qjpC4ailaaNpoccU,5491
|
|
18
18
|
aihub/models/model_training_platform.py,sha256=2zir5i-XvuxKKVYr4wuNYUC7nwMzetdtCRoysZ1W_Tc,11725
|
|
19
|
+
aihub/models/notebook_management.py,sha256=ItMlLQ78DiZG1avNumWM_hPrWBFNpHkLs_7uq4zj6WE,7048
|
|
19
20
|
aihub/models/quota_schedule_management.py,sha256=LdXwKkpJd0jUFSHtTHUlFLlH-NUSmgywWtxwFg57CNk,12368
|
|
20
21
|
aihub/models/tag_resource_management.py,sha256=-FgiKyDIG7bZagzVRf-8rXWuqH9GyciDadxz5W2f3I8,2195
|
|
21
22
|
aihub/models/task_center.py,sha256=D4cc3fd4zOhQH5X8VdQmdHckrnYjBGhjg55dBaJkous,6209
|
|
@@ -30,6 +31,7 @@ aihub/services/eval.py,sha256=PhS_RDXhl1x-jdXLqM9kqTG5RDjso2Oxh9l7VaRkcho,7285
|
|
|
30
31
|
aihub/services/labelfree.py,sha256=xua62UWhVXTxJjHRyy86waaormnJjmpQwepcARBy_h0,1450
|
|
31
32
|
aihub/services/model_center.py,sha256=x42_Xo66IxE6ni8mAMLPF_QBRxBvEU-lXrcF8Er2o-I,11404
|
|
32
33
|
aihub/services/model_training_platform.py,sha256=38o6HJnyi3htFzpX7qj6UhzdqTchcXLRTYU0nM7ffJg,10176
|
|
34
|
+
aihub/services/notebook_management.py,sha256=zTV0hz7OdxSiZgC3L9hG2B15HEpwZrDwP4YbhNuylVk,8859
|
|
33
35
|
aihub/services/quota_schedule_management.py,sha256=UYOMwjXxJTgkpN6Rv5GzlcejtpZfu23PXlSKr0WihTY,9586
|
|
34
36
|
aihub/services/reporter.py,sha256=ot93SmhxgwDJOzlHSCwlxDOuSydTWUEUQ-Ctp97wJBQ,669
|
|
35
37
|
aihub/services/tag_resource_management.py,sha256=Bm_inSIzZbTc-e4LU9kvwtsPpM_yLwm8xzdrALjb6uY,2666
|
|
@@ -41,9 +43,9 @@ aihub/utils/di.py,sha256=vFUzno5WbRKu6-pj8Hnz9IqT7xb9UDZQ4qpOFH1YAtM,11812
|
|
|
41
43
|
aihub/utils/download.py,sha256=ZZVbcC-PnN3PumV7ZiJ_-srkt4HPPovu2F6Faa2RrPE,1830
|
|
42
44
|
aihub/utils/http.py,sha256=AmfHHNjptuuSFx2T1twWCnerR_hLN_gd0lUs8z36ERA,547
|
|
43
45
|
aihub/utils/s3.py,sha256=_HFL5QJQqOF8WuEX8RWGPFKYtad_lGn-jsNzTIfXjHM,3977
|
|
44
|
-
intellif_aihub-0.1.
|
|
45
|
-
intellif_aihub-0.1.
|
|
46
|
-
intellif_aihub-0.1.
|
|
47
|
-
intellif_aihub-0.1.
|
|
48
|
-
intellif_aihub-0.1.
|
|
49
|
-
intellif_aihub-0.1.
|
|
46
|
+
intellif_aihub-0.1.25.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
47
|
+
intellif_aihub-0.1.25.dist-info/METADATA,sha256=dY-tzco5gpY7N2-v8MYJfh-Zyr_FdxonIW1kMGNI_kI,2978
|
|
48
|
+
intellif_aihub-0.1.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
49
|
+
intellif_aihub-0.1.25.dist-info/entry_points.txt,sha256=PfgnpEJlG76kFmrCdTvfRIRNsZO1Xu1pTEH2S5DSO1M,45
|
|
50
|
+
intellif_aihub-0.1.25.dist-info/top_level.txt,sha256=vIvTtSIN73xv46BpYM-ctVGnyOiUQ9EWP_6ngvdIlvw,6
|
|
51
|
+
intellif_aihub-0.1.25.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|