From 9577e49762a9d6600860cd617f0e52485ec24f07 Mon Sep 17 00:00:00 2001 From: hmo Date: Wed, 12 Aug 2026 10:00:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20F=E5=81=A5=E5=BA=B7=E4=B8=89=E5=B1=82?= =?UTF-8?q?=E6=9E=B6=E6=9E=84=E6=94=B9=E9=80=A0step1=E2=80=94=E2=80=94enti?= =?UTF-8?q?ties/pipelines=E5=8A=A0layer=E5=AD=97=E6=AE=B5(TABLE=5FLAYER?= =?UTF-8?q?=E8=A1=A8=E5=BD=92=E5=B1=9E+PIPELINE=5FLAYER=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=BD=92=E5=B1=9E,=E9=87=87=E9=9B=86/=E5=8A=A0=E5=B7=A5/?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E4=B8=89=E5=B1=82)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/mofin_health.py | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/deploy/profile-scripts/mofin_health.py b/deploy/profile-scripts/mofin_health.py index a224cba1..7664076a 100644 --- a/deploy/profile-scripts/mofin_health.py +++ b/deploy/profile-scripts/mofin_health.py @@ -73,6 +73,52 @@ JSON_DESC = { "mofin_health.json": "健康监控数据", } +# ── 2026-08-12 三层架构层归属映射(采集→加工→使用,老莫定)── +# 数据表层归属:collect=采集层原始数据 / process=加工层衍生数据 / biz=使用层业务数据 +TABLE_LAYER = { + # 采集层原始数据(采集任务直接写入) + "stock_daily": "collect", "stock_weekly": "collect", "stock_monthly": "collect", + "stock_news": "collect", "stock_fundamentals": "collect", + "stock_capital_flow": "collect", "market_snapshots": "collect", + "sector_snapshots": "collect", "macro_raw_news": "collect", + "macro_context_log": "collect", "live_prices": "collect", + "capital_flow_cache": "collect", "stocks": "collect", + "stock_sectors": "collect", "stock_sectors_em": "collect", + "price_events": "collect", + # 加工层衍生数据(加工任务由原始数据算出) + "stock_indicators": "process", "market_indicators": "process", + "sector_index_daily": "process", "mtf_cache": "process", + "portfolio_state": "process", + # 其余默认 biz(使用层业务数据:candidates/holdings/strategy_*/watchlist 等) +} + +# 任务层归属(按脚本名关键词匹配,优先级 collect>process>use>monitor,默认 use) +PIPELINE_LAYER_RULES = [ + ("collect", ["daily_kline", "news_collector", "fundamentals_full", "fundamentals_refresh", + "market_watch", "price_monitor", "capital_flow_collector", "macro_context_collector", + "collect_evaluation_data", "refresh_macro_context", "sector_enrich", "import_holding", + "market_data", "mofin_collect"]), + ("process", ["factor_engine", "sector_index_builder", "refresh_mtf_cache", "multi_timeframe"]), + ("use", ["scanner", "screener", "candidate_filter", "promote_candidates", "reassess", + "stale_detector", "watchlist_auto_exit", "branch_", "meta_growth", "prune_branches", + "market_insight", "strategy_evaluator", "strategy_review", "premarket_full_review", + "staleness", "review_needed", "stale_push", "mr_scanner", "s2_scanner", + "predictive_oversold", "accumulation", "watchlist_12d"]), + ("monitor", ["health", "audit", "verify", "governance", "guardian", "watchdog", "repair", + "spiral", "deploy_guard", "todo_executor", "backup", "vacuum", "gateway", + "clean_watchlist", "xmpp", "brief", "signal_consumer", "divergence", + "monitor", "hygiene", "hardcode", "preflight"]), +] + + +def _pipeline_layer(script, name): + """按脚本名/任务名关键词匹配层归属(collect>process>use>monitor,默认 use)""" + s = (script or "").lower() + " " + (name or "").lower() + for layer, kws in PIPELINE_LAYER_RULES: + if any(k in s for k in kws): + return layer + return "use" + now = datetime.now() def load_cron_jobs(): @@ -856,6 +902,7 @@ def build_report(): entities.append({ "name": tname, "desc": TABLES_DESC.get(tname, ""), + "layer": TABLE_LAYER.get(tname, "biz"), # 2026-08-12 三层架构层归属 "rows": cnt, "readers": readers[:10], "writers": writers[:10], @@ -970,6 +1017,7 @@ def build_report(): "name": name, "type": "no_agent" if no_agent else "LLM", "script": script, + "layer": _pipeline_layer(script, name), # 2026-08-12 三层架构层归属 "schedule": schedule, "status": status, "last_run": last_run,