Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit 74967fc

Browse files
authored
Feature/backup (#30)
* feat: backup mode * refactor: delete exp count in callback * chore: add public params on init
1 parent e943dd5 commit 74967fc

4 files changed

Lines changed: 6 additions & 7 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build-backend = "hatchling.build"
99

1010
[project]
1111
name = "swankit"
12-
version = "0.2.0"
12+
version = "0.2.1"
1313
dynamic = ["readme", "dependencies"]
1414
description = "Base toolkit for SwanLab"
1515
license = "Apache-2.0"

swankit/callback/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ class SwanKitCallback(ABC):
2020
此处只定义会被调用的函数,用于接口规范
2121
"""
2222

23-
def on_init(self, proj_name: str, workspace: str, logdir: str = None, *args, **kwargs):
23+
def on_init(self, proj_name: str, workspace: str, public: bool = None, logdir: str = None, *args, **kwargs):
2424
"""
2525
执行`swanlab.init`时调用,此时运行时环境变量没有被设置,此时修改环境变量还是有效的
2626
:param logdir: str, 用户设置的日志目录
2727
:param proj_name: str, 项目名称
28+
:param public: bool, 是否为公开项目
2829
:param workspace: str, 工作空间
2930
:param kwargs: dict, 其他参数,为了增加灵活性,可以在on_init的时候设置一些其他类内参数
3031
"""
@@ -42,7 +43,6 @@ def before_init_experiment(
4243
run_id: str,
4344
exp_name: str,
4445
description: str,
45-
num: int,
4646
colors: Tuple[str, str],
4747
*args,
4848
**kwargs,
@@ -52,7 +52,6 @@ def before_init_experiment(
5252
:param run_id: str, SwanLabRun的运行id
5353
:param exp_name: str, 实验名称
5454
:param description: str, 实验描述
55-
:param num: int, 历史实验数量
5655
:param colors: Tuple[str, str], 实验颜色,[light, dark]
5756
"""
5857
pass

swankit/env.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class SwanLabMode(Enum):
2222

2323
DISABLED = "disabled"
2424
CLOUD = "cloud"
25-
CLOUD_ONLY = "cloud-only"
25+
BACKUP = "backup"
2626
LOCAL = "local"
2727

2828
@classmethod
@@ -49,7 +49,7 @@ class SwanLabSharedEnv(Enum):
4949
"""
5050
SWANLAB_MODE = "SWANLAB_MODE"
5151
"""
52-
swanlab的解析模式,涉及操作员注册的回调,目前有三种:local、cloud、disabled,默认为cloud
52+
swanlab的解析模式,涉及操作员注册的回调,目前有四种:local、cloud、disabled 和 backup,默认为cloud
5353
大小写不敏感
5454
"""
5555

test/unit/test_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_list_mode():
2828
assert len(ms) == 4
2929
assert "disabled" in ms
3030
assert "cloud" in ms
31-
assert "cloud-only" in ms
31+
assert "backup" in ms
3232
assert "local" in ms
3333

3434

0 commit comments

Comments
 (0)