refactor(workflow): 隔离逻辑运行键为 node_group_id
将 checkpoint、异步任务与段结果缓存的唯一键从 execution_id 改为 node_group_id,区分换参重跑与续跑语义;恢复/续跑复用执行记录的组标识,换参重跑则换新组并软删旧组残留,消除软删墓碑导致同键重存失效的问题。
This commit is contained in:
@@ -6,18 +6,22 @@ import "gitea.redpowerfuture.com/red-future/common/beans"
|
||||
// 崩溃恢复靠持久化的 msg_topic 重订阅 NATS 拿回结果,避免重复调用模型
|
||||
type FlowAsyncTask struct {
|
||||
beans.SQLBaseDO `orm:",inherit"`
|
||||
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:"段序号;非段调用为-1"`
|
||||
ModelId int64 `orm:"model_id" json:"modelId" description:"模型ID"`
|
||||
TaskId int64 `orm:"task_id" json:"taskId" description:"model-gateway任务ID"`
|
||||
MsgTopic string `orm:"msg_topic" json:"msgTopic" description:"结果消息主题"`
|
||||
State int `orm:"state" json:"state" description:"0=in-flight,1=done,2=failed"`
|
||||
Result string `orm:"result" json:"result" description:"成功结果JSON(ModelCallRes)"`
|
||||
// NodeGroupId 所属逻辑运行(attempt)标识:全新/换参重跑=新组,续跑/恢复/自动重试=复用 exec 记录的组。
|
||||
// 缓存唯一键以 (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:"段序号;非段调用为-1"`
|
||||
ModelId int64 `orm:"model_id" json:"modelId" description:"模型ID"`
|
||||
TaskId int64 `orm:"task_id" json:"taskId" description:"model-gateway任务ID"`
|
||||
MsgTopic string `orm:"msg_topic" json:"msgTopic" description:"结果消息主题"`
|
||||
State int `orm:"state" json:"state" description:"0=in-flight,1=done,2=failed"`
|
||||
Result string `orm:"result" json:"result" description:"成功结果JSON(ModelCallRes)"`
|
||||
}
|
||||
|
||||
type flowAsyncTaskCol struct {
|
||||
beans.SQLBaseCol
|
||||
NodeGroupId string
|
||||
ExecutionId string
|
||||
NodeId string
|
||||
SegmentIndex string
|
||||
@@ -30,6 +34,7 @@ type flowAsyncTaskCol struct {
|
||||
|
||||
var FlowAsyncTaskCol = flowAsyncTaskCol{
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
NodeGroupId: "node_group_id",
|
||||
ExecutionId: "execution_id",
|
||||
NodeId: "node_id",
|
||||
SegmentIndex: "segment_index",
|
||||
|
||||
Reference in New Issue
Block a user