Run runs the dag. Vertexes with no dependency will be scheduled concurrently while the inked vertexes will be scheduled sequentially. The Scheduler optimizes the execution path so that the overall dag execution time is minimized. If a vertex returns an error or if the dag context is canceled, the s
(ctx context.Context)
| 97 | // dag caller) is to store the results in context with the help of package |
| 98 | // ctxmeta. See example. |
| 99 | func (d *DAG) Run(ctx context.Context) error { |
| 100 | errGroup, ctx := errgroup.WithContext(ctx) |
| 101 | for _, v := range d.vertexes { |
| 102 | v := v |
| 103 | if len(v.parents) == 0 { |
| 104 | errGroup.Go(func() error { |
| 105 | return v.execute(ctx) |
| 106 | }) |
| 107 | } |
| 108 | } |
| 109 | return errGroup.Wait() |
| 110 | } |
| 111 | |
| 112 | func (d *DAG) fmtEdges(edges []int) interface{} { |
| 113 | var s []string |