本文整理汇总了Golang中github.com/mesos/mesos-go/executor.NewMesosExecutorDriver函数的典型用法代码示例。如果您正苦于以下问题:Golang NewMesosExecutorDriver函数的具体用法?Golang NewMesosExecutorDriver怎么用?Golang NewMesosExecutorDriver使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewMesosExecutorDriver函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
runtime.GOMAXPROCS(1)
log.SetLevel(log.DebugLevel)
fmt.Println("Starting Riak Executor")
signals := make(chan os.Signal, 1)
signal.Notify(signals, syscall.SIGUSR1, syscall.SIGUSR2)
executor := newExecutor()
dconfig := exec.DriverConfig{
Executor: executor,
}
driver, err := exec.NewMesosExecutorDriver(dconfig)
if err != nil {
fmt.Println("Unable to create a ExecutorDriver ", err.Error())
}
_, err = driver.Start()
if err != nil {
fmt.Println("Got error:", err)
return
}
go signalWatcher(signals, executor)
executor.Driver = driver
fmt.Println("Executor process has started and running.")
driver.Join()
}
示例2: main
func main() {
launchTimeout :=
flag.Uint("launch-timeout", 240,
"Seconds to retry launching an etcd instance for before giving up. "+
"This should be long enough for a port occupied by a killed process "+
"to be vacated.")
flag.Parse()
log.Infoln("Starting etcd Executor")
dconfig := executor.DriverConfig{
Executor: etcdexecutor.New(
time.Duration(*launchTimeout) * time.Second,
),
}
driver, err := executor.NewMesosExecutorDriver(dconfig)
if err != nil {
log.Infoln("Unable to create an ExecutorDriver ", err.Error())
}
_, err = driver.Start()
if err != nil {
log.Infoln("Got error:", err)
return
}
log.Infoln("Executor process has started and running.")
driver.Join()
}
示例3: main
func main() {
flag.Parse()
err := syscol.InitLogging(*logLevel)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
driverConfig := executor.DriverConfig{
Executor: new(syscol.Executor),
}
driver, err := executor.NewMesosExecutorDriver(driverConfig)
if err != nil {
syscol.Logger.Error(err)
os.Exit(1)
}
_, err = driver.Start()
if err != nil {
syscol.Logger.Error(err)
os.Exit(1)
}
driver.Join()
}
示例4: main
func main() {
flag.Parse()
err := statsd.InitLogging(*logLevel)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
driverConfig := executor.DriverConfig{
Executor: &statsd.Executor{Host: *host},
}
driver, err := executor.NewMesosExecutorDriver(driverConfig)
if err != nil {
statsd.Logger.Error(err)
os.Exit(1)
}
_, err = driver.Start()
if err != nil {
statsd.Logger.Error(err)
os.Exit(1)
}
driver.Join()
}
示例5: main
func main() {
fmt.Println(os.Args)
fmt.Println("Parsing")
flag.Parse()
fmt.Println("Init")
exec := NewNebulaExecutor()
config := mesos_exec.DriverConfig{
Executor: exec,
}
fmt.Println("Create")
driver, err := mesos_exec.NewMesosExecutorDriver(config)
if err != nil {
fmt.Println("Unable to create a ExecutorDriver ", err.Error())
}
_, err = driver.Start()
if err != nil {
fmt.Println("Got error:", err)
return
}
fmt.Println("Executor process has started and running.")
_, err = driver.Join()
if err != nil {
fmt.Println("driver failed:", err)
}
fmt.Println("executor terminating")
}
示例6: ghsNodeMain
func ghsNodeMain() {
fmt.Println("Starting GHSVIS Executor")
dconfig := exec.DriverConfig{
Executor: newVISGHSExecutor(),
}
driver, err := exec.NewMesosExecutorDriver(dconfig)
if err != nil {
fmt.Println("Unable to create a ExecutorDriver ", err.Error())
}
_, err = driver.Start()
if err != nil {
fmt.Println("Got error:", err)
return
}
fmt.Println("Executor process has started and running.")
_, err = driver.Join()
if err != nil {
fmt.Println("driver failed:", err)
}
fmt.Println("executor terminating")
}
示例7: start
func start(c *cli.Context) {
workDir := c.String("work_dir")
if workDir == "" {
log.Fatal("work_dir is not specified")
}
err := utils.PerformPreChecksAndPrepareHost(workDir)
if err != nil {
log.WithFields(log.Fields{
"err": err,
}).Fatal("Environment error, cannot run rancher-mesos-executor")
}
log.Info("Setup of env complete. Starting executor driver")
driver, err := executor.NewMesosExecutorDriver(
executor.DriverConfig{
Executor: rancher_mesos.NewRancherExecutor(
filepath.Join(workDir, "rancheros.iso"),
c.String("bridge_iface"),
c.String("bridge_cidr"),
filepath.Join(workDir, "base-img.img")),
},
)
if err != nil {
log.WithFields(log.Fields{
"err": err,
}).Fatal("Error starting executor")
}
_, err = driver.Run()
if err != nil {
log.WithFields(log.Fields{
"err": err,
}).Fatal("Error starting executor")
}
}
示例8: runExecutor
func (s *KubeletExecutorServer) runExecutor(
nodeInfos chan<- executor.NodeInfo,
kubeletFinished <-chan struct{},
staticPodsConfigPath string,
apiclient *clientset.Clientset,
registry executor.Registry,
) (<-chan struct{}, error) {
staticPodFilters := podutil.Filters{
// annotate the pod with BindingHostKey so that the scheduler will ignore the pod
// once it appears in the pod registry. the stock kubelet sets the pod host in order
// to accomplish the same; we do this because the k8sm scheduler works differently.
podutil.Annotator(map[string]string{
meta.BindingHostKey: s.HostnameOverride,
}),
}
if s.containerID != "" {
// tag all pod containers with the containerID so that they can be properly GC'd by Mesos
staticPodFilters = append(staticPodFilters, podutil.Environment([]api.EnvVar{
{Name: envContainerID, Value: s.containerID},
}))
}
exec := executor.New(executor.Config{
Registry: registry,
APIClient: apiclient,
Docker: dockertools.ConnectToDockerOrDie(s.DockerEndpoint),
SuicideTimeout: s.SuicideTimeout,
KubeletFinished: kubeletFinished,
ExitFunc: os.Exit,
NodeInfos: nodeInfos,
Options: []executor.Option{
executor.StaticPods(staticPodsConfigPath, staticPodFilters),
},
})
// initialize driver and initialize the executor with it
dconfig := bindings.DriverConfig{
Executor: exec,
HostnameOverride: s.HostnameOverride,
BindingAddress: net.ParseIP(s.Address),
}
driver, err := bindings.NewMesosExecutorDriver(dconfig)
if err != nil {
return nil, fmt.Errorf("failed to create executor driver: %v", err)
}
log.V(2).Infof("Initialize executor driver...")
exec.Init(driver)
// start the driver
go func() {
if _, err := driver.Run(); err != nil {
log.Fatalf("executor driver failed: %v", err)
}
log.Info("executor Run completed")
}()
return exec.Done(), nil
}
示例9: runExecutor
func runExecutor(app *stockpile.App) {
taskExecutor := stockpile.NewExecutor(app)
driverConfig := executor.DriverConfig{
Executor: taskExecutor,
}
driver, err := executor.NewMesosExecutorDriver(driverConfig)
if err != nil {
stockpile.Logger.Error(err)
panic(err)
}
_, err = driver.Start()
if err != nil {
stockpile.Logger.Error(err)
panic(err)
}
driver.Run()
}
示例10: main
func main() {
fmt.Println("Starting Task Runner (APT-MESOS)")
driverConfig := executor.DriverConfig{
Executor: NewTaskRunner(),
}
driver, err := executor.NewMesosExecutorDriver(driverConfig)
if err != nil {
fmt.Println("Unable to create a ExecutorDriver ", err.Error())
}
_, err = driver.Start()
if err != nil {
fmt.Println("Got error:", err)
return
}
fmt.Println("Executor process has started and running.")
driver.Join()
}
示例11: main
func main() {
fmt.Println("Starting Example Executor (Go)")
dconfig := exec.DriverConfig{
Executor: newExampleExecutor(),
}
driver, err := exec.NewMesosExecutorDriver(dconfig)
if err != nil {
fmt.Println("Unable to create a ExecutorDriver ", err.Error())
}
_, err = driver.Start()
if err != nil {
fmt.Println("Got error:", err)
return
}
fmt.Println("Executor process has started and running.")
driver.Join()
}
示例12: runExecutor
func (s *KubeletExecutorServer) runExecutor(
nodeInfos chan<- executor.NodeInfo,
kubeletFinished <-chan struct{},
staticPodsConfigPath string,
apiclient *clientset.Clientset,
registry executor.Registry,
) (<-chan struct{}, error) {
exec := executor.New(executor.Config{
Registry: registry,
APIClient: apiclient,
Docker: dockertools.ConnectToDockerOrDie(s.DockerEndpoint),
SuicideTimeout: s.SuicideTimeout,
KubeletFinished: kubeletFinished,
ExitFunc: os.Exit,
StaticPodsConfigPath: staticPodsConfigPath,
NodeInfos: nodeInfos,
})
// initialize driver and initialize the executor with it
dconfig := bindings.DriverConfig{
Executor: exec,
HostnameOverride: s.HostnameOverride,
BindingAddress: net.ParseIP(s.Address),
}
driver, err := bindings.NewMesosExecutorDriver(dconfig)
if err != nil {
return nil, fmt.Errorf("failed to create executor driver: %v", err)
}
log.V(2).Infof("Initialize executor driver...")
exec.Init(driver)
// start the driver
go func() {
if _, err := driver.Run(); err != nil {
log.Fatalf("executor driver failed: %v", err)
}
log.Info("executor Run completed")
}()
return exec.Done(), nil
}
示例13: main
func main() {
log.Infoln("START executor")
config := exec.DriverConfig{
Executor: forbin.NewDatabaseExecutor(),
}
driver, err := exec.NewMesosExecutorDriver(config)
if err != nil {
log.Infoln("Unable to create a ExecutorDriver ", err.Error())
}
_, err = driver.Start()
if err != nil {
log.Infoln("Got error:", err)
return
}
log.Infoln("Executor process has started and running.")
driver.Join()
}
示例14: main
func main() {
flag.Parse()
fmt.Println("Starting Elodina Executor")
httpMirrorExecutor := framework.NewHttpMirrorExecutor(*apiKey, *apiUser, *certFile, *keyFile, *caFile, *targetUrl, *insecure)
driverConfig := executor.DriverConfig{
Executor: httpMirrorExecutor,
}
driver, err := executor.NewMesosExecutorDriver(driverConfig)
server := &ExecutorHTTPServer{httpMirrorExecutor}
go server.Start()
if err != nil {
fmt.Println("Unable to create a ExecutorDriver ", err.Error())
}
_, err = driver.Start()
if err != nil {
fmt.Println("Got error:", err)
return
}
fmt.Println("Executor process has started and running.")
driver.Join()
}
示例15: main
func main() {
flag.Parse()
err := framework.InitLogging(*logLevel)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
var taskExecutor executor.Executor
switch *executorType {
case framework.TaskTypeMirrorMaker:
taskExecutor = framework.NewMirrorMakerExecutor()
default:
{
framework.Logger.Errorf("Unknown executor type %s", *executorType)
os.Exit(1)
}
}
driverConfig := executor.DriverConfig{
Executor: taskExecutor,
}
driver, err := executor.NewMesosExecutorDriver(driverConfig)
if err != nil {
framework.Logger.Error(err)
os.Exit(1)
}
_, err = driver.Start()
if err != nil {
framework.Logger.Error(err)
os.Exit(1)
}
driver.Join()
}