style: auto-format with black + isort + ruff + prettier [skip ci-format-check]
This commit is contained in:
@@ -450,7 +450,11 @@ def _analyze_single_image(
|
||||
_elapsed = time.time() - _t0
|
||||
logger.info(
|
||||
"[爆款视频] 图片 #%d VLM(%s/%s) 完成 elapsed=%.1fs timeout=%d",
|
||||
idx, label, model, _elapsed, tmo,
|
||||
idx,
|
||||
label,
|
||||
model,
|
||||
_elapsed,
|
||||
tmo,
|
||||
)
|
||||
if raw is None:
|
||||
return None
|
||||
@@ -467,7 +471,11 @@ def _analyze_single_image(
|
||||
_elapsed = time.time() - _t0
|
||||
logger.warning(
|
||||
"[爆款视频] 图片 #%d call_vision(%s/%s) 异常 elapsed=%.1fs err=%s",
|
||||
idx, label, model, _elapsed, e,
|
||||
idx,
|
||||
label,
|
||||
model,
|
||||
_elapsed,
|
||||
e,
|
||||
)
|
||||
return None
|
||||
|
||||
@@ -786,7 +794,9 @@ def _analyze_single_image(
|
||||
winner["_fallback_used"] = True
|
||||
logger.info(
|
||||
"[爆款视频] 图片 #%d 竞速胜出=%s elapsed=%.1fs",
|
||||
idx, _lbl, time.time() - race_t0,
|
||||
idx,
|
||||
_lbl,
|
||||
time.time() - race_t0,
|
||||
)
|
||||
break
|
||||
if winner is not None:
|
||||
@@ -798,7 +808,9 @@ def _analyze_single_image(
|
||||
_last_raw = None
|
||||
_last = _normalize(_last_raw, "pro_fallback")
|
||||
logger.warning(
|
||||
"[爆款视频] 图片 #%d lite/pro 竞速均失败 elapsed=%.1fs", idx, time.time() - race_t0,
|
||||
"[爆款视频] 图片 #%d lite/pro 竞速均失败 elapsed=%.1fs",
|
||||
idx,
|
||||
time.time() - race_t0,
|
||||
)
|
||||
return _last
|
||||
|
||||
@@ -851,6 +863,7 @@ def _step_image_analysis(job: ViralVideoJob) -> dict:
|
||||
# #2194/#2198: 整个并行图片分析阶段统一把共享 client 的 max_retries 置 0,
|
||||
# 阶段结束 finally 恢复。子线程 _call 只读不改,避免竞态。
|
||||
from packages.shared.ai_client import get_doubao_client as _gdc_step
|
||||
|
||||
_step_client = _gdc_step()
|
||||
_step_orig_retries = _step_client.max_retries
|
||||
_step_client.max_retries = 0
|
||||
@@ -859,7 +872,11 @@ def _step_image_analysis(job: ViralVideoJob) -> dict:
|
||||
max_workers = min(2, max(1, len(normalized_urls))) # 并发≤2 防方舟限流(竞速模式下总并发=4)
|
||||
logger.info(
|
||||
"[爆款视频] 开始并行竞速图片分析 n=%d lite=%s(%ds) pro=%s(75s) img_workers=%d",
|
||||
len(normalized_urls), vision_model, vision_timeout, pro_model, max_workers,
|
||||
len(normalized_urls),
|
||||
vision_model,
|
||||
vision_timeout,
|
||||
pro_model,
|
||||
max_workers,
|
||||
)
|
||||
try:
|
||||
with ThreadPoolExecutor(max_workers=max_workers) as pool:
|
||||
|
||||
Reference in New Issue
Block a user