Ejemplo n.º 1
0
func (self *manager) announceFramework() {
	message := &mesosproto.RegisterFrameworkMessage{
		Framework: self.frameworkInfo,
	}

	glog.Infof("Registering with master %s [%s] ", self.masterUPID, message)
	messagePackage := communication.NewMessage(self.masterUPID, message, nil)
	if err := communication.SendMessageToMesos(self.selfUPID, messagePackage); err != nil {
		glog.Errorf("Failed to send RegisterFramework message: %v\n", err)
	}

}
Ejemplo n.º 2
0
func (self *manager) HandleDeleteTask(task *managerInterface.Task) {
	message := &mesosproto.KillTaskMessage{
		FrameworkId: &mesosproto.FrameworkID{Value: &self.frameworkId},
		TaskId:      &mesosproto.TaskID{Value: &task.InternalID},
	}

	glog.Infof("Delete Task [%s] ", message)
	messagePackage := communication.NewMessage(self.masterUPID, message, nil)
	if err := communication.SendMessageToMesos(self.selfUPID, messagePackage); err != nil {
		glog.Errorf("Failed to send KillTaskMessage message: %v\n", err)
	}

}
Ejemplo n.º 3
0
func (self *manager) acknowledgeStatusUpdate(statusUpdate *mesosproto.StatusUpdateMessage) {
	message := &mesosproto.StatusUpdateAcknowledgementMessage{
		FrameworkId: statusUpdate.GetUpdate().FrameworkId,
		SlaveId:     statusUpdate.GetUpdate().Status.SlaveId,
		TaskId:      statusUpdate.GetUpdate().Status.TaskId,
		Uuid:        statusUpdate.GetUpdate().Uuid,
	}

	messagePackage := communication.NewMessage(self.masterUPID, message, nil)
	if err := communication.SendMessageToMesos(self.selfUPID, messagePackage); err != nil {
		glog.Errorf("Failed to send StatusAccept message: %v\n", err)
	}

}
Ejemplo n.º 4
0
func (self *manager) DeclineOffer(offerId *mesosproto.OfferID) {
	message := &mesosproto.LaunchTasksMessage{
		FrameworkId: &mesosproto.FrameworkID{Value: &self.frameworkId},
		OfferIds:    []*mesosproto.OfferID{offerId},
		Tasks:       []*mesosproto.TaskInfo{},
		Filters:     &mesosproto.Filters{},
	}

	messagePackage := communication.NewMessage(self.masterUPID, message, nil)
	if err := communication.SendMessageToMesos(self.selfUPID, messagePackage); err != nil {
		glog.Errorf("Failed to send DeclineOffer message: %v\n", err)
	}

}
Ejemplo n.º 5
0
func (self *manager) AcceptOffer(offerId *mesosproto.OfferID, slaveId *mesosproto.SlaveID, taskRequest *managerInterface.Task) {
	glog.Infoln("Working on: ", taskRequest.TaskInfo)
	taskRequest.TaskInfo.SlaveId = slaveId
	message := &mesosproto.LaunchTasksMessage{
		FrameworkId: &mesosproto.FrameworkID{Value: &self.frameworkId},
		OfferIds:    []*mesosproto.OfferID{offerId},
		Tasks:       []*mesosproto.TaskInfo{taskRequest.TaskInfo},
		Filters:     &mesosproto.Filters{},
	}

	messagePackage := communication.NewMessage(self.masterUPID, message, nil)
	if err := communication.SendMessageToMesos(self.selfUPID, messagePackage); err != nil {
		glog.Errorf("Failed to send AcceptOffer message: %v\n", err)
	} else {
		taskRequest.RequestSent = true
	}

}