Пример #1
0
func NewCPMd(port int, mgr *metamgr.MetadataManager) *CEPM {
	c := setupCPMd(port)

	var err error
	c.mgr = mgr
	mgr.GetRootNode().CreateChildIfNotExists("cepmd")
	c.cepmdNode, err = mgr.GetRootNode().GetChild("cepmd")
	if err != nil {
		log.Panic("Could not get cepmd child")
	}

	return c
}
Пример #2
0
func GetSchedulerState(mm *metadata_manager.MetadataManager) *SchedulerState {
	var zkNode *metadata_manager.ZkNode
	var err error
	zkNode, err = mm.GetRootNode().GetChild("SchedulerState")
	if err == zk.ErrNoNode {
		ess := emptySchedulerState()
		zkNode, err = mm.GetRootNode().MakeChildWithData("SchedulerState", ess.serialize(), false)
		if err != nil {
			log.Panic(err)
		}
		ess.zkNode = zkNode
		return ess
	} else {
		ss, err := DeserializeSchedulerState(zkNode.GetData())
		if err != nil {
			log.Panic(err)
		}
		ss.zkNode = zkNode
		return ss
	}
}