bug fix: 修复boto3 分片上传使用的路径不统一问题
This commit is contained in:
parent
7a51c07e82
commit
05a4834ec5
|
|
@ -1,4 +1,4 @@
|
|||
MODAL_ENVIRONMENT=test
|
||||
MODAL_ENVIRONMENT=dev
|
||||
modal_app_name=bowong-ai-video
|
||||
S3_mount_dir=/mntS3
|
||||
S3_bucket_name=modal-media-cache
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ async def s3_presign_upload(body: UploadPresignRequest) -> UploadPresignResponse
|
|||
""", dependencies=[Depends(verify_token)])
|
||||
async def s3_presign_upload_multipart(body: UploadMultipartPresignRequest) -> UploadMultipartPresignResponse:
|
||||
chunk_count = body.parts_count
|
||||
multipart_upload_response = client.create_multipart_upload(Bucket=config.S3_bucket_name, Key=body.key,
|
||||
multipart_upload_response = client.create_multipart_upload(Bucket=config.S3_bucket_name, Key=f"upload/{body.key}",
|
||||
ContentType=body.content_type, )
|
||||
upload_id = multipart_upload_response.get("UploadId")
|
||||
signed_urls = []
|
||||
|
|
@ -369,7 +369,7 @@ async def s3_presign_upload_multipart(body: UploadMultipartPresignRequest) -> Up
|
|||
signed_url = client.generate_presigned_url("upload_part",
|
||||
Params={
|
||||
'Bucket': config.S3_bucket_name,
|
||||
'Key': body.key,
|
||||
'Key': f"upload/{body.key}",
|
||||
'PartNumber': i + 1,
|
||||
'UploadId': upload_id,
|
||||
}, ExpiresIn=expires_in)
|
||||
|
|
@ -378,14 +378,14 @@ async def s3_presign_upload_multipart(body: UploadMultipartPresignRequest) -> Up
|
|||
signed_completed_url = client.generate_presigned_url("complete_multipart_upload",
|
||||
Params={
|
||||
'Bucket': config.S3_bucket_name,
|
||||
'Key': body.key,
|
||||
'Key': f"upload/{body.key}",
|
||||
# 'PartNumber': chunk_count,
|
||||
'UploadId': upload_id,
|
||||
}, ExpiresIn=expires_in)
|
||||
signed_list_url = client.generate_presigned_url("list_parts",
|
||||
Params={
|
||||
'Bucket': config.S3_bucket_name,
|
||||
'Key': body.key,
|
||||
'Key': f"upload/{body.key}",
|
||||
# 'PartNumber': chunk_count,
|
||||
'UploadId': upload_id,
|
||||
}, ExpiresIn=expires_in)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from BowongModalFunctions.models.settings.cluster import WorkerConfig
|
|||
from .video import app as media_app
|
||||
from .web import app as web_app
|
||||
from .ffmpeg_app import app as ffmpeg_app
|
||||
from .openwebui import app as open_webui
|
||||
# from .openwebui import app as open_webui
|
||||
# from .comfyui_v1 import app as comfyui_v1_app
|
||||
# from .comfyui_v2 import app as comfyui_v2_app
|
||||
|
||||
|
|
@ -16,6 +16,6 @@ app = modal.App(config.modal_app_name,
|
|||
app.include(media_app)
|
||||
app.include(ffmpeg_app)
|
||||
app.include(web_app)
|
||||
app.include(open_webui)
|
||||
# app.include(open_webui)
|
||||
# app.include(comfyui_v1_app)
|
||||
# app.include(comfyui_v2_app)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ app = modal.App(
|
|||
with fastapi_image.imports():
|
||||
from BowongModalFunctions.api import web_app
|
||||
from BowongModalFunctions.models.settings.cluster import WorkerConfig
|
||||
from Douyin_TikTok_Download_API.tikhub_api import web_app_tikhub
|
||||
# from Douyin_TikTok_Download_API.tikhub_api import web_app_tikhub
|
||||
|
||||
config = WorkerConfig()
|
||||
|
||||
|
|
@ -41,24 +41,24 @@ with fastapi_image.imports():
|
|||
},
|
||||
)
|
||||
@modal.concurrent(max_inputs=100)
|
||||
@modal.asgi_app(custom_domains="https://modal-ffmpeg.bowong.cc")
|
||||
@modal.asgi_app(custom_domains=["modal-ffmpeg.bowong.cc"])
|
||||
def fastapi_webapp():
|
||||
return web_app
|
||||
|
||||
|
||||
# 短保持时间保证IP不停更换
|
||||
@app.function(scaledown_window=2,
|
||||
secrets=[modal.Secret.from_name("cf-kv-secret"), ],
|
||||
cloud="aws",
|
||||
volumes={
|
||||
config.S3_mount_dir: modal.CloudBucketMount(
|
||||
bucket_name=config.S3_bucket_name,
|
||||
secret=modal.Secret.from_name("aws-s3-secret",
|
||||
environment_name=config.modal_environment),
|
||||
),
|
||||
},
|
||||
)
|
||||
@modal.concurrent(max_inputs=100)
|
||||
@modal.asgi_app()
|
||||
def fastapi_webapp_tikhub():
|
||||
return web_app_tikhub
|
||||
# # 短保持时间保证IP不停更换
|
||||
# @app.function(scaledown_window=2,
|
||||
# secrets=[modal.Secret.from_name("cf-kv-secret"), ],
|
||||
# cloud="aws",
|
||||
# volumes={
|
||||
# config.S3_mount_dir: modal.CloudBucketMount(
|
||||
# bucket_name=config.S3_bucket_name,
|
||||
# secret=modal.Secret.from_name("aws-s3-secret",
|
||||
# environment_name=config.modal_environment),
|
||||
# ),
|
||||
# },
|
||||
# )
|
||||
# @modal.concurrent(max_inputs=100)
|
||||
# @modal.asgi_app()
|
||||
# def fastapi_webapp_tikhub():
|
||||
# return web_app_tikhub
|
||||
|
|
|
|||
Loading…
Reference in New Issue