docs: sync docs with current package layout and auto-ingest hook
- config.example.yaml: replace stale site_yunda/main_router with new module paths (sites.yunda, runtime) - CLAUDE.md: add ingest-one to DB CLI list; new subsection documenting the download->PostgreSQL auto-ingest hook (_persist_to_db, ingest_task, ingest_state, /status.ingest, auto_ingest config) - README.md: store tree comment lists all 5 CLI commands (add ingest-one) - docs: /status row notes the ingest field; anneng CDP guide snippet gets timeout=15 - cli/server.py: docstring run command -> python -m inbound_verify.cli.server Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
18
CLAUDE.md
18
CLAUDE.md
@@ -33,9 +33,9 @@ playwright install chromium
|
||||
.venv/Scripts/python.exe -m inbound_verify.cli.server
|
||||
# 或:inbound-verify-server
|
||||
|
||||
# DB CLI:建库 / 初始化 / 灌数据 / 全流程
|
||||
.venv/Scripts/python.exe -m inbound_verify.store createdb # 或 init | ingest | all
|
||||
# 或:inbound-verify-db createdb|init|ingest|all
|
||||
# DB CLI:建库 / 初始化 / 灌数据 / 全流程 / 单站单类
|
||||
.venv/Scripts/python.exe -m inbound_verify.store createdb # 或 init | ingest | ingest-one <site> <kind> | all
|
||||
# 或:inbound-verify-db createdb|init|ingest|ingest-one|all
|
||||
|
||||
# 单站点联调:在 config.yaml 设 debug.enabled=true + debug.target_site=顺心|百世|中通|韵达|安能
|
||||
# 网页站:只挂载该站;安能:只启动 Electron 应用。
|
||||
@@ -112,6 +112,18 @@ playwright install chromium
|
||||
`inbound_verify.compare`(菜单 [9])纯离线:读 `downloads/` 下各站应到/实到 xlsx,
|
||||
比对生成 `output/应到未到数据.xlsx`(汇总 + 各站明细)。
|
||||
|
||||
### 自动入库(下载成功后 → PostgreSQL)
|
||||
`dispatch_task` 下载成功后,在 `_record_business_date` 旁挂一个**尽力而为**钩子
|
||||
`_persist_to_db(site, kind)`(`runtime`):懒导入 `store`,调 `store.ingest_task(site, kind)`
|
||||
按 kind 幂等 UPSERT 进 PostgreSQL(expected/actual 各入其列;undelivered——百世入未到、
|
||||
4 站连入 expected+actual)。**绝不影响下载任务的成功判定**:所有写库/写状态都包 try/except,
|
||||
失败只告警。
|
||||
- 开关 `postgres.auto_ingest`(默认开)+ `connect_timeout_seconds`(兜 cpolar 抖动)。
|
||||
- 可见性:结果写 `state_store.ingest_state`(每站每类 ok/count/ingested_at/error),经
|
||||
`GET /status` 的 `ingest` 字段暴露。
|
||||
- 手动:`store` CLI `ingest-one <site> <kind>` 用同套路由单测(脱离下载)。
|
||||
- 注意:跑在 Playwright 线程、同步阻塞;cpolar 慢/断靠超时 + try/except 降级,不重试不补入。
|
||||
|
||||
### 路径
|
||||
`inbound_verify.paths` 把 `DOWNLOAD_DIR` / `CONFIG_PATH` / `BASE_DIR` 全部锚定到项目目录,
|
||||
**不依赖运行时 cwd**——别用相对路径或 `os.getcwd()`。
|
||||
|
||||
Reference in New Issue
Block a user