static void ScheduleJobs(string instance) { var scheduler = Schedulers.Get(instance); foreach (var behaviorType in BehaviorTypes.All()) { var jobName = "Recompute similarity matrix (" + behaviorType + ")"; var config = JobConfig.Load(instance, jobName); if (config == null) { config = new JobConfig { JobName = jobName, Interval = TimeSpan.FromHours(24), StartTime = new TimeOfDay(2, 0) }; } var job = new RecomputeSimilarityMatrixJob(); scheduler.Schedule(jobName, job, config.Interval, config.StartTime, new Dictionary <string, string> { { "BehaviorType", behaviorType } }); } }
public ActionResult JobConfig(string jobName) { var schedule = Schedulers.Get(CurrentInstance.Name).GetSchedule(jobName); return(JsonNet(new JobConfigModel { JobName = jobName, Interval = (int)schedule.Interval.TotalMinutes, StartHour = schedule.StartTime.Hour, StartMinute = schedule.StartTime.Mintue }).UsingClientConvention()); }
public void JobConfig(JobConfigModel model) { Kooboo.Commerce.Recommendations.Engine.Jobs.JobConfig.Update(CurrentInstance.Name, new JobConfig { JobName = model.JobName, Interval = TimeSpan.FromMinutes(model.Interval), StartTime = new TimeOfDay(model.StartHour, model.StartMinute) }); var scheduler = Schedulers.Get(CurrentInstance.Name); scheduler.Reschedule(model.JobName, TimeSpan.FromMinutes(model.Interval), new TimeOfDay(model.StartHour, model.StartMinute)); }
public ActionResult Jobs() { var schedules = Schedulers.Get(CurrentInstance.Name).Schedules.ToList(); return(View(schedules)); }