Ejemplo n.º 1
0
Archivo: main.go Proyecto: ngaut/tyrant
func main() {
	println("executor started")
	log.SetHighlighting(false)
	f, err := os.Create("executor.log")
	if err != nil {
		println(err.Error())
	}

	log.SetOutput(f)
	log.Warning("executor start...")
	pwd, err := os.Getwd()
	if err != nil {
		log.Fatal(err)
	}

	se := &ShellExecutor{pwd: pwd, finish: make(chan string),
		process: make(map[string]*contex)}
	driver := mesos.ExecutorDriver{
		Executor: &mesos.Executor{
			Registered:   se.OnRegister,
			KillTask:     se.OnKillTask,
			LaunchTask:   se.OnLaunchTask,
			Shutdown:     se.OnShutdown,
			Error:        se.OnError,
			Disconnected: se.OnDisconnected,
		},
	}

	go se.EventLoop()

	driver.Init()
	defer driver.Destroy()

	driver.Run()
}
Ejemplo n.º 2
0
func main() {
	log.SetHighlighting(false)
	pwd, err := os.Getwd()
	if err != nil {
		log.Fatal(err)
	}

	se := &ShellExecutor{pwd: pwd, finish: make(chan string),
		process: make(map[string]*contex)}
	driver := mesos.ExecutorDriver{
		Executor: &mesos.Executor{
			Registered:   se.OnRegister,
			KillTask:     se.OnKillTask,
			LaunchTask:   se.OnLaunchTask,
			Shutdown:     se.OnShutdown,
			Error:        se.OnError,
			Disconnected: se.OnDisconnected,
		},
	}

	go se.EventLoop()

	driver.Init()
	defer driver.Destroy()

	driver.Run()
}