本文整理汇总了Golang中github.com/mesos/mesos-go/executor.ExecutorDriver.Stop方法的典型用法代码示例。如果您正苦于以下问题:Golang ExecutorDriver.Stop方法的具体用法?Golang ExecutorDriver.Stop怎么用?Golang ExecutorDriver.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/mesos/mesos-go/executor.ExecutorDriver
的用法示例。
在下文中一共展示了ExecutorDriver.Stop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: doShutdown
// assumes that caller has obtained state lock
func (k *KubernetesExecutor) doShutdown(driver bindings.ExecutorDriver) {
defer func() {
log.Errorf("exiting with unclean shutdown: %v", recover())
if k.exitFunc != nil {
k.exitFunc(1)
}
}()
(&k.state).transitionTo(terminalState)
// signal to all listeners that this KubeletExecutor is done!
close(k.terminate)
close(k.updateChan)
close(k.nodeInfos)
if k.shutdownAlert != nil {
func() {
util.HandleCrash()
k.shutdownAlert()
}()
}
log.Infoln("Stopping executor driver")
_, err := driver.Stop()
if err != nil {
log.Warningf("failed to stop executor driver: %v", err)
}
log.Infoln("Shutdown the executor")
// according to docs, mesos will generate TASK_LOST updates for us
// if needed, so don't take extra time to do that here.
k.tasks = map[string]*kuberTask{}
select {
// the main Run() func may still be running... wait for it to finish: it will
// clear the pod configuration cleanly, telling k8s "there are no pods" and
// clean up resources (pods, volumes, etc).
case <-k.kubeletFinished:
//TODO(jdef) attempt to wait for events to propagate to API server?
// TODO(jdef) extract constant, should be smaller than whatever the
// slave graceful shutdown timeout period is.
case <-time.After(15 * time.Second):
log.Errorf("timed out waiting for kubelet Run() to die")
}
log.Infoln("exiting")
if k.exitFunc != nil {
k.exitFunc(0)
}
}
示例2: Shutdown
func (exec *ExecutorCore) Shutdown(driver exec.ExecutorDriver) {
fmt.Println("Shutting down the executor")
driver.Stop()
os.Exit(0)
}
示例3: Shutdown
// Shutdown implements the Shutdown handler.
func (self *NebulaExecutor) Shutdown(driver mesos_exec.ExecutorDriver) {
fmt.Println("Shutdown")
driver.Stop()
}