Skip to content
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ FEATURE_SUMMARY.md
GEMINI.md
QWEN.md
.omx/
.opencode/
CODEBUDDY.md
1 change: 1 addition & 0 deletions swanlab/sdk/internal/core_python/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@file: __init__.py
@time: 2026/3/7 18:19
@description: SwanLab 运行时 API 封装

绝大多数API使用 Client 对象,少部分API使用requests库直接调用
我们以rpc风格封装API,方便调用
"""
11 changes: 10 additions & 1 deletion swanlab/sdk/internal/core_python/api/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@description: SwanLab 运行时实验API
"""

from typing import List, Literal, Optional
from typing import Dict, List, Literal, Optional, Union

from google.protobuf.timestamp_pb2 import Timestamp

Expand Down Expand Up @@ -91,3 +91,12 @@ def stop_experiment(username: str, project: str, cuid: str, *, state: RunState,
"from": "sdk",
},
)


def send_experiment_heartbeat(*, cuid: str, flag_id: str) -> None:
"""
发送实验心跳,保持实验处于活跃状态
:param cuid: 实验唯一标识符
:param flag_id: 实验标记ID
"""
client.post(f"/house/experiments/{cuid}/heartbeat", {"flagId": flag_id})
2 changes: 1 addition & 1 deletion swanlab/sdk/internal/core_python/api/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

def get_project(*, username: str, name: str) -> ProjectType:
"""
获取项目信息
获取项目详情信息
:param username: 项目所属的用户名
:param name: 项目名称
:return: 项目信息
Expand Down
2 changes: 1 addition & 1 deletion swanlab/sdk/typings/core_python/api/experiment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
@author: cunyue
@file: experiment.py
@time: 2026/4/18 17:43
@time: 2026/3/10 19:02
@description: SwanLab 运行时实验API类型
"""

Expand Down
Loading