From ab8517390293e5e308a36af901dac99b843e2190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=BE=AE?= Date: Wed, 8 Jul 2026 17:25:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8A=9F=E8=83=BD=E6=A0=91=E5=8F=AA?= =?UTF-8?q?=E6=98=BE=E7=A4=BAposition-analyst(=E7=9F=A5=E5=BE=AE)=E7=9A=84?= =?UTF-8?q?cron=EF=BC=8Cdefault(=E8=8E=AB=E8=8D=B7)=E7=9A=84cron=E4=B8=8D?= =?UTF-8?q?=E6=B7=B7=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/mofin_health.py | 12 ++++++++++-- static/mofin_health.html | 14 +++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/scripts/mofin_health.py b/scripts/mofin_health.py index 7ee11786..4191f791 100644 --- a/scripts/mofin_health.py +++ b/scripts/mofin_health.py @@ -77,11 +77,13 @@ def load_cron_jobs(): jobs = [] seen = set() for jf in CRON_FILES: + profile_tag = "position-analyst" if "position-analyst" in str(jf) else "default" try: for j in json.load(open(jf)).get("jobs", []): jid = j.get("id", "") if jid in seen: continue seen.add(jid) + j["profile"] = profile_tag jobs.append(j) except: pass return jobs @@ -240,6 +242,7 @@ def build_feature_tree(cron_jobs, db_stats): "status": j.get("last_status", "unknown"), "last_run": (j.get("last_run_at", "") or "")[:16] if j.get("last_run_at") else "", "type": "no_agent" if j.get("no_agent") else "LLM", + "profile": j.get("profile", "?"), } for j in matched] if pipes: node["pipes"] = pipes @@ -258,6 +261,7 @@ def build_feature_tree(cron_jobs, db_stats): "status": j.get("last_status", "unknown"), "last_run": (j.get("last_run_at", "") or "")[:16] if j.get("last_run_at") else "", "type": "no_agent" if j.get("no_agent") else "LLM", + "profile": j.get("profile", "?"), }] } @@ -365,8 +369,11 @@ def build_report(): flows = scan_data_flows() script_health = check_scripts() - # ── 功能树 ── - feature_tree = build_feature_tree(cron_jobs, db_stats) + # ── 功能树(只显示知微的cron)── + zhiwei_crons = [j for j in cron_jobs if j.get("profile") == "position-analyst" or j.get("name") in [ + "cron-推XMPP中继", "数据同步-dashboard", "记忆守卫-每日", "市场数据采集" + ]] + feature_tree = build_feature_tree(zhiwei_crons, db_stats) # 递归计算节点状态 def calc_status(node): if "children" in node: @@ -435,6 +442,7 @@ def build_report(): "schedule": schedule, "status": status, "last_run": last_run, + "profile": j.get("profile", "?"), }) # ── 写JSON ── diff --git a/static/mofin_health.html b/static/mofin_health.html index a421c434..83e538fd 100644 --- a/static/mofin_health.html +++ b/static/mofin_health.html @@ -48,7 +48,7 @@ td.wrap{white-space:normal;font-size:11px;max-width:200px}
加载中...
🌳 功能树
-
🔧 全部流程/Cron (77)
+
🔧 全部流程/Cron
🗃️ 数据实体
@@ -65,7 +65,7 @@ function switchTab(idx) { } function renderFeatureTree(tree) { - let html = ''; + let html = '
功能模块类型调度状态最后运行
'; function walk(node, depth) { const indent = 'style="padding-left:'+(depth*20+8)+'px"'; const cls = node.status || 'ok'; @@ -76,17 +76,19 @@ function renderFeatureTree(tree) { if (pipes.length === 0) { // 无对应cron的功能节点 html += ``; - html += ``; + html += ``; } else { // 有对应cron的节点 pipes.forEach((p, i) => { const indent2 = i===0 ? indent : 'style="padding-left:'+(depth*20+32)+'px"'; const tagCls = p.status==='ok'?'ok':p.status==='error'?'error':'warn'; + const profileBadge = p.profile==='position-analyst' ? '📋' : '📦'; if (i===0) { html += ``; } else { html += ``; } + html += ``; html += ``; html += ``; html += ``; @@ -103,13 +105,15 @@ function renderFeatureTree(tree) { function renderPipelineTable(pipelines) { let html = ''; - html += '
功能模块来源类型调度状态最后运行
${node.label}(纯逻辑节点)--${cls}-
---${cls}-
${node.label}
${p.name||p.script||'LLM'}${profileBadge} ${p.profile||'?'}${p.type||'LLM'}${p.schedule||'-'}${p.status}
'; + html += '
名称脚本/LLM类型调度状态最后运行
'; pipelines.forEach(p => { const tagCls = p.status==='ok'?'ok':p.status==='error'?'error':'warn'; const statusDisplay = p.last_run ? p.status : '待首次运行'; + const profileBadge = p.profile==='position-analyst' ? '📋' : '📦'; html += ``; + html += ``; html += ``; - html += ``; + html += ``; html += ``; html += ``; html += ``;
名称来源脚本/LLM类型调度状态最后运行
${p.name||p.script||'LLM'}${profileBadge} ${p.profile||'?'}${p.script||'LLM'}${p.type||cron}${p.type||'cron'}${p.schedule||'-'}${statusDisplay}${p.last_run||'-'}