Move task-lost message prefix into messages module

This commit is contained in:
Dr. Stefan Schimanski 2015-09-15 13:27:45 +02:00
parent 832370ed4f
commit 132f8892ed
3 changed files with 4 additions and 3 deletions

View File

@ -758,8 +758,8 @@ func (k *KubernetesExecutor) FrameworkMessage(driver bindings.ExecutorDriver, me
log.Infof("Receives message from framework %v\n", message) log.Infof("Receives message from framework %v\n", message)
//TODO(jdef) master reported a lost task, reconcile this! @see scheduler.go:handleTaskLost //TODO(jdef) master reported a lost task, reconcile this! @see scheduler.go:handleTaskLost
if strings.HasPrefix(message, "task-lost:") && len(message) > 10 { if strings.HasPrefix(message, messages.TaskLost+":") {
taskId := message[10:] taskId := message[len(messages.TaskLost)+1:]
if taskId != "" { if taskId != "" {
// clean up pod state // clean up pod state
k.lock.Lock() k.lock.Lock()

View File

@ -26,6 +26,7 @@ const (
ExecutorShutdown = "executor-shutdown" ExecutorShutdown = "executor-shutdown"
LaunchTaskFailed = "launch-task-failed" LaunchTaskFailed = "launch-task-failed"
TaskKilled = "task-killed" TaskKilled = "task-killed"
TaskLost = "task-lost"
UnmarshalTaskDataFailure = "unmarshal-task-data-failure" UnmarshalTaskDataFailure = "unmarshal-task-data-failure"
TaskLostAck = "task-lost-ack" // executor acknowledgement of forwarded TASK_LOST framework message TaskLostAck = "task-lost-ack" // executor acknowledgement of forwarded TASK_LOST framework message
Kamikaze = "kamikaze" Kamikaze = "kamikaze"

View File

@ -441,7 +441,7 @@ func (k *KubernetesScheduler) reconcileTerminalTask(driver bindings.SchedulerDri
//to do anything. The underlying driver transport may be able to send a //to do anything. The underlying driver transport may be able to send a
//FrameworkMessage directly to the slave to terminate the task. //FrameworkMessage directly to the slave to terminate the task.
log.V(2).Info("forwarding TASK_LOST message to executor %v on slave %v", taskStatus.ExecutorId, taskStatus.SlaveId) log.V(2).Info("forwarding TASK_LOST message to executor %v on slave %v", taskStatus.ExecutorId, taskStatus.SlaveId)
data := fmt.Sprintf("task-lost:%s", task.ID) //TODO(jdef) use a real message type data := fmt.Sprintf("%s:%s", messages.TaskLost, task.ID) //TODO(jdef) use a real message type
if _, err := driver.SendFrameworkMessage(taskStatus.ExecutorId, taskStatus.SlaveId, data); err != nil { if _, err := driver.SendFrameworkMessage(taskStatus.ExecutorId, taskStatus.SlaveId, data); err != nil {
log.Error(err.Error()) log.Error(err.Error())
} }