func (s *Supervisor) RunIt(job *scheduler.Job) error { var err error //log.Println(spew.Sdump(job)) for !job.Failed() { err = job.Run() if err == nil { return nil } } return ErrExhaustedRetries }
// Make a job offer in: (k,v) -> ($JOB_OFFERS/$job_id , job) func (e *EtcdProxy) MakeJobOffer(job *scheduler.Job) error { key := fmt.Sprintf("%s/%s", JOB_OFFER_KEY, job.Id) jobEncoded, _ := job.EncodeToString() _, err := e.etcdClient.Set(key, jobEncoded, NO_TTL) return err }
func (e *EtcdProxy) RegisterJob(job *scheduler.Job) error { jobEncoded, _ := job.EncodeToString() _, err := e.etcdClient.Set(fmt.Sprintf("%s/%s", JOB_REGISTRATION_KEY, job.Id), jobEncoded, NO_TTL) return err }