示例#1
0
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
}
示例#2
0
文件: etcd.go 项目: kapalhq/mozo
// 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
}
示例#3
0
文件: etcd.go 项目: kapalhq/mozo
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
}