WalkChildren walk dag of plan tasks creating execution tasks
(p plan.Task, root Task)
| 336 | |
| 337 | // WalkChildren walk dag of plan tasks creating execution tasks |
| 338 | func (m *JobExecutor) WalkChildren(p plan.Task, root Task) error { |
| 339 | for _, t := range p.Children() { |
| 340 | //u.Debugf("parent: %T walk child %p %T %#v", p, t, t, p.Children()) |
| 341 | et, err := m.WalkPlanTask(t) |
| 342 | if err != nil { |
| 343 | u.Errorf("could not create task %#v err=%v", t, err) |
| 344 | } |
| 345 | if len(t.Children()) == 0 { |
| 346 | err = root.Add(et) |
| 347 | if err != nil { |
| 348 | return err |
| 349 | } |
| 350 | } else { |
| 351 | childRoot := m.Executor.NewTask(t) |
| 352 | err = root.Add(childRoot) |
| 353 | if err != nil { |
| 354 | return err |
| 355 | } |
| 356 | err = childRoot.Add(et) |
| 357 | if err != nil { |
| 358 | return err |
| 359 | } |
| 360 | for _, c := range t.Children() { |
| 361 | ct, err := m.WalkPlanTask(c) |
| 362 | if err != nil { |
| 363 | u.Errorf("could not create child task %#v err=%v", c, err) |
| 364 | return err |
| 365 | } |
| 366 | if err = childRoot.Add(ct); err != nil { |
| 367 | u.Errorf("Could not add task %v", err) |
| 368 | return err |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | } |
| 373 | return nil |
| 374 | } |
| 375 | |
| 376 | // Setup this dag of tasks |
| 377 | func (m *JobExecutor) Setup() error { |
no test coverage detected