本文整理汇总了Golang中github.com/mesos/mesos-go/mesosproto.TaskStatus类的典型用法代码示例。如果您正苦于以下问题:Golang TaskStatus类的具体用法?Golang TaskStatus怎么用?Golang TaskStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TaskStatus类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: UpdateStatus
func (k *inMemoryRegistry) UpdateStatus(status *mesos.TaskStatus) (*T, StateType) {
taskId := status.GetTaskId().GetValue()
k.rw.Lock()
defer k.rw.Unlock()
task, state := k._get(taskId)
switch status.GetState() {
case mesos.TaskState_TASK_STAGING:
k.handleTaskStaging(task, state, status)
case mesos.TaskState_TASK_STARTING:
k.handleTaskStarting(task, state, status)
case mesos.TaskState_TASK_RUNNING:
k.handleTaskRunning(task, state, status)
case mesos.TaskState_TASK_FINISHED:
k.handleTaskFinished(task, state, status)
case mesos.TaskState_TASK_FAILED:
k.handleTaskFailed(task, state, status)
case mesos.TaskState_TASK_ERROR:
k.handleTaskError(task, state, status)
case mesos.TaskState_TASK_KILLED:
k.handleTaskKilled(task, state, status)
case mesos.TaskState_TASK_LOST:
k.handleTaskLost(task, state, status)
default:
log.Warningf("unhandled status update for task: %v", taskId)
}
return task.Clone(), state
}
开发者ID:40a,项目名称:bootkube,代码行数:29,代码来源:registry.go
示例2: StatusUpdate
func (sched *MesosRunonceScheduler) StatusUpdate(driver sched.SchedulerDriver, status *mesos.TaskStatus) {
log.V(1).Infoln("Status update: task", status.TaskId.GetValue(), " is in state ", status.State.Enum().String())
eventCh <- status
if status.GetState() == mesos.TaskState_TASK_FINISHED {
sched.tasksFinished++
}
if sched.tasksFinished >= sched.totalTasks {
log.V(1).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 {
exitStatus = 1
log.Warningf("mesos TaskStatus: %v", status)
driver.Stop(false)
log.Errorln(
"Aborting because task", status.TaskId.GetValue(),
"is in unexpected state", status.State.String(),
"with message.", status.GetMessage(),
)
}
}
开发者ID:yp-engineering,项目名称:mesos-runonce,代码行数:27,代码来源:main.go
示例3: StatusUpdate
func (sched *testScheduler) StatusUpdate(dr SchedulerDriver, stat *mesos.TaskStatus) {
log.Infoln("Sched.StatusUpdate() called.")
sched.s.NotNil(stat)
sched.s.Equal("test-task-001", stat.GetTaskId().GetValue())
sched.wg.Done()
log.Infof("Status update done with waitGroup")
}
开发者ID:elodina,项目名称:stack-deploy,代码行数:7,代码来源:scheduler_intgr_test.go
示例4: StatusUpdate
func (sched *SdcScheduler) 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++
// KillTaskを実行するとTASK_LOSTが検知され、フレームワークが止まる
// driver.KillTask(status.TaskId)
// log.Infoln("!! Status update: task", status.TaskId.GetValue(), " is in state ", status.State.Enum().String())
// return
}
if sched.tasksFinished >= sched.totalTasks {
// log.Infoln("Total tasks completed, stopping framework.")
log.Infoln("Total tasks completed.")
sched.tasksFinished = 0
sched.totalTasks = 0
sched.tasksLaunched = 0
// 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 {
log.Infoln(
"Aborting because task", status.TaskId.GetValue(),
"is in unexpected state", status.State.String(),
"with message", status.GetMessage(),
)
driver.Abort()
}
}
开发者ID:hirolovesbeer,项目名称:sdc,代码行数:32,代码来源:main.go
示例5: StatusUpdate
func (sched *Scheduler) 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++
log.Infoln("%v of %v tasks finished.", sched.tasksFinished, sched.totalTasks)
}
//TODO if a job is finished, failed, error, lost, killed
// figure out how this impacts dependent jobs and update job graph
/*
//never shut down framework!
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 {
log.Infoln(
"Aborting because task", status.TaskId.GetValue(),
"is in unexpected state", status.State.String(),
"with message", status.GetMessage(),
)
driver.Abort()
}
*/
}
开发者ID:byxorna,项目名称:moroccron,代码行数:32,代码来源:scheduler.go
示例6: 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 RunContainer finished, add
if status.State.Enum().String() == "TASK_FINISHED" {
labels := status.GetLabels()
taskType, err := shared.GetValueFromLabels(labels, shared.Tags.TASK_TYPE)
if err != nil {
log.Infof("ERROR: Malformed task info, discarding task with status: %v", status)
return
}
acceptedHost, err := shared.GetValueFromLabels(labels, shared.Tags.ACCEPTED_HOST)
if err != nil {
log.Infof("ERROR: Malformed task info, discarding task with status: %v", status)
return
}
containerName, err := shared.GetValueFromLabels(labels, shared.Tags.CONTAINER_NAME)
if err != nil {
log.Infof("ERROR: Malformed task info, discarding task with status: %v", status)
return
}
switch taskType {
case shared.TaskTypes.RUN_CONTAINER:
sched.ContainerSlaveMap[containerName] = acceptedHost
break
case shared.TaskTypes.CHECKPOINT_CONTAINER:
delete(sched.ContainerSlaveMap, containerName)
break
case shared.TaskTypes.RESTORE_CONTAINER:
sched.ContainerSlaveMap[containerName] = acceptedHost
break
}
}
}
开发者ID:EMC-CMD,项目名称:test-framework,代码行数:33,代码来源:example_scheduler.go
示例7: StatusUpdate
func (sched *Scheduler) 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++
log.Infoln("%v of %v tasks finished.", sched.tasksFinished, sched.totalTasks)
}
}
开发者ID:spacejam,项目名称:mesos-docker-sched-example,代码行数:8,代码来源:sched.go
示例8: StatusUpdate
// StatusUpdate is called when a status update message is sent to the scheduler.
func (k *KubernetesScheduler) StatusUpdate(driver bindings.SchedulerDriver, taskStatus *mesos.TaskStatus) {
source, reason := "none", "none"
if taskStatus.Source != nil {
source = (*taskStatus.Source).String()
}
if taskStatus.Reason != nil {
reason = (*taskStatus.Reason).String()
}
taskState := taskStatus.GetState()
metrics.StatusUpdates.WithLabelValues(source, reason, taskState.String()).Inc()
log.Infof(
"task status update %q from %q for task %q on slave %q executor %q for reason %q",
taskState.String(),
source,
taskStatus.TaskId.GetValue(),
taskStatus.SlaveId.GetValue(),
taskStatus.ExecutorId.GetValue(),
reason)
switch taskState {
case mesos.TaskState_TASK_RUNNING, mesos.TaskState_TASK_FINISHED, mesos.TaskState_TASK_STARTING, mesos.TaskState_TASK_STAGING:
if _, state := k.taskRegistry.UpdateStatus(taskStatus); state == podtask.StateUnknown {
if taskState != mesos.TaskState_TASK_FINISHED {
//TODO(jdef) what if I receive this after a TASK_LOST or TASK_KILLED?
//I don't want to reincarnate then.. TASK_LOST is a special case because
//the master is stateless and there are scenarios where I may get TASK_LOST
//followed by TASK_RUNNING.
//TODO(jdef) consider running this asynchronously since there are API server
//calls that may be made
k.reconcileNonTerminalTask(driver, taskStatus)
} // else, we don't really care about FINISHED tasks that aren't registered
return
}
if _, exists := k.slaves.getSlave(taskStatus.GetSlaveId().GetValue()); !exists {
// a registered task has an update reported by a slave that we don't recognize.
// this should never happen! So we don't reconcile it.
log.Errorf("Ignore status %+v because the slave does not exist", taskStatus)
return
}
case mesos.TaskState_TASK_FAILED:
if task, _ := k.taskRegistry.UpdateStatus(taskStatus); task != nil {
if task.Has(podtask.Launched) && !task.Has(podtask.Bound) {
go k.plugin.reconcilePod(task.Pod)
return
}
} else {
// unknown task failed, not much we can do about it
return
}
// last-ditch effort to reconcile our records
fallthrough
case mesos.TaskState_TASK_LOST, mesos.TaskState_TASK_KILLED:
k.reconcileTerminalTask(driver, taskStatus)
}
}
开发者ID:hvescovi,项目名称:kubernetes,代码行数:58,代码来源:scheduler.go
示例9: Update
func (r *Reconciler) Update(status *mesos.TaskStatus) {
r.taskLock.Lock()
defer r.taskLock.Unlock()
delete(r.tasks, status.GetTaskId().GetValue())
if len(r.tasks) == 0 {
r.reconciles = 0
}
}
开发者ID:elodina,项目名称:stack-deploy,代码行数:10,代码来源:reconciler.go
示例10: onTaskFailed
func (s *Scheduler) onTaskFailed(id string, status *mesos.TaskStatus) {
if s.cluster.Exists(id) {
task := s.cluster.Get(id)
if task.Data().State != TaskStateInactive {
task.Data().State = TaskStateStopped
}
} else {
Logger.Infof("Got %s for unknown/stopped task %s", pretty.Status(status), status.GetTaskId().GetValue())
}
}
开发者ID:elodina,项目名称:go-kafka-client-mesos,代码行数:10,代码来源:scheduler.go
示例11: StatusUpdate
func (sched *Scheduler) StatusUpdate(driver sched.SchedulerDriver, status *mesos.TaskStatus) {
if glog.V(1) {
glog.Infof("status update from task %s in state %s under executor %s on slave %s: %s",
status.GetTaskId().GetValue(),
status.GetState(),
status.GetExecutorId().GetValue(),
status.GetSlaveId().GetValue(),
status.GetMessage(),
)
}
}
开发者ID:betawaffle,项目名称:elevators,代码行数:11,代码来源:scheduler.go
示例12: StatusUpdate
func (s *Scheduler) StatusUpdate(driver scheduler.SchedulerDriver, status *mesos.TaskStatus) {
Logger.Infof("[StatusUpdate] %s", statusString(status))
slave := s.slaveFromTaskId(status.GetTaskId().GetValue())
if status.GetState() == mesos.TaskState_TASK_FAILED || status.GetState() == mesos.TaskState_TASK_KILLED ||
status.GetState() == mesos.TaskState_TASK_LOST || status.GetState() == mesos.TaskState_TASK_ERROR ||
status.GetState() == mesos.TaskState_TASK_FINISHED {
s.cluster.Remove(slave)
}
}
开发者ID:elodina,项目名称:syscol,代码行数:11,代码来源:scheduler.go
示例13: fillRunningPodInfo
func fillRunningPodInfo(task *T, taskStatus *mesos.TaskStatus) {
if taskStatus.GetReason() == mesos.TaskStatus_REASON_RECONCILIATION && taskStatus.GetSource() == mesos.TaskStatus_SOURCE_MASTER {
// there is no data..
return
}
//TODO(jdef) determine the usefullness of this information (if any)
if result, err := ParsePodStatusResult(taskStatus); err != nil {
log.Errorf("invalid TaskStatus.Data for task '%v': %v", task.ID, err)
} else {
task.podStatus = result.Status
log.Infof("received pod status for task %v: %+v", task.ID, result.Status)
}
}
开发者ID:40a,项目名称:bootkube,代码行数:13,代码来源:registry.go
示例14: StatusUpdate
// StatusUpdate handles status updates messages received from Mesos master
//
// Currently this method only logs status updates. This might change in the future
func (bw *BasicWorker) StatusUpdate(driver scheduler.SchedulerDriver, status *mesos.TaskStatus) {
taskId := status.TaskId.GetValue()
taskStatus := status.GetState()
log.Println("Task", taskId, "is in state", taskStatus.String())
switch taskStatus {
case mesos.TaskState_TASK_RUNNING:
log.Printf("Marking task %s as %s", taskId, taurus.RUNNING)
case mesos.TaskState_TASK_KILLED, mesos.TaskState_TASK_FINISHED,
mesos.TaskState_TASK_FAILED, mesos.TaskState_TASK_LOST:
log.Printf("Marking task %s as %s", taskId, taurus.STOPPED)
}
}
开发者ID:lucmichalski,项目名称:taurus,代码行数:16,代码来源:basicworker.go
示例15: testErrorStatus
func testErrorStatus(t *testing.T, ctx *RunOnceApplicationContext, driver *mesostest.MockSchedulerDriver, status *mesos.TaskStatus) {
appDone := ctx.StatusUpdate(driver, status)
So(appDone, ShouldBeTrue)
select {
case sts := <-ctx.StatusChan:
So(sts.Error, ShouldNotBeNil)
So(sts.Error.Error(), ShouldContainSubstring, "failed to run on host")
default:
t.Fail()
}
So(ctx.tasks[0].State, ShouldEqual, status.GetState())
}
开发者ID:elodina,项目名称:stack-deploy,代码行数:14,代码来源:run_once_test.go
示例16: 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))
}
开发者ID:elodina,项目名称:stack-deploy,代码行数:15,代码来源:scheduler.go
示例17: makeStatusUpdate
func (driver *MesosExecutorDriver) makeStatusUpdate(taskStatus *mesosproto.TaskStatus) *mesosproto.StatusUpdate {
now := float64(time.Now().Unix())
// Fill in all the fields.
taskStatus.Timestamp = proto.Float64(now)
taskStatus.SlaveId = driver.slaveID
update := &mesosproto.StatusUpdate{
FrameworkId: driver.frameworkID,
ExecutorId: driver.executorID,
SlaveId: driver.slaveID,
Status: taskStatus,
Timestamp: proto.Float64(now),
Uuid: uuid.NewUUID(),
}
return update
}
开发者ID:Ima8,项目名称:kubernetes,代码行数:15,代码来源:executor.go
示例18: StatusUpdate
func (r *RunOnceRunner) StatusUpdate(driver scheduler.SchedulerDriver, status *mesos.TaskStatus) bool {
r.applicationLock.Lock()
defer r.applicationLock.Unlock()
applicationID := applicationIDFromTaskID(status.GetTaskId().GetValue())
ctx, exists := r.applications[applicationID]
if !exists {
// this status update was not for run once application, just let it go
return false
}
if ctx.StatusUpdate(driver, status) {
delete(r.applications, applicationID)
}
return true
}
开发者ID:elodina,项目名称:stack-deploy,代码行数:16,代码来源:run_once_runner.go
示例19: handleTaskFinished
func (k *inMemoryRegistry) handleTaskFinished(task *T, state StateType, status *mesos.TaskStatus) {
taskId := status.GetTaskId().GetValue()
switch state {
case StatePending:
panic(fmt.Sprintf("Pending task %v finished, this couldn't happen", taskId))
case StateRunning:
log.V(2).Infof("received finished status for running task: %v", taskId)
delete(k.podToTask, task.podKey)
task.State = StateFinished
task.UpdatedTime = time.Now()
k.tasksFinished = k.recordFinishedTask(task.ID)
case StateFinished:
log.Warningf("Ignore status TASK_FINISHED because the task %v is already finished", taskId)
default:
log.Warningf("Ignore status TASK_FINISHED because the task %v is not running", taskId)
}
}
开发者ID:40a,项目名称:bootkube,代码行数:17,代码来源:registry.go
示例20: handleTaskRunning
func (k *inMemoryRegistry) handleTaskRunning(task *T, state StateType, status *mesos.TaskStatus) {
taskId := status.GetTaskId().GetValue()
switch state {
case StatePending:
task.UpdatedTime = time.Now()
log.Infof("Received running status for pending task: %v", taskId)
fillRunningPodInfo(task, status)
task.State = StateRunning
case StateRunning:
task.UpdatedTime = time.Now()
log.V(2).Infof("Ignore status TASK_RUNNING because the task %v is already running", taskId)
case StateFinished:
log.Warningf("Ignore status TASK_RUNNING because the task %v is already finished", taskId)
default:
log.Warningf("Ignore status TASK_RUNNING because the task %v is discarded", taskId)
}
}
开发者ID:40a,项目名称:bootkube,代码行数:17,代码来源:registry.go
注:本文中的github.com/mesos/mesos-go/mesosproto.TaskStatus类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论