优化代码

This commit is contained in:
boyce
2025-10-01 22:26:30 +08:00
parent be0078015f
commit 6511fc4ac0
9 changed files with 411 additions and 93 deletions

View File

@@ -1,19 +1,24 @@
package blueprint
import (
"fmt"
)
type Blueprint struct {
execPool ExecPool
graphPool GraphPool
}
func (bm *Blueprint) Init(execDefFilePath string, graphFilePath string, onRegister func(execPool *ExecPool) error) error {
func (bm *Blueprint) Init(execDefFilePath string, graphFilePath string) error {
err := bm.execPool.Load(execDefFilePath)
if err != nil {
return err
}
err = onRegister(&bm.execPool)
if err != nil {
return err
for _, e := range execNodes {
if !bm.execPool.Register(e) {
return fmt.Errorf("register exec failed,exec:%s", e.GetName())
}
}
err = bm.graphPool.Load(&bm.execPool, graphFilePath)