Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
fix #479 - Plugins can remain running after a task fails to start
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzej-k committed Dec 7, 2015
1 parent e104776 commit cbe7e21
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,15 @@ func (s *scheduler) startTask(id, source string) []serror.SnapError {

mts, plugins := s.gatherMetricsAndPlugins(t.workflow)
cps := returnCorePlugin(plugins)
errs := s.metricManager.SubscribeDeps(t.ID(), mts, cps)
if len(errs) > 0 {
sub_errs := s.metricManager.SubscribeDeps(t.ID(), mts, cps)
if len(sub_errs) > 0 {
// Tear down plugin processes started so far.
unsub_errs := s.metricManager.UnsubscribeDeps(t.ID(), mts, cps)
errs := append(sub_errs, unsub_errs...)
logger.WithFields(log.Fields{
"task-id": t.ID(),
"_error": errs,
}).Error("task failed to start due to dependencies")
return errs
}

Expand Down

0 comments on commit cbe7e21

Please sign in to comment.