コード例 #1
0
ファイル: main.go プロジェクト: eeayiaia/scmt
// This is the entry-point for the
// background-daemon
func background() {
	conf.InitConfiguration()
	InitLogging()
	database.Init(Config.Database, Config.DatabaseUser, Config.DatabasePassword)

	invoker.Init()
	devices.Init()
	master.Init()

	// Wait to terminate
	terminate = make(chan bool, 1)
	for {
		r := <-terminate
		if r {
			break
		}
	}
}
コード例 #2
0
ファイル: init.go プロジェクト: eeayiaia/scmt
func setup() error {
	//Write conf
	Log.Info("Installing..")
	Log.Info("Generating congfiguration")
	err := conf.GenerateJSONConfiguration(&newConf)
	if err != nil {
		Log.WithFields(log.Fields{
			"error": err,
		}).Fatal("Could not generate configuration")
		return err
	}

	conf.InitConfiguration()
	Config = conf.Conf

	database.Init(Config.Database, Config.DatabaseUser, Config.DatabasePassword)

	invoker.Init()
	//init scripts master
	Log.Info("Initializing master node")
	master.Init()
	Log.Info("Master node initialized")

	Log.Info("Running master init scripts")
	err = master.RunInitScripts()
	if err != nil {
		Log.WithFields(log.Fields{
			"error": err,
		}).Fatal("Failed to initialize master")
		return err
	}
	Log.Info("Master init scripts done")

	//check (install) monitor
	if monitorName != "none" {
		Log.WithFields(log.Fields{
			"plugin": monitorName,
		}).Info("Installing plugin")
		err = master.InstallPlugin(monitorName)
		if err != nil {
			Log.WithFields(log.Fields{
				"plugin": monitorName,
				"error":  err,
			}).Error("Failed to install plugin")
		}
	}

	//install mpi
	switch clusterAppName {
	case "none":

	case "both":
		Log.WithFields(log.Fields{
			"plugin": "openmpi",
		}).Info("Installing plugin")
		err = master.InstallPlugin("openmpi")
		if err != nil {
			Log.WithFields(log.Fields{
				"plugin": "openmpi",
				"error":  err,
			}).Error("Failed to install plugin")
		}

		Log.WithFields(log.Fields{
			"plugin": "mpich",
		}).Info("Installing plugin")
		err = master.InstallPlugin("mpich")
		if err != nil {
			Log.WithFields(log.Fields{
				"plugin": "mpich",
				"error":  err,
			}).Error("Failed to install plugin")
		}

	default:
		Log.WithFields(log.Fields{
			"plugin": clusterAppName,
		}).Info("Installing plugin")
		err = master.InstallPlugin(clusterAppName)
		if err != nil {
			Log.WithFields(log.Fields{
				"plugin": clusterAppName,
				"error":  err,
			}).Error("Failed to install plugin")
		}
	}

	return nil
}