Пример #1
0
func (self *Master) importCoordChannels() {
	self.coordSendChannels = make(map[string]coordrunner.CoordComm, len(self.conf.Coordinators))
	self.coordRecvChannels = make(map[string]coordrunner.CoordComm, len(self.conf.Coordinators))
	for address, _ := range self.conf.Coordinators {
		ch_send := make(coordrunner.CoordComm)
		ch_recv := make(coordrunner.CoordComm)

		self.log.Print("Importing coord master_req from ", address)

		imp := util.MakeImporterWithRetry("tcp", address, 10, self.log)

		err := imp.Import("master_req", ch_send, netchan.Send, 1)
		if err != nil {
			self.log.Fatal(err)
		}

		self.log.Print("Importing coord master_rsp")

		err = imp.Import("master_rsp", ch_recv, netchan.Recv, 1)
		if err != nil {
			self.log.Fatal(err)
		}

		self.coordSendChannels[address] = ch_send
		self.coordRecvChannels[address] = ch_recv
	}
}
Пример #2
0
func (self *Master) importAgentChannels() {
	self.agentSendChannels = make(map[string]agent.AgentComm, len(self.conf.Agents))
	self.agentRecvChannels = make(map[string]agent.AgentComm, len(self.conf.Agents))
	self.log.Print(self.conf.Agents)
	for address, _ := range self.conf.Agents {
		ch_send := make(agent.AgentComm)
		ch_recv := make(agent.AgentComm)

		self.log.Print("Importing agent master_req from ", address)

		imp := util.MakeImporterWithRetry("tcp", address, 10, self.log)

		err := imp.Import("master_req", ch_send, netchan.Send, 1)
		if err != nil {
			self.log.Fatal(err)
		}

		self.log.Print("Importing agent master_rsp")

		err = imp.Import("master_rsp", ch_recv, netchan.Recv, 1)
		if err != nil {
			self.log.Fatal(err)
		}

		self.agentSendChannels[address] = ch_send
		self.agentRecvChannels[address] = ch_recv
	}
}