diff --git a/examples/helloworld.yaml b/examples/helloworld.yaml index 42e2c8cc..34b40e5c 100644 --- a/examples/helloworld.yaml +++ b/examples/helloworld.yaml @@ -7,12 +7,9 @@ - kind: print filename: /dev/stdout ports: - init: + begin: - name: hello_world port: in - env: - PORT: - - data: '{{ .PORT }}' - kind: step name: good_bye diff --git a/pkg/node/port.go b/pkg/node/port.go index 48324d88..83fe36ef 100644 --- a/pkg/node/port.go +++ b/pkg/node/port.go @@ -9,7 +9,9 @@ import ( // Commonly used port names. const ( PortInit = "init" + PortBegin = "begin" PortTerm = "term" + PortFinal = "final" PortIO = "io" PortIn = "in" PortOut = "out" diff --git a/pkg/symbol/loader.go b/pkg/symbol/loader.go index 95464a22..d4ab43f9 100644 --- a/pkg/symbol/loader.go +++ b/pkg/symbol/loader.go @@ -3,9 +3,9 @@ package symbol import ( "context" "errors" - "github.com/iancoleman/strcase" "reflect" + "github.com/iancoleman/strcase" "github.com/siyul-park/uniflow/pkg/resource" "github.com/siyul-park/uniflow/pkg/scheme" "github.com/siyul-park/uniflow/pkg/spec" diff --git a/pkg/symbol/table.go b/pkg/symbol/table.go index 2c2622fe..786a4ea3 100644 --- a/pkg/symbol/table.go +++ b/pkg/symbol/table.go @@ -272,10 +272,13 @@ func (t *Table) load(sb *Symbol) error { linked := t.linked(sb) for _, sb := range linked { if t.active(sb) { + if err := t.call(sb, node.PortInit); err != nil { + return err + } if err := t.loadHooks.Load(sb); err != nil { return err } - if err := t.call(sb, node.PortInit); err != nil { + if err := t.call(sb, node.PortBegin); err != nil { return err } } @@ -294,6 +297,9 @@ func (t *Table) unload(sb *Symbol) error { if err := t.unloadHooks.Unload(sb); err != nil { return err } + if err := t.call(sb, node.PortFinal); err != nil { + return err + } } } return nil