允许跳过下载,并发下载,env和版本更新

This commit is contained in:
2025-07-18 12:32:15 +08:00
parent 13a10b9812
commit 4b080771f6
6 changed files with 39 additions and 18 deletions

View File

@@ -70,9 +70,10 @@ def upload_to_oss(url, file_path):
return False
def download_from_oss(url, file_path):
def download_from_oss(url, file_path, skip_if_exist=False):
"""
使用签名URL下载文件到OSS
:param skip_if_exist: 如果存在就不下载了
:param str url: 签名URL
:param Union[LiteralString, str, bytes] file_path: 文件路径
:return bool: 是否成功
@@ -81,6 +82,10 @@ def download_from_oss(url, file_path):
with tracer.start_as_current_span("download_from_oss") as span:
span.set_attribute("file.url", url)
span.set_attribute("file.path", file_path)
if skip_if_exist and os.path.exists(file_path):
span.set_attribute("file.exist", True)
span.set_attribute("file.size", os.path.getsize(file_path))
return True
logging.info("download_from_oss: %s", url)
file_dir, file_name = os.path.split(file_path)
if file_dir: