Beispiel #1
0
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()
}
Beispiel #2
0
func handleScheduler() error {
	var api string
	var user string
	var logLevel string

	flag.StringVar(&syscol.Config.Master, "master", "", "Mesos Master addresses.")
	flag.StringVar(&api, "api", "", "Binding host:port for http/artifact server. Optional if SM_API env is set.")
	flag.StringVar(&user, "user", "", "Mesos user. Defaults to current system user")
	flag.StringVar(&logLevel, "log.level", syscol.Config.LogLevel, "Log level. trace|debug|info|warn|error|critical. Defaults to info.")
	flag.StringVar(&syscol.Config.FrameworkName, "framework.name", syscol.Config.FrameworkName, "Framework name.")
	flag.StringVar(&syscol.Config.FrameworkRole, "framework.role", syscol.Config.FrameworkRole, "Framework role.")

	flag.Parse()

	if err := resolveApi(api); err != nil {
		return err
	}

	if err := syscol.InitLogging(logLevel); err != nil {
		return err
	}

	if syscol.Config.Master == "" {
		return errors.New("--master flag is required.")
	}

	return new(syscol.Scheduler).Start()
}