本文整理汇总了Golang中k8s/io/kubernetes/contrib/mesos/pkg/proc.Action函数的典型用法代码示例。如果您正苦于以下问题:Golang Action函数的具体用法?Golang Action怎么用?Golang Action使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Action函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Do
// execute some action in the deferred context of the process, but only if we
// match the stage of the process at the time the action is executed.
func (stage stageType) Do(p *SchedulerProcess, a proc.Action) <-chan error {
errOnce := proc.NewErrorOnce(p.fin)
errOuter := p.Do(proc.Action(func() {
switch stage {
case standbyStage:
//await standby signal or death
select {
case <-p.standby:
case <-p.Done():
}
case masterStage:
//await elected signal or death
select {
case <-p.elected:
case <-p.Done():
}
case finStage:
errOnce.Reportf("scheduler process is dying, dropping action")
return
default:
}
errOnce.Report(stage.When(p, a))
}))
return errOnce.Send(errOuter).Err()
}
示例2: Elect
func (self *SchedulerProcess) Elect(newDriver DriverFactory) {
errOnce := proc.NewErrorOnce(self.fin)
proc.OnError(errOnce.Send(standbyStage.Do(self, proc.Action(func() {
if !(&self.stage).transition(standbyStage, masterStage) {
log.Errorf("failed to transition from standby to master stage, aborting")
self.End()
return
}
log.Infoln("scheduler process entered master stage")
drv, err := newDriver()
if err != nil {
log.Errorf("failed to fetch scheduler driver: %v", err)
self.End()
return
}
log.V(1).Infoln("starting driver...")
stat, err := drv.Start()
if stat == mesos.Status_DRIVER_RUNNING && err == nil {
log.Infoln("driver started successfully and is running")
close(self.elected)
go func() {
defer self.End()
_, err := drv.Join()
if err != nil {
log.Errorf("driver failed with error: %v", err)
}
errOnce.Report(err)
}()
return
}
defer self.End()
if err != nil {
log.Errorf("failed to start scheduler driver: %v", err)
} else {
log.Errorf("expected RUNNING status, not %v", stat)
}
}))).Err(), func(err error) {
defer self.End()
log.Errorf("failed to handle election event, aborting: %v", err)
}, self.fin)
}
示例3: ExecutorLost
func (self *SchedulerProcess) ExecutorLost(drv bindings.SchedulerDriver, eid *mesos.ExecutorID, sid *mesos.SlaveID, x int) {
self.logError(self.Master().Do(proc.Action(func() {
self.Scheduler.ExecutorLost(drv, eid, sid, x)
})))
}
示例4: SlaveLost
func (self *SchedulerProcess) SlaveLost(drv bindings.SchedulerDriver, sid *mesos.SlaveID) {
self.logError(self.Master().Do(proc.Action(func() {
self.Scheduler.SlaveLost(drv, sid)
})))
}
示例5: FrameworkMessage
func (self *SchedulerProcess) FrameworkMessage(drv bindings.SchedulerDriver, eid *mesos.ExecutorID, sid *mesos.SlaveID, m string) {
self.logError(self.Master().Do(proc.Action(func() {
self.Scheduler.FrameworkMessage(drv, eid, sid, m)
})))
}
示例6: StatusUpdate
func (self *SchedulerProcess) StatusUpdate(drv bindings.SchedulerDriver, ts *mesos.TaskStatus) {
self.logError(self.Master().Do(proc.Action(func() {
self.Scheduler.StatusUpdate(drv, ts)
})))
}
示例7: OfferRescinded
func (self *SchedulerProcess) OfferRescinded(drv bindings.SchedulerDriver, oid *mesos.OfferID) {
self.logError(self.Master().Do(proc.Action(func() {
self.Scheduler.OfferRescinded(drv, oid)
})))
}
示例8: ResourceOffers
func (self *SchedulerProcess) ResourceOffers(drv bindings.SchedulerDriver, off []*mesos.Offer) {
self.logError(self.Master().Do(proc.Action(func() {
self.Scheduler.ResourceOffers(drv, off)
})))
}
示例9: Disconnected
func (self *SchedulerProcess) Disconnected(drv bindings.SchedulerDriver) {
self.logError(self.Master().Do(proc.Action(func() {
self.Scheduler.Disconnected(drv)
})))
}
示例10: Reregistered
func (self *SchedulerProcess) Reregistered(drv bindings.SchedulerDriver, mi *mesos.MasterInfo) {
self.logError(self.Master().Do(proc.Action(func() {
self.Scheduler.Reregistered(drv, mi)
})))
}