This repository was archived by the owner on Oct 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ build-backend = "hatchling.build"
99
1010[project ]
1111name = " swankit"
12- version = " 0.2.1 "
12+ version = " 0.2.2 "
1313dynamic = [" readme" , " dependencies" ]
1414description = " Base toolkit for SwanLab"
1515license = " Apache-2.0"
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class SwanLabMode(Enum):
2222
2323 DISABLED = "disabled"
2424 CLOUD = "cloud"
25- BACKUP = "backup "
25+ OFFLINE = "offline "
2626 LOCAL = "local"
2727
2828 @classmethod
@@ -107,8 +107,12 @@ def get_save_dir() -> str:
107107 if not os .path .exists (os .path .dirname (folder )):
108108 raise FileNotFoundError (f"{ os .path .dirname (folder )} not found" )
109109 if not os .path .exists (folder ):
110- # 只创建当前文件夹,不创建父文件夹
111- os .mkdir (folder )
110+ # 只创建当前文件夹,不创建父文件夹,之所以还要捕捉 FileExistsError,是因为在多线程或多进程环境下,可能会有多个线程或进程同时创建同一个文件夹
111+ # 比如:https://github.com/SwanHubX/SwanLab/issues/1033
112+ try :
113+ os .mkdir (folder )
114+ except FileExistsError :
115+ pass
112116 if not os .path .isdir (folder ):
113117 raise NotADirectoryError (f"{ folder } is not a directory" )
114118 return folder
Original file line number Diff line number Diff 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 "backup " in ms
31+ assert "offline " in ms
3232 assert "local" in ms
3333
3434
You can’t perform that action at this time.
0 commit comments