# GYXX Flow 运维手册 ## 日常检查 ```bash uv run gyxx doctor --json uv run gyxx schedule status uv run gyxx list ``` Linux 服务同时检查: ```bash systemctl status gyxx-flow.service journalctl -u gyxx-flow.service --since today ``` 工作流失败时,使用 `workflow_id`、业务日期和 `run_id` 对照 `/logs`、运行记录、节点产物和副作用账本。 ## 手工执行 ```bash uv run gyxx run --date 2026-08-01 uv run gyxx run --date 2026-08-01 --execute uv run gyxx scripts list --json uv run gyxx scripts run --date 2026-08-01 uv run gyxx scripts run --date 2026-08-01 --execute ``` `gyxx run` 只接受 22 个调度工作流;补采和维护操作使用 `gyxx scripts run`。两类入口都默认 dry-run,只有业务日期、凭据、浏览器登录态、PostgreSQL 和对应 Hermes 角色全部确认后才使用 `--execute`。 | 手动场景 | 命令 ID | 日期行为 | |---|---|---| | 内容映射重建 | `content.mapping.rebuild` | 业务日期只用于运行审计 | | 内容失败任务重试 | `content.failed.retry` | 业务日期只用于运行审计 | | 内容日报重跑 | `gyxx backfill content.metrics.daily` | 使用 `--from/--to` 指定日期范围 | | 京东自营品牌单日回采 | `shop.jd_self_operated.collect_brand` | `--date` 自动成为起止日期 | | 商品历史补采 | `product.backfill.run` | `--date` 自动成为 `--from/--to` | | 商品评价补采 | `product.review.orchestrate` | `--date` 自动成为目标日期 | | 采购单更新 | `supply.workflow.run` | 自动选择 `mcp-run purchase-order-update` | 命令的额外脚本参数使用可重复的 `--arg=<值>` 传入。`supply.workflow.run --execute` 会进入真实 ERP 修改链路,必须在任务文件、目标范围和回滚条件全部复核后执行。 ### 主图周工作流 主图调度的唯一工作流 ID 是 `product.main_image.weekly`,每周日 08:30 启动。图同时运行 JD、TM 两个无依赖分支;一个平台失败不会取消、跳过或回滚另一个平台的采集、PG upsert 和飞书插入。两个分支全部结束后再汇总工作流状态:任一平台失败时整体状态为失败,并在错误摘要中标明具体平台和错误,另一平台已经成功的结果继续保留。 两个平台默认都在采集后执行飞书主图表插入和本地 PostgreSQL `main_image_creatives` upsert。执行前必须同时确认两套浏览器登录态、飞书身份和本地数据库;排障时分别检查 `jd`、`tmall` 节点以及对应插入脚本日志,不能只以采集文件存在判断双 sink 已完成。 ## 调度操作 ```bash uv run gyxx schedule run --dry-run --once uv run gyxx schedule status sudo systemctl restart gyxx-flow.service ``` 调度服务也只加载显式指定的受控环境文件: ```bash uv run gyxx schedule run --env-file /etc/gyxx-flow/gyxx-flow.env ``` 业务时间只在 `config/schedules.json` 中维护。systemd 负责进程守护,Python scheduler 负责全部业务定时;不要重复注册 cron、systemd timer 或 Windows 任务计划。 需要停用单个工作流时,优先修改该工作流的调度启用状态,先 dry-run,再重启服务。其他模块继续运行。 ## 数据和浏览器状态 生产 `GYXX_DATA_ROOT` 必须位于源码目录之外,Linux 推荐 `/var/lib/gyxx-flow`: - `data/raw/`:原始采集结果,不按临时文件清理。 - `data/normalized`、`data/curated`:清洗、标准化和聚合数据。 - `data/exports`:Markdown、Excel 等交付文件。 - `state/browser//