Esempio n. 1
0
func init() {
	revel.OnAppStart(func() {
		jobs.Schedule("0 */5 * ? * ?", MyJob{Name: "job1"})
		jobs.Schedule("cron.every_1h", MyJob{Name: "job2"})
		jobs.Schedule("cron.every_10m", MyJob{Name: "job3"})
		jobs.Schedule("@every 1m", jobs.Func(reminder))
		jobs.Now(MyJob{Name: "job Now"})
	})
}
Esempio n. 2
0
//Build Launch a build
//Build queue is restricted by jobs.pool = 4 in app.conf (FIFO)
func (w *WorkerManager) Build(build *Build) error {

	var launchFunc func(build *Build, targetSys string) Worker

	switch build.ProjectToBuild.Configuration.BuildType {
	case "Docker":
		launchFunc = w.launchDockerBuild
	default:
		build.State = Fail
		return errors.New("Not a valid build type")
	}
	jobs.Now(launchFunc(build, build.TargetSys))
	return nil
}