From 11a686754a917157521a5351e2199bdb7a9ada8b Mon Sep 17 00:00:00 2001 From: KAAANG <79990647+SAKURA-CAT@users.noreply.github.com> Date: Sun, 30 Jun 2024 00:08:04 +0800 Subject: [PATCH] update key path (#14) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复了 #13 中文件保存路径没有同步更改的问题 --- pyproject.toml | 2 +- swankit/callback/models/key.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 182e4e4..228be55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ build-backend = "hatchling.build" [project] name = "swankit" -version = "0.1.0" +version = "0.1.1b1" dynamic = ["readme"] description = "Base toolkit for SwanLab" license = "Apache-2.0" diff --git a/swankit/callback/models/key.py b/swankit/callback/models/key.py index 7aad74d..c78b201 100644 --- a/swankit/callback/models/key.py +++ b/swankit/callback/models/key.py @@ -127,23 +127,24 @@ def __init__( """ 当前指标对应本地的行数,error时为None """ - self.metric_path = None if self.error else os.path.join(logdir, self.key, metric_file_name) + _id = self.column_info.id + self.metric_path = None if self.error else os.path.join(logdir, _id, metric_file_name) """ 指标文件的路径,error时为None """ - self.summary_path = None if self.error else os.path.join(logdir, self.key, self.__SUMMARY_NAME) + self.summary_path = None if self.error else os.path.join(logdir, _id, self.__SUMMARY_NAME) """ 摘要文件的路径,error时为None """ self.media_dir = media_dir """ - 静态文件的根文件夹 + 静态文件的根文件夹,本地保存时需要自己拼接 """ self.buffers = buffers """ 需要上传的媒体数据,比特流,error时为None,如果上传为非媒体类型(或Text类型),也为None """ - # 写入文件名称,对应上传时的文件名称 + # 写入文件名称,对应上传时的文件名称:{key}/{文件名称},文件夹名称为key if self.buffers is not None: for i, buffer in enumerate(self.buffers): buffer.file_name = "{}/{}".format(self.key, metric["data"][i])