feat(workflow): 增加工作流计费与执行生命周期管理

- 新增计费模块:执行开始建单、终态结算/取消/失败处理,支持按条/按秒/按token计费
- 新增执行生命周期跟踪:优雅关停时取消运行中执行并等待落库
- 新增异步任务等待/通知机制(Wait/Notify)
- 重构执行记录落库与进度上报,统一失败分类与重试语义
- 重命名文件:async_task.go→async.go、flow_checkpoint_store.go→exec_checkpoint.go、flow_graph_util.go→exec_record.go
- 更新 .gitignore 与数据库密码配置
This commit is contained in:
2026-09-03 13:22:22 +08:00
parent 67d049e586
commit d699f7ce14
46 changed files with 2690 additions and 2450 deletions
+5
View File
@@ -87,6 +87,11 @@ func (d *nodeExecutionDao) ListByFlowExecutionId(ctx context.Context, req *nodeD
model := gfdb.DB(ctx, public.DbNameBlackDeacon).Model(ctx, public.TableNameNodeExecution).NoTenantId(ctx).Fields(fields).OmitEmpty()
model.Where(entity.NodeExecutionCol.FlowExecutionId, req.FlowExecutionId)
model.Where(entity.NodeExecutionCol.NodeGroupId, req.NodeGroupId)
if req.CreatedAtFrom != nil {
// 结算按订单收敛:只聚合订单创建后产生的节点记录(重跑开新单,created_at 各自独立,
// 避免把已终局运行(已结算扣费)的用量计入本次订单)
model.WhereGTE(entity.NodeExecutionCol.CreatedAt, *req.CreatedAtFrom)
}
model.Where(entity.NodeExecutionCol.Status, req.Status)
model.Where(entity.NodeExecutionCol.NodeId, req.NodeId)
model.OrderAsc(entity.NodeExecutionCol.CreatedAt)