mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-12-24 13:28:13 +08:00
[Feature] Support async download chunk video features (#5297)
This commit is contained in:
@@ -599,16 +599,14 @@ class ResourceManagerV1(ResourceManager):
|
||||
"""
|
||||
|
||||
def download_bos_features(bos_client, features_urls):
|
||||
result_list = []
|
||||
for status, feature in download_from_bos(self.bos_client, features_urls):
|
||||
if status:
|
||||
llm_logger.info(f"request {request.request_id} async download feature: {feature.shape}")
|
||||
result_list.append(feature)
|
||||
llm_logger.info("request download features success.")
|
||||
return feature
|
||||
else:
|
||||
error_msg = f"request {request.request_id} download features error: {feature}"
|
||||
llm_logger.error(error_msg)
|
||||
return error_msg
|
||||
return result_list
|
||||
|
||||
if not self.config.parallel_config.enable_async_download_features or not self._has_features_info(request):
|
||||
return None
|
||||
|
||||
@@ -827,19 +827,26 @@ def download_from_bos(bos_client, bos_links, timeout=1):
|
||||
if not isinstance(bos_links, list):
|
||||
bos_links = [bos_links]
|
||||
|
||||
for link in bos_links:
|
||||
try:
|
||||
if link.startswith("bos://"):
|
||||
link = link.replace("bos://", "")
|
||||
total_feature = []
|
||||
for single_link in bos_links:
|
||||
if isinstance(single_link, str):
|
||||
single_link = [single_link]
|
||||
single_feature = []
|
||||
for link in single_link:
|
||||
try:
|
||||
if link.startswith("bos://"):
|
||||
link = link.replace("bos://", "")
|
||||
|
||||
bucket_name = "/".join(link.split("/")[1:-1])
|
||||
object_key = link.split("/")[-1]
|
||||
bucket_name = "/".join(link.split("/")[1:-1])
|
||||
object_key = link.split("/")[-1]
|
||||
|
||||
response = bos_client.get_object_as_string(bucket_name, object_key)
|
||||
yield True, pickle.loads(response)
|
||||
except Exception as e:
|
||||
yield False, f"link {link} download error: {str(e)}"
|
||||
break
|
||||
response = bos_client.get_object_as_string(bucket_name, object_key)
|
||||
single_feature.append(pickle.loads(response))
|
||||
except Exception as e:
|
||||
yield False, f"link {link} download error: {str(e)}"
|
||||
break
|
||||
total_feature.append(single_feature)
|
||||
yield True, total_feature
|
||||
|
||||
|
||||
llm_logger = get_logger("fastdeploy", "fastdeploy.log")
|
||||
|
||||
Reference in New Issue
Block a user