-
Notifications
You must be signed in to change notification settings - Fork 95
Description
情况是这样的,fastflow部署了一共2台机器。运行的时候,经常报action not found
报这个错误的代码在这里:
execturor.go
func (e *DefExecutor) runAction(taskIns *entity.TaskInstance) error {
act := ActionMap[taskIns.ActionName]
if act == nil {
return fmt.Errorf("action not found: %s", taskIns.ActionName)
}
再翻看源代码,ActionMap 是定义的一个全局变量。
var (
ActionMap = map[string]run.Action{}
defExc Executor
defStore Store
defKeeper Keeper
defParser Parser
defCommander Commander
)
Action 的注册,是将 Action 放到这个 Map 中,相当于数据是存储在‹内存›中,并没有持久化。
在程序中,我是这么注册Action 的。
// 注册 action
fastflow.RegisterAction(actions)
我看到官方文档上是这样描述:
当你开始运行一个 Dag 后,则会为本次执行生成一个执行记录,它被称为 DagInstance,当它生成以后,会由 Leader 实例将其分发到一个健康的 Worker,再由其解析、执行。
假设fastflow.RegisterAction(actions)在2台机器中的A执行,那么是不有可能由另一台机器去执行,是不是因为这个造成的报action not found呢?