github.com/justinjmoses/evergreen@v0.0.0-20170530173719-1d50e381ff0d/notify/runner.go (about) 1 package notify 2 3 import ( 4 "time" 5 6 "github.com/evergreen-ci/evergreen" 7 "github.com/evergreen-ci/evergreen/model" 8 "github.com/mongodb/grip" 9 "github.com/pkg/errors" 10 ) 11 12 type Runner struct{} 13 14 const ( 15 RunnerName = "notify" 16 Description = "send notifications for failed tasks and system issues" 17 ) 18 19 func (r *Runner) Name() string { 20 return RunnerName 21 } 22 23 func (r *Runner) Description() string { 24 return Description 25 } 26 27 func (r *Runner) Run(config *evergreen.Settings) error { 28 startTime := time.Now() 29 grip.Infof("Starting notifications at %s time", startTime) 30 31 if err := Run(config); err != nil { 32 err = errors.Wrap(err, "error running notify") 33 grip.Error(err) 34 return err 35 } 36 37 runtime := time.Since(startTime) 38 if err := model.SetProcessRuntimeCompleted(RunnerName, runtime); err != nil { 39 grip.Errorln("error updating process status:", err.Error()) 40 } 41 grip.Infof("Notify took %s to run", runtime) 42 return nil 43 }