feat(shipping-notice): 新增发货通知自动上传功能与候选资格评估

- 在环境配置中新增 SHIPPING_NOTICE_AUTO_UPLOAD_ENABLED 选项,默认关闭,需显式开启以支持自动上传。
- 引入新的 pytest.ini 文件,增加测试标记以支持自动化测试。
- 删除不再使用的 seed_shipping_notice_agents.py 文件,简化代码库。
- 更新相关 API,增强发货通知与候选资格评估功能,支持多种筛选条件。
- 增强文档与代码注释,反映新的业务逻辑与功能要求。
This commit is contained in:
hugo committed 2026-08-02 19:26:35 +08:00
1 parent cef3d5b26a
commit 3a9fbac2fc
226 files changed
+25010 -2098

No files matched your search

+14 -8
View File
@@ -117,22 +117,28 @@ with app.app_context():
print('missing_job')
raise SystemExit(0)
status = str(job.status or '')
if status in {'succeeded', 'failed', 'cancelled'}:
print('ok:' + status)
# [STEP] 仅 succeeded 证明 Handler 跑通 finish_job;failed/cancelled 为假阳性。
if status == 'succeeded':
print('ok:succeeded')
raise SystemExit(0)
if status == 'running':
# 已被 Worker 领取即视为通过(终态可能稍晚)。
print('ok:running')
if status in {'failed', 'cancelled'}:
print('fail:' + status)
raise SystemExit(0)
time.sleep(1.5)
print('timeout:queued')
# 超时前若仍 running,说明已领取但未完成——视为领取能力通过(探针应几乎立即 succeeded)。
db.session.expire_all()
job = db.session.get(Job, int(job_id))
if job is not None and str(job.status or '') == 'running':
print('ok:running')
raise SystemExit(0)
print('timeout:' + str(getattr(job, 'status', None) or 'queued'))
PY
)
if [[ "${probe_check}" != ok:* ]]; then
echo "Healthcheck failed: Process Gate worker did not claim probe job (${probe_check:-empty})"
echo "Healthcheck failed: Process Gate worker probe not healthy (${probe_check:-empty})"
exit 1
fi
echo "Process Gate worker claim probe OK (${probe_check})."
echo "Process Gate worker probe OK (${probe_check})."
echo "Healthcheck passed for ${ENV_NAME} environment."
exit 0
+9 -2
View File
@@ -116,14 +116,21 @@ def build_heartbeat_payload(
) -> dict[str, Any]:
"""
组装心跳 payload。
核心逻辑:capabilities 固定包含 inventory_export;shared_scope_id 用于跨平台路径对齐。
核心逻辑:capabilities 含 inventory_export;Worker 开启上传时附加 freight_upload;
shared_scope_id 用于跨平台路径对齐与环境隔离。
"""
hostname = socket.gethostname()
capabilities = ["inventory_export"]
upload_enabled = str(_env("SHIPPING_NOTICE_RPA_WORKER_UPLOAD_ENABLED", "false") or "false").strip().lower() in {
"1", "true", "yes", "on",
}
if upload_enabled:
capabilities.append("freight_upload")
return {
"worker_id": _resolve_worker_id(hostname),
"hostname": hostname,
"environment": _resolve_worker_environment(),
"capabilities": ["inventory_export"],
"capabilities": capabilities,
"status": status or get_worker_runtime_status(),
"trigger_dir": str(trigger_dir),
"drop_dir": str(drop_dir),