public void Activate() { _logger.Info(() => "Activating all scheduled jobs"); _timer.ClearAll(); _statusMonitor.Persist(schedule => { _jobs.DetermineSchedule(_timer.Now(), this, schedule); schedule.Active().Each(status => { var job = _jobs.FindJob(status.JobType); job.Initialize(_timer.Now(), this, schedule); }); }); _active = true; }
public void SetUp() { theExecutor = new StubJobExecutor(); theSchedule = new JobSchedule(new[] { JobStatus.For <AJob>(DateTime.Today), JobStatus.For <BJob>(DateTime.Today.AddHours(1)), JobStatus.For <CJob>(DateTime.Today.AddHours(2)), }); theGraph = new ScheduledJobGraph(); theGraph.Jobs.Add(new ScheduledJob <BJob>(new DummyScheduleRule(DateTime.Today.AddHours(1)))); theGraph.Jobs.Add(new ScheduledJob <CJob>(new DummyScheduleRule(DateTime.Today.AddHours(3)))); theGraph.Jobs.Add(new ScheduledJob <DJob>(new DummyScheduleRule(DateTime.Today.AddHours(4)))); theGraph.Jobs.Add(new ScheduledJob <EJob>(new DummyScheduleRule(DateTime.Today.AddHours(5)))); // not that worried about pushing the time around theGraph.DetermineSchedule(now, theExecutor, theSchedule); }
public void SetUp() { theExecutor = new StubJobExecutor(); theSchedule = new JobSchedule(new[] { JobStatus.For<AJob>(DateTime.Today), JobStatus.For<BJob>(DateTime.Today.AddHours(1)), JobStatus.For<CJob>(DateTime.Today.AddHours(2)), }); theGraph = new ScheduledJobGraph(); theGraph.Jobs.Add(new ScheduledJob<BJob>(new DummyScheduleRule(DateTime.Today.AddHours(1)))); theGraph.Jobs.Add(new ScheduledJob<CJob>(new DummyScheduleRule(DateTime.Today.AddHours(3)))); theGraph.Jobs.Add(new ScheduledJob<DJob>(new DummyScheduleRule(DateTime.Today.AddHours(4)))); theGraph.Jobs.Add(new ScheduledJob<EJob>(new DummyScheduleRule(DateTime.Today.AddHours(5)))); // not that worried about pushing the time around theGraph.DetermineSchedule(now, theExecutor, theSchedule); }