Example #1
0
func schedule_session_refresh(ctxt string) {
	//Refresh Session
	scheduler, err := schedule.NewScheduler()
	if err != nil {
		logger.Get().Error("%s-%v", ctxt, err.Error())
	} else {
		f := RefreshDBSession
		m := make(map[string]interface{})
		go scheduler.Schedule(time.Duration(24*time.Hour), f, m)
	}
}
Example #2
0
func schedule_archive_activities(ctxt string) {
	scheduler, err := schedule.NewScheduler()
	if err != nil {
		logger.Get().Error("%s-%v", ctxt, err.Error())
	} else {
		f := archive_activities
		m := make(map[string]interface{})
		m["ctxt"] = ctxt
		go scheduler.Schedule(time.Duration(24*time.Hour), f, m)
	}
}
Example #3
0
func schedule_task_check(ctxt string) {
	//Check Task status
	scheduler, err := schedule.NewScheduler()
	if err != nil {
		logger.Get().Error("%s-%v", ctxt, err.Error())
	} else {
		f := check_task_status
		m := make(map[string]interface{})
		go scheduler.Schedule(time.Duration(20*time.Minute), f, m)
	}
}
Example #4
0
func schedulePhysicalResourceStatsFetch(config conf.SystemSummaryConfig, params map[string]interface{}) error {
	go SyncNodeUtilizations(params)
	schedule.InitShechuleManager()
	scheduler, err := schedule.NewScheduler()
	if err != nil {
		logger.Get().Error("Error scheduling the node resource fetch. Error %v", err)
		return err
	}
	f := SyncNodeUtilizations
	go scheduler.Schedule(time.Duration(config.NetSummaryInterval)*time.Second, f, params)
	return nil
}
Example #5
0
func scheduleSummaryMonitoring(config conf.SystemSummaryConfig) error {
	go ComputeSystemSummary(make(map[string]interface{}))
	schedule.InitShechuleManager()
	scheduler, err := schedule.NewScheduler()
	if err != nil {
		logger.Get().Error("Error scheduling the system summary calculation. Error %v", err)
		return err
	}
	f := ComputeSystemSummary
	go scheduler.Schedule(time.Duration(config.NetSummaryInterval)*time.Second, f, make(map[string]interface{}))
	return nil
}
Example #6
0
func (a *App) PostInitApplication(sysConfig conf.SkyringCollection) error {
	// Initialize the scheduler
	schedule.InitShechuleManager()

	// Create syncing schedule
	scheduler, err := schedule.NewScheduler()
	if err != nil {
		logger.Get().Error("Error scheduling clusters syncing")
	} else {
		if sysConfig.ScheduleConfig.ClustersSyncInterval == 0 {
			sysConfig.ScheduleConfig.ClustersSyncInterval = 86400 // 24hrs
		}
		go scheduler.Schedule(
			time.Duration(sysConfig.ScheduleConfig.ClustersSyncInterval)*time.Second,
			a.SyncClusterDetails,
			nil)
	}

	// Create monitoring schedule
	go InitMonitoringSchedules()

	// First time sync of the cluster details while startup
	go a.SyncClusterDetails(nil)

	reqId, err := uuid.New()
	if err != nil {
		logger.Get().Error("Error Creating the RequestId. error: %v", err)
		return fmt.Errorf("Error Creating the RequestId. error: %v", err)
	}

	ctxt := fmt.Sprintf("%v:%v", models.ENGINE_NAME, reqId.String())
	if err := schedulePhysicalResourceStatsFetch(sysConfig.SummaryConfig, map[string]interface{}{"ctxt": ctxt}); err != nil {
		logger.Get().Error("%s - Failed to schedule fetching node resource utilizations.Error %v", ctxt, err)
		return err
	}

	if err := scheduleSummaryMonitoring(sysConfig.SummaryConfig); err != nil {
		logger.Get().Error("%s - Failed to schedule fetching summary.Error %v", ctxt, err)
		return err
	}
	schedule_task_check(ctxt)
	node_Reinitialize()
	cleanupTasks()
	initializeAbout(ctxt)
	schedule_archive_activities(ctxt)
	FailStillCreatingClusters(ctxt)
	schedule_session_refresh(ctxt)
	return nil
}