当前位置: 首页>>代码示例>>Golang>>正文


Golang ExecutorDriver.Stop方法代码示例

本文整理汇总了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)
	}
}
开发者ID:pologood,项目名称:kubernetes,代码行数:53,代码来源:executor.go

示例2: Shutdown

func (exec *ExecutorCore) Shutdown(driver exec.ExecutorDriver) {
	fmt.Println("Shutting down the executor")
	driver.Stop()
	os.Exit(0)
}
开发者ID:glickbot,项目名称:riak-mesos,代码行数:5,代码来源:executor.go

示例3: Shutdown

// Shutdown implements the Shutdown handler.
func (self *NebulaExecutor) Shutdown(driver mesos_exec.ExecutorDriver) {
	fmt.Println("Shutdown")
	driver.Stop()
}
开发者ID:kellrott,项目名称:agro,代码行数:5,代码来源:executor.go


注:本文中的github.com/mesos/mesos-go/executor.ExecutorDriver.Stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。