本文整理匯總了Golang中github.com/mesos/mesos-go/scheduler.SchedulerDriver.ReviveOffers方法的典型用法代碼示例。如果您正苦於以下問題:Golang SchedulerDriver.ReviveOffers方法的具體用法?Golang SchedulerDriver.ReviveOffers怎麽用?Golang SchedulerDriver.ReviveOffers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/mesos/mesos-go/scheduler.SchedulerDriver
的用法示例。
在下文中一共展示了SchedulerDriver.ReviveOffers方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: StatusUpdate
func (s *StackDeployScheduler) StatusUpdate(driver scheduler.SchedulerDriver, status *mesos.TaskStatus) {
Logger.Info("[StatusUpdate] %s", pretty.Status(status))
if status.GetState() == mesos.TaskState_TASK_FINISHED {
driver.ReviveOffers()
}
for _, runner := range MesosTaskRunners {
if runner.StatusUpdate(driver, status) {
return
}
}
Logger.Warn("Received status update that was not handled by any Mesos Task Runner: %s", pretty.Status(status))
}
示例2: StatusUpdate
func (sched *ExampleScheduler) StatusUpdate(driver sched.SchedulerDriver, status *mesos.TaskStatus) {
log.Infoln("Status update: task", status.TaskId.GetValue(), " is in state ", status.State.Enum().String())
if status.GetState() == mesos.TaskState_TASK_FINISHED {
sched.tasksFinished++
driver.ReviveOffers() // TODO(jdef) rate-limit this
}
if sched.tasksFinished >= sched.totalTasks {
log.Infoln("Total tasks completed, stopping framework.")
driver.Stop(false)
}
if status.GetState() == mesos.TaskState_TASK_LOST ||
status.GetState() == mesos.TaskState_TASK_KILLED ||
status.GetState() == mesos.TaskState_TASK_FAILED ||
status.GetState() == mesos.TaskState_TASK_ERROR {
sched.tasksErrored++
}
}