fix: delete error

This commit is contained in:
tao.chen
2026-08-14 19:19:41 +08:00
parent 2e070fae78
commit 139f2c02c1
5 changed files with 44 additions and 24 deletions
+2
View File
@@ -27,6 +27,7 @@ from .factory import (
build_storage_config,
create_storage,
rclone_remote_spec,
USAGE_TYPE_TO_PURPOSE,
workspaces_root,
)
from .registry import register_backend, registered_backends
@@ -36,6 +37,7 @@ __all__ = [
"build_storage_config",
"actual_bucket_name",
"build_storage_uri",
"USAGE_TYPE_TO_PURPOSE",
"workspaces_root",
"rclone_remote_spec",
"RCLONE_REMOTE_NAME",
+15
View File
@@ -62,6 +62,21 @@ def create_storage(config: Dict[str, Any]) -> AnyStorageBackend:
PURPOSE_BUCKETS: tuple[str, ...] = ("workspace", "version", "run_log", "trash")
# Map an upload's usage_type to its purpose (which then resolves to the
# actual bucket / directory via ``actual_bucket_name``). Keeping the
# purpose as the intermediate value means s3 mode and local mode share
# the same routing logic — only the final ``actual_bucket_name`` differs.
USAGE_TYPE_TO_PURPOSE: dict[str, str] = {
"working_copy": "workspace",
"public_script": "workspace",
"data_resource": "workspace",
"snapshot": "workspace",
"version_artifact": "version",
"run_log": "run_log",
"run_result": "run_log",
}
def actual_bucket_name(purpose: str) -> str:
"""把 purpose 名称解析成实际桶路径 / 名(runtime 数据会存在这个字符串里)。