3D 冒烟示例单端点失败不再中断其余端点
- wait_for_task / get_task / download_model 失败时记录该端点错误并继续 - 保留 throw_on_failure: false 的原有语义,仅补齐传输与超时类错误
This commit is contained in:
@@ -138,7 +138,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
] {
|
||||
// The SDK poller is used only by this smoke example. It is not part
|
||||
// of the platform-tripo public API.
|
||||
sdk_client
|
||||
//
|
||||
// 每个端点单独报错并继续:这个示例的目的是一次跑完三个端点,
|
||||
// 某个端点超时 / 传输失败不应把剩下的端点一起跳过。
|
||||
if let Err(error) = sdk_client
|
||||
.wait_for_task(
|
||||
&handle.task_id,
|
||||
WaitOptions {
|
||||
@@ -149,9 +152,19 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
..WaitOptions::default()
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
.await
|
||||
{
|
||||
eprintln!("{name} skipped: wait failed: {error}");
|
||||
continue;
|
||||
}
|
||||
|
||||
let snapshot = client.get_task(&handle).await?;
|
||||
let snapshot = match client.get_task(&handle).await {
|
||||
Ok(snapshot) => snapshot,
|
||||
Err(error) => {
|
||||
eprintln!("{name} skipped: task lookup failed: {error}");
|
||||
continue;
|
||||
}
|
||||
};
|
||||
println!(
|
||||
"{name} status={:?} progress={:?} output={:?}",
|
||||
snapshot.status, snapshot.progress, snapshot.output
|
||||
@@ -165,7 +178,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
continue;
|
||||
}
|
||||
|
||||
let downloaded = client.download_model(&snapshot).await?;
|
||||
let downloaded = match client.download_model(&snapshot).await {
|
||||
Ok(downloaded) => downloaded,
|
||||
Err(error) => {
|
||||
eprintln!("{name} skipped: artifact download failed: {error}");
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let filename = downloaded.filename(name);
|
||||
let mut file = File::create(&filename).await?;
|
||||
let mut bytes = 0u64;
|
||||
|
||||
Reference in New Issue
Block a user