开发机迁移
This commit is contained in:
@@ -224,6 +224,9 @@ class FlowRunner:
|
||||
summary_text = flow_logger.end(status="成功")
|
||||
self.logger.info("\n%s", summary_text)
|
||||
|
||||
# CHANGE 2026-04-07 | Fix-12:ETL 完成后通知后端触发任务编排
|
||||
self._notify_backend_etl_completed(run_label)
|
||||
|
||||
return {
|
||||
"status": "SUCCESS",
|
||||
"flow": run_label,
|
||||
@@ -243,6 +246,33 @@ class FlowRunner:
|
||||
self.logger.error("\n%s", summary_text)
|
||||
raise
|
||||
|
||||
def _notify_backend_etl_completed(self, pipeline: str) -> None:
|
||||
"""ETL 完成后通知后端触发任务编排(recall_detector → task_generator)。
|
||||
|
||||
CHANGE 2026-04-07 | Fix-12:失败不阻断主流程,仅记录警告。
|
||||
"""
|
||||
import os
|
||||
backend_url = os.getenv("BACKEND_API_URL", "http://127.0.0.1:8000")
|
||||
internal_token = os.getenv("INTERNAL_API_TOKEN", "")
|
||||
if not internal_token:
|
||||
self.logger.warning("ETL 完成回调跳过:INTERNAL_API_TOKEN 未配置")
|
||||
return
|
||||
|
||||
try:
|
||||
import httpx
|
||||
resp = httpx.post(
|
||||
f"{backend_url}/api/internal/etl-completed",
|
||||
json={"pipeline": pipeline},
|
||||
headers={"Authorization": f"Internal-Token {internal_token}"},
|
||||
timeout=300,
|
||||
)
|
||||
if resp.status_code == 200:
|
||||
self.logger.info("ETL 完成回调成功: %s", resp.json())
|
||||
else:
|
||||
self.logger.warning("ETL 完成回调失败: status=%d, body=%s", resp.status_code, resp.text)
|
||||
except Exception:
|
||||
self.logger.warning("ETL 完成回调异常(不阻断主流程)", exc_info=True)
|
||||
|
||||
def _run_post_consistency_check(self, timer: EtlTimer) -> str | None:
|
||||
"""ETL 完成后运行数据一致性检查,输出黑盒测试报告。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user