并行执行验收爬虫与截图下发
This commit is contained in:
@@ -1396,6 +1396,11 @@ def _fetch_sources(public_id: str) -> None:
|
||||
with connection() as conn:
|
||||
conn.execute("UPDATE acceptance_tasks SET progress_percent=65,updated_at=? WHERE id=?", (now_iso(), task["id"]))
|
||||
if initial_analysis_future is not None:
|
||||
# combined 任务的数据分析 Future 已经在运行;先下发截图,二者并行执行。
|
||||
if task["acceptance_method"] == "combined":
|
||||
run_failures += _execute_acceptance_method(
|
||||
task["id"], "screenshot", keywords, task["device_count"],
|
||||
)
|
||||
run_failures += initial_analysis_future.result()
|
||||
new_keywords = [keyword for keyword in keywords if keyword not in initial_keywords]
|
||||
if new_keywords:
|
||||
@@ -1403,10 +1408,6 @@ def _fetch_sources(public_id: str) -> None:
|
||||
task["id"], "data-analysis", new_keywords,
|
||||
task["cookie_count"] if task["acceptance_method"] == "combined" else task["device_count"],
|
||||
)
|
||||
if task["acceptance_method"] == "combined":
|
||||
run_failures += _execute_acceptance_method(
|
||||
task["id"], "screenshot", keywords, task["device_count"],
|
||||
)
|
||||
else:
|
||||
run_failures = _execute_acceptance_method(
|
||||
task["id"], task["acceptance_method"], keywords, task["device_count"]
|
||||
|
||||
Reference in New Issue
Block a user