refactor(workflow): 隔离逻辑运行键为 node_group_id

将 checkpoint、异步任务与段结果缓存的唯一键从 execution_id 改为 node_group_id,区分换参重跑与续跑语义;恢复/续跑复用执行记录的组标识,换参重跑则换新组并软删旧组残留,消除软删墓碑导致同键重存失效的问题。
This commit is contained in:
2026-09-04 17:36:46 +08:00
parent 8c6305f267
commit 73f296731c
10 changed files with 167 additions and 97 deletions
+6 -1
View File
@@ -6,7 +6,10 @@ import "gitea.redpowerfuture.com/red-future/common/beans"
type FlowSegmentResult struct {
beans.SQLBaseDO `orm:",inherit"` // 嵌入基础字段:Id, TenantId, Creator, CreatedAt, Updater, UpdatedAt, DeletedAt
// 业务字段
ExecutionId int64 `orm:"execution_id" json:"executionId" description:"执行ID"`
// NodeGroupId 所属逻辑运行(attempt)标识:段结果唯一键 (node_group_id, node_id, segment_index)
// 换参重跑换组即换键,绝不复用被软删墓碑的旧组行(软删即终态,不复活)
NodeGroupId string `orm:"node_group_id" json:"nodeGroupId" description:"所属逻辑运行(node_group_id)标识"`
ExecutionId int64 `orm:"execution_id" json:"executionId" description:"执行ID(溯源,不参与唯一键)"`
NodeId string `orm:"node_id" json:"nodeId" description:"视频生成节点ID"`
SegmentIndex int `orm:"segment_index" json:"segmentIndex" description:"段序号"`
VideoKey string `orm:"video_key" json:"videoKey" description:"视频输出字段key"`
@@ -21,6 +24,7 @@ type SegmentRef struct {
type flowSegmentResultCol struct {
beans.SQLBaseCol
NodeGroupId string
ExecutionId string
NodeId string
SegmentIndex string
@@ -30,6 +34,7 @@ type flowSegmentResultCol struct {
var FlowSegmentResultCol = flowSegmentResultCol{
SQLBaseCol: beans.DefSQLBaseCol,
NodeGroupId: "node_group_id",
ExecutionId: "execution_id",
NodeId: "node_id",
SegmentIndex: "segment_index",