diff --git a/wrappers/mockingjay/graph/mockingjay.go b/wrappers/mockingjay/graph/mockingjay.go index 084854c..e1633be 100644 --- a/wrappers/mockingjay/graph/mockingjay.go +++ b/wrappers/mockingjay/graph/mockingjay.go @@ -42,6 +42,9 @@ func (g *Mockingjay) Run(ctx context.Context, a int, b int) (sum int) { // __output_sum_builder outputs var __output_sum_builder_sum int + // __print_values outputs + var __print_values_aggregated []interface{} + // add outputs var add_sum int @@ -49,6 +52,8 @@ func (g *Mockingjay) Run(ctx context.Context, a int, b int) (sum int) { var inputs_a int var inputs_b int + // print outputs + igniteNodeID := "ignite" doneNodeID := "done" @@ -106,6 +111,18 @@ func (g *Mockingjay) Run(ctx context.Context, a int, b int) (sum int) { }, alreadyDone: false, }, + "__print_values": { + deps: map[string]struct{}{ + "add": {}, + igniteNodeID: {}, + }, + run: func() { + __print_values_aggregated = append(__print_values_aggregated, "sum") + __print_values_aggregated = append(__print_values_aggregated, add_sum) + done <- "__print_values" + }, + alreadyDone: false, + }, "add": { deps: map[string]struct{}{ "__ctx": {}, @@ -159,6 +176,32 @@ func (g *Mockingjay) Run(ctx context.Context, a int, b int) (sum int) { }, alreadyDone: false, }, + "print": { + deps: map[string]struct{}{ + "__ctx": {}, + "__print_values": {}, + igniteNodeID: {}, + }, + run: func() { + + var _mock []interface{} + if _mocks, ok := ctx.Value(mockingjay.ContextKey).(map[string][]interface{}); ok && _mocks != nil { + m, ok := _mocks["print"] + if ok { + _mock = m + } + } + + if _mock != nil { + + } else { + nodes.PrinterCtx(__ctx_ctx, __print_values_aggregated) + } + + done <- "print" + }, + alreadyDone: false, + }, igniteNodeID: { deps: map[string]struct{}{}, run: func() { @@ -172,8 +215,10 @@ func (g *Mockingjay) Run(ctx context.Context, a int, b int) (sum int) { "__add_b": {}, "__ctx": {}, "__output_sum_builder": {}, + "__print_values": {}, "add": {}, "inputs": {}, + "print": {}, }, run: func() { done <- doneNodeID diff --git a/wrappers/mockingjay/mockingjay.yml b/wrappers/mockingjay/mockingjay.yml index e765583..b8ad588 100644 --- a/wrappers/mockingjay/mockingjay.yml +++ b/wrappers/mockingjay/mockingjay.yml @@ -11,5 +11,12 @@ nodes: a: inputs.a b: inputs.b + - id: print + type: nodes.PrinterCtx + bind: + values: + - '"sum"' + - add.sum + outputs: sum: add.sum