public void Append(JobExecutionRecord record, int maxRecords) { _records.Enqueue(record); while (_records.Count > maxRecords) { _records.Dequeue(); } }
public void Append(JobExecutionRecord record, int maxRecords) { _records.Enqueue(record); while (_records.Count > maxRecords) { _records.Dequeue(); } }
public void read_normal_exception() { var record = new JobExecutionRecord(); var ex = new DivideByZeroException("Only Chuck Norris can do that"); record.ReadException(ex); record.ExceptionText.ShouldBe(ex.ToString()); }
public void MarkCompletion <T>(JobExecutionRecord record) { record.Executor = _channels.NodeId; modifyStatus <T>(_ => { _.Status = record.Success ? JobExecutionStatus.Completed : JobExecutionStatus.Failed; _.LastExecution = record; _.Executor = null; }, "Trying to mark a scheduled job as completed"); }
public DateTimeOffset ScheduleNextTime(DateTimeOffset currentTime, JobExecutionRecord lastExecution) { var next = currentTime.Subtract(new TimeSpan(0, 0, 0, currentTime.Second, currentTime.Millisecond)); while (next < currentTime) { next = next.Add(_seconds.Seconds()); } return next; }
public DateTimeOffset ScheduleNextTime(DateTimeOffset currentTime, JobExecutionRecord lastExecution) { var hour = new DateTimeOffset(currentTime.Year, currentTime.Month, currentTime.Day, currentTime.Hour, 0, 0, currentTime.Offset); while (hour < currentTime) { hour = hour.AddMinutes(10); } return hour; }
public DateTimeOffset ScheduleNextTime(DateTimeOffset currentTime, JobExecutionRecord lastExecution) { var localTime = currentTime.ToLocalTime(); var oneAmToday = new DateTime(localTime.Year, localTime.Month, localTime.Day, _hour, _minute, 0, 0, DateTimeKind.Local); var nextScheduledTime = oneAmToday; if (localTime.Hour > _hour || (localTime.Hour == _hour && localTime.Minute >= _minute)) { // Switch to tomorrow nextScheduledTime = oneAmToday.AddDays(1); } return nextScheduledTime.ToUniversalTime(); }
public void mark_completion_persistence() { var record = new JobExecutionRecord{Success = true}; theStatusMonitor.MarkCompletion<FooJob1>(record); foo1.Status.ShouldBe(JobExecutionStatus.Completed); foo1.LastExecution.ShouldBeTheSameAs(record); foo1.Executor.ShouldBeNull(); record.Executor.ShouldBe(theChannelGraph.NodeId); thePersistence.FindHistory(foo1.NodeName, foo1.JobKey) .ShouldHaveTheSameElementsAs(record); }
public void mark_completion_with_failure_persistence() { var record = new JobExecutionRecord { Success = false }; theStatusMonitor.MarkCompletion<FooJob1>(record); foo1.Status.ShouldBe(JobExecutionStatus.Failed); foo1.LastExecution.ShouldBeTheSameAs(record); foo1.Executor.ShouldBeNull(); record.Executor.ShouldBe(theChannelGraph.NodeId); }
public void store_history() { var record1 = new JobExecutionRecord(); var record2 = new JobExecutionRecord(); var record3 = new JobExecutionRecord(); var record4 = new JobExecutionRecord(); thePersistence.RecordHistory("foo", "1", record1); thePersistence.RecordHistory("foo", "1", record2); thePersistence.RecordHistory("foo", "2", record3); thePersistence.RecordHistory("foo", "2", record4); thePersistence.FindHistory("foo", "1").ShouldHaveTheSameElementsAs(record1, record2); thePersistence.FindHistory("foo", "2").ShouldHaveTheSameElementsAs(record3, record4); }
public void read_aggregate_exception() { var ex1 = new DivideByZeroException("Only Chuck Norris can do that"); var ex2 = new RankException("You're last!"); var ex3 = new InvalidTimeZoneException("You are in the wrong place!"); var ex = new AggregateException(ex1, ex2, ex3); var record = new JobExecutionRecord(); record.ReadException(ex); record.ExceptionText.ShouldNotBe(ex.ToString()); record.ExceptionText.ShouldContain(ex1.ToString()); record.ExceptionText.ShouldContain(ex2.ToString()); record.ExceptionText.ShouldContain(ex3.ToString()); record.ExceptionText.ShouldContain(JobExecutionRecord.ExceptionSeparator); }
protected bool Equals(JobExecutionRecord other) { return(Duration.Equals(other.Duration) && Finished.Equals(other.Finished) && Success.Equals(other.Success)); }
public DateTimeOffset ScheduleNextTime(DateTimeOffset currentTime, JobExecutionRecord lastExecution) { return _nextTime; }
private void addRecord(JobExecutionRecord record, TableRowTag row) { row.Cell(record.Finished.ToLocalTime().ToString()).Style("vertical-align", "top"); row.Cell(record.Executor).Style("vertical-align", "top"); row.Cell(record.Success ? "Success" : "Failed").Style("vertical-align", "top"); row.Cell(record.Duration.ToString()).Attr("align", "right").Style("vertical-align", "top"); row.Cell(record.Attempts.ToString()).Attr("align", "right").Style("vertical-align", "top"); if (record.ExceptionText.IsEmpty()) { row.Cell("None"); } else { row.Cell().Add("pre").Text(record.ExceptionText).Style("font-size", "xx-small"); } }
protected bool Equals(JobExecutionRecord other) { return Duration.Equals(other.Duration) && Finished.Equals(other.Finished) && Success.Equals(other.Success); }
public void RecordHistory(string nodeName, string jobKey, JobExecutionRecord record) { var id = ScheduledRunHistory.ToId(nodeName, jobKey); _history[id].Append(record, 100); }
public void RecordHistory(string nodeName, string jobKey, JobExecutionRecord record) { var id = ScheduledRunHistory.ToId(nodeName, jobKey); _history[id].Append(record, 100); }
public void RecordHistory(string nodeName, string jobKey, JobExecutionRecord record) { var id = ScheduledRunHistory.ToId(nodeName, jobKey); _transaction.Execute<IDocumentSession>(session => { var history = session.Load<ScheduledRunHistory>(id) ?? new ScheduledRunHistory{JobKey = jobKey, NodeName = nodeName}; history.Append(record, _maxHistory); session.Store(history); }); }