Skip to content

Commit

Permalink
Fix intelsdi-x#768: Return and check error from *schedulerWorkflow.Bi…
Browse files Browse the repository at this point in the history
…ndPluginContentType() method
  • Loading branch information
geauxvirtual authored and IzabellaRaulin committed Mar 29, 2016
1 parent 89e29ab commit 1b11bcd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
12 changes: 9 additions & 3 deletions scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ func (s *scheduler) createTask(sch schedule.Schedule, wfMap *wmap.WorkflowMap, s
return nil, te
}

// Bind plugin content type selections in workflow
err = wf.BindPluginContentTypes(s.metricManager)

// validate plugins and metrics
mts, plugins := s.gatherMetricsAndPlugins(wf)
errs := s.metricManager.ValidateDeps(mts, plugins)
Expand All @@ -212,6 +209,15 @@ func (s *scheduler) createTask(sch schedule.Schedule, wfMap *wmap.WorkflowMap, s
return nil, te
}

// Bind plugin content type selections in workflow
err = wf.BindPluginContentTypes(s.metricManager)
if err != nil {
te.errs = append(te.errs, serror.New(err))
f := buildErrorsLog(te.Errors(), logger)
f.Error("unable to bind plugin content types")
return nil, te
}

// Create the task object
task := newTask(sch, wf, s.workManager, s.metricManager, s.eventManager, opts...)

Expand Down
7 changes: 4 additions & 3 deletions scheduler/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ type wfContentTypes map[string]map[string][]string

// BindPluginContentTypes
func (s *schedulerWorkflow) BindPluginContentTypes(mm managesPluginContentTypes) error {
bindPluginContentTypes(s.publishNodes, s.processNodes, mm, []string{plugin.SnapGOBContentType})
return nil
return bindPluginContentTypes(s.publishNodes, s.processNodes, mm, []string{plugin.SnapGOBContentType})
}

func bindPluginContentTypes(pus []*publishNode, prs []*processNode, mm managesPluginContentTypes, lct []string) error {
Expand Down Expand Up @@ -271,7 +270,9 @@ func bindPluginContentTypes(pus []*publishNode, prs []*processNode, mm managesPl
}
}
//continue the walk down the nodes
bindPluginContentTypes(pr.PublishNodes, pr.ProcessNodes, mm, rct)
if err := bindPluginContentTypes(pr.PublishNodes, pr.ProcessNodes, mm, rct); err != nil {
return err
}
}
for _, pu := range pus {
act, _, err := mm.GetPluginContentTypes(pu.Name(), core.PublisherPluginType, pu.Version())
Expand Down

0 comments on commit 1b11bcd

Please sign in to comment.