Exemplo n.º 1
0
func AnalyzeRecurring() (*analysis.ResultContainer, error) {
	//return GenerateSampleData() //don't execute this more than once
	/*lp := logpoint.LogPoint{
		RunId:    "1435242237863904600_TY1IFnZMJgJ2oQ1cbCZ1Noc7srSpTk2GqvWvyCFRkjiH9KtBLtLk21TResavgeAr",
		Task:     "testData",
		Host:     "test.permanent.de",
		Mode:     mode.Recurring,
		Priority: priority.Informational,
		State:    state.Started,
		Time:     time.Now(),
	}

	go scheduler.RecurringTaskIncoming(lp)*/

	analysis.CheckRecurredTaskBegin("testData")

	return analysis.GetRecurringResultContainer()
}
Exemplo n.º 2
0
func RecurringBeginWatcher() {
	rc := analysis.NewResultContainer()
	err := rc.LoadLatest()
	if err != nil {
		idl.Crit("Failed scheduling of task begin analysis", err)
	}

	analyzer := func(t string, r analysis.Result) {
		go func(task string, res analysis.Result) {

			for {
				analysis.CheckRecurredTaskBegin(task)
				<-time.After(res.IntervalAvg + res.IntervalStdDev)
			}
		}(t, r)
	}

	rc.Range(analyzer)
}