mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-15 00:04:46 +08:00
优化蓝图执行器
This commit is contained in:
@@ -2,6 +2,7 @@ package blueprint
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/duanhf2012/origin/v2/log"
|
||||
)
|
||||
|
||||
type prePortNode struct {
|
||||
@@ -102,20 +103,6 @@ func (en *execNode) exec(gr *Graph) (int, error) {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
//defer func() {
|
||||
inPort, outPort := node.GetPorts()
|
||||
debugString := "inPort:"
|
||||
for i := 0; i < len(inPort); i++ {
|
||||
debugString += fmt.Sprintf("%+v,", inPort[i])
|
||||
}
|
||||
debugString += " outPort:"
|
||||
for i := 0; i < len(outPort); i++ {
|
||||
debugString += fmt.Sprintf("%+v,", outPort[i])
|
||||
}
|
||||
|
||||
fmt.Printf("exec node %s,%s\n", en.execNode.GetName(), debugString)
|
||||
//}()
|
||||
|
||||
return e.Exec()
|
||||
}
|
||||
|
||||
@@ -155,6 +142,10 @@ func (en *execNode) doSetInPort(gr *Graph, index int, inPort IPort) error {
|
||||
}
|
||||
|
||||
func (en *execNode) Do(gr *Graph, outPortArgs ...any) error {
|
||||
if IsDebug {
|
||||
log.Debug("Start ExecNode", log.String("Name",en.execNode.GetName()))
|
||||
}
|
||||
|
||||
// 重新初始化上下文
|
||||
inPorts, outPorts := en.execNode.CloneInOutPort()
|
||||
gr.context[en.Id] = &ExecContext{
|
||||
@@ -194,6 +185,10 @@ func (en *execNode) Do(gr *Graph, outPortArgs ...any) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if IsDebug {
|
||||
log.Debug("End ExecNode", log.String("Name",en.execNode.GetName()),log.Any("InPort",inPorts ),log.Any("OutPort",outPorts))
|
||||
}
|
||||
|
||||
if nextIndex == -1 || en.nextNode == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user