Example #1
0
func (c *Coordinator) createWriteWork() {
	log.Printf("creating work for write %s", c.config.NodeId)
	data := make(map[string]interface{})
	data[c.clusterName] = c.config.NodeId
	data[WorkField] = WriteWork
	donut.CreateWork(c.clusterName, c.zk, c.donutConfig, "write-"+c.config.NodeId, data)
}
Example #2
0
func (c *Coordinator) createStepWork(step int) {
	log.Printf("creating work for superstep %d", step)
	data := make(map[string]interface{})
	data[c.clusterName] = c.config.NodeId
	data[WorkField] = SuperstepWork
	data["step"] = step
	donut.CreateWork(c.clusterName, c.zk, c.donutConfig, "superstep-"+strconv.Itoa(step)+"-"+c.config.NodeId, data)
}
Example #3
0
func (c *Coordinator) createLoadWork() {
	log.Println("creating load work")
	data := make(map[string]interface{})
	data[WorkField] = LoadWork
	paths := c.graph.job.LoadPaths()
	// create the load barrier here since a node might not end up with load work
	c.createBarrier("load", func(m *donut.SafeMap) {
		c.onLoadBarrierChange(m)
	})
	for _, p := range paths {
		data["path"] = p
		workName := "load-" + p
		if err := donut.CreateWork(c.clusterName, c.zk, c.donutConfig, workName, data); err != nil {
			// XXX should check to make sure its a "node already exists error"
			log.Printf("Could not create load work for %s: %v", p, err)
		}
	}
}