Ejemplo n.º 1
0
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()
}
Ejemplo n.º 2
0
func handleScheduler() error {
	var api string
	var logLevel string

	flag.StringVar(&statsd.Config.Master, "master", "", "Mesos Master addresses.")
	flag.StringVar(&api, "api", "", "API host:port for advertizing.")
	flag.StringVar(&statsd.Config.User, "user", "", "Mesos user. Defaults to current system user")
	flag.StringVar(&logLevel, "log.level", statsd.Config.LogLevel, "Log level. trace|debug|info|warn|error|critical. Defaults to info.")
	flag.StringVar(&statsd.Config.FrameworkName, "framework.name", statsd.Config.FrameworkName, "Framework name.")
	flag.StringVar(&statsd.Config.FrameworkRole, "framework.role", statsd.Config.FrameworkRole, "Framework role.")
	flag.StringVar(&statsd.Config.Namespace, "namespace", statsd.Config.Namespace, "Namespace.")

	flag.Parse()

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

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

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

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