Example #1
0
func main() {
	flag.Parse()
	cmds := ParseCommands(*cmdsfile)

	scheduler := worker.NewScheduler(200)

	go func() {
		for res := range scheduler.ResultsChan {
			fmt.Printf("Results: \n%#v\n", res)
			if res.FailedJob != nil {
				out, _ := json.Marshal(res.FailedJob)
				fmt.Printf("Failed job:\n%v\n", string(out))
			}
		}
	}()

	go func() {
		scheduler.Start()
	}()

	for _, cmd := range cmds {
		scheduler.Push(cmd)
	}
	sleep := make(chan bool)
	sleep <- true
}
Example #2
0
func main() {
	w := worker.NewCmdWorker()
	input := make(chan *worker.JobPayload)
	scheduler := worker.NewScheduler(w, input, 2000)

	in := communication.NewHttpInput(input)
	go func() { in.StartInput() }()
	out := communication.NewStdoutOut(scheduler.ResultsChan())
	go func() { out.StartOut() }()
	scheduler.Start()
}