Skip to content

Commit 554bcad

Browse files
committed
Support unilabos_samples key
1 parent a662c75 commit 554bcad

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

unilabos/app/oss_upload.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import os
33
import time
44
from datetime import datetime
5-
from typing import Dict, Optional, Tuple
5+
from pathlib import Path
6+
from typing import Dict, Optional, Tuple, Union
67

78
import requests
89

@@ -97,7 +98,7 @@ def _put_upload(file_path: str, upload_url: str) -> bool:
9798

9899

99100
def oss_upload(
100-
file_path: str,
101+
file_path: Union[str, Path],
101102
filename: Optional[str] = None,
102103
driver_name: str = "default",
103104
exp_type: str = "default",
@@ -122,6 +123,7 @@ def oss_upload(
122123
"oss_path": str # OSS路径(成功时)或空字符串(失败时)
123124
}
124125
"""
126+
file_path = Path(file_path)
125127
if filename is None:
126128
filename = os.path.basename(file_path)
127129

unilabos/ros/nodes/presets/host_node.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,12 @@ def get_result_callback(self, item: "QueueItem", action_id: str, future) -> None
752752
if return_info_str is not None:
753753
try:
754754
return_info = json.loads(return_info_str)
755+
# 适配后端的一些额外处理
756+
return_value = return_info.get("return_value")
757+
if isinstance(return_value, dict):
758+
unilabos_samples = return_info.get("unilabos_samples")
759+
if isinstance(unilabos_samples, list):
760+
return_info["unilabos_samples"] = unilabos_samples
755761
suc = return_info.get("suc", False)
756762
if not suc:
757763
status = "failed"

0 commit comments

Comments
 (0)