fix: 为cache文件batch操作的复制和移动行为创建文件夹
This commit is contained in:
parent
ff437e63b3
commit
2a0c3364d0
|
|
@ -13,6 +13,7 @@ from fastapi.responses import JSONResponse, RedirectResponse
|
||||||
from starlette import status
|
from starlette import status
|
||||||
import boto3
|
import boto3
|
||||||
from botocore.config import Config
|
from botocore.config import Config
|
||||||
|
from typing_inspection.typing_objects import target
|
||||||
|
|
||||||
from ..config import WorkerConfig
|
from ..config import WorkerConfig
|
||||||
from ..middleware.authorization import verify_token
|
from ..middleware.authorization import verify_token
|
||||||
|
|
@ -235,6 +236,8 @@ async def s3_copy(body: ClusterCacheBatchRequest) -> ClusterCacheBatchResponse:
|
||||||
results: List[CacheTaskResult] = []
|
results: List[CacheTaskResult] = []
|
||||||
for task in body.tasks:
|
for task in body.tasks:
|
||||||
try:
|
try:
|
||||||
|
if task.target:
|
||||||
|
os.makedirs(os.path.dirname(task.target.local_mount_path), exist_ok=True)
|
||||||
match task.type:
|
match task.type:
|
||||||
case CacheOperationType.copy:
|
case CacheOperationType.copy:
|
||||||
shutil.copy(task.source.local_mount_path, task.target.local_mount_path)
|
shutil.copy(task.source.local_mount_path, task.target.local_mount_path)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue