public void PublishStatusUpdate(long jobRunId, JobRunStates state) { if (!this.jobRunStatusUpdates.ContainsKey(jobRunId)) { this.jobRunStatusUpdates.Add(jobRunId, new List <JobRunStates>()); } this.jobRunStatusUpdates[jobRunId].Add(state); foreach (var kvp in this.statusUpdateWaitCallBacks) { try { var callback = kvp.Key; var callbackHasPermitted = callback(this.jobRunStatusUpdates); if (callbackHasPermitted) { kvp.Value.Set(); } } catch (Exception e) { Console.WriteLine(e); } } }
public void UpdateState(long jobRunId, JobRunStates state) { Logger.InfoFormat("[{0}] The JobRun with id: {0} has switched to the '{1}'-State", jobRunId, state); var jobRun = this.repository.GetJobRunById(jobRunId); jobRun.State = this.mapper.Map <ComponentModel.JobStorage.Model.JobRunStates>(state); if (state == JobRunStates.Started) { jobRun.ActualStartDateTimeUtc = DateTime.UtcNow; } if (state == JobRunStates.Completed || state == JobRunStates.Failed) { jobRun.ActualEndDateTimeUtc = DateTime.UtcNow; } this.repository.Update(jobRun); if (state == JobRunStates.Completed || state == JobRunStates.Failed) { this.messengerHub.Publish(new JobRunCompletedMessage(this) { Id = jobRunId, IsSuccessful = state == JobRunStates.Completed }); } }
public PagedResult <JobRun> GetJobRunsByState(JobRunStates state, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, bool showDeleted = false, params string[] sort) { return(new PagedResult <JobRun> { Items = new List <JobRun>(), TotalItems = 0, PageSize = pageSize, Page = page }); }
public PagedResult <JobRun> GetJobRunsByState(JobRunStates state, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, bool showDeleted = false, params string[] sort) { var jobruns = this.repository.GetJobRunsByState((ComponentModel.JobStorage.Model.JobRunStates)state, page, pageSize, jobTypeFilter, jobUniqueNameFilter, query, showDeleted, sort); return(new PagedResult <JobRun> { Items = this.mapper.Map <List <JobRun> >(jobruns.Items), TotalItems = jobruns.TotalItems, Page = page, PageSize = pageSize }); }
private void AddJobRun(DateTime plannedStartDateTimeUtc, JobRunStates state) { var scheduledTrigger = new InstantTrigger() { JobId = this.demoJob1Id, IsActive = true }; var demoJob = this.repository.GetJob(this.demoJob1Id); var jobRun = this.repository.SaveNewJobRun(demoJob, scheduledTrigger, plannedStartDateTimeUtc); jobRun.State = state; this.repository.Update(jobRun); }
public List <JobRun> GetJobRunsByState(JobRunStates state, int page = 0, int pageSize = 50) { using (var session = this._documentStore.OpenSession()) { var stateFromModel = (Model.JobRunStates)state; return(session.Query <Model.JobRun>() .Where(p => p.State == stateFromModel) .OrderByDescending(o => o.PlannedStartDateTimeUtc) .Skip(page * pageSize) .Take(pageSize) .ToList() .Select(s => s.ToModel()) .ToList()); } }
public IEnumerable <JobRun> GetJobRunsByStateRange(JobRunStates minState, JobRunStates maxState) { if (maxState < minState) { throw new ArgumentOutOfRangeException(nameof(maxState), $"The parameter '{nameof(maxState)}' should not be lower than '{nameof(minState)}'"); } for (var i = minState; i <= maxState; i++) { var currentState = (JobRunStates)i; var jobRunsByState = this.GetJobRunsByState(currentState); foreach (var jobRun in jobRunsByState) { yield return(jobRun); } } }
public PagedResult <JobRun> GetJobRunsByState(JobRunStates state, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, bool showDeleted = false, params string[] sort) { int totalItems; var enumerable = this.ApplyFiltersAndPaging(page, pageSize, jobTypeFilter, jobUniqueNameFilter, query, this.localJobRuns.Where(p => p.State == state), out totalItems); if (sort == null || sort.Length == 0) { enumerable = enumerable.OrderByDescending(o => o.PlannedStartDateTimeUtc); } else { enumerable = ApplySorting(sort, enumerable, this.JobRunOrderByMapping); } return(new PagedResult <JobRun> { Page = page, PageSize = pageSize, Items = enumerable.ToList(), TotalItems = totalItems, }); }
public void RaiseStatusChange(JobRunStates state) { this.progressChannel.PublishStatusUpdate(this.jobRunInfo.Id, state); }
public List <JobRun> GetJobRunsByState(JobRunStates state, int page = 0, int pageSize = 50) { throw new NotImplementedException(); }
public List <JobRun> GetJobRunsByState(JobRunStates state, int page = 0, int pageSize = 50) { return(new List <JobRun>()); }
public List <JobRun> GetJobRunsByState(JobRunStates state, int page = 0, int pageSize = 50) { return(this.localJobRuns.Where(jr => jr.State == state).ToList().Clone()); }
public PagedResult <JobRun> GetJobRunsByState(JobRunStates state, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, bool showDeleted = false, params string[] sort) { return(this.storageProvider.GetJobRunsByState(state, page, pageSize, jobTypeFilter, jobUniqueNameFilter, query, showDeleted, sort)); }
public List <JobRun> GetJobRunsByState(JobRunStates state, int page = 0, int pageSize = 50) { this.CheckFailAll(); return(this.inMemoryVersion.GetJobRunsByState(state, page, pageSize)); }
public PagedResult <JobRun> GetJobRunsByState(JobRunStates state, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, bool showDeleted = false, params string[] sort) { throw new NotImplementedException(); }
public PagedResult <JobRun> GetJobRunsByState(JobRunStates state, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, bool showDeleted = false, params string[] sort) { this.CheckFailAll(); return(this.inMemoryVersion.GetJobRunsByState(state, page, pageSize, jobTypeFilter, jobUniqueNameFilter, query, showDeleted, sort)); }
public List <JobRun> GetJobRunsByState(JobRunStates state) { return(this.storageProvider.GetJobRunsByState(state)); }
public PagedResult <JobRun> GetJobRunsByState(JobRunStates state, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, bool showDeleted = false, params string[] sort) { return(this.GetJobRuns(sql => sql.Where(p => p.State == state), page, pageSize, jobTypeFilter, jobUniqueNameFilter, query, showDeleted, sort)); }
public void PublishStatusUpdate(long jobRunId, JobRunStates state) { var coreState = this.mapper.Map <Core.Models.JobRunStates>(state); this.jobRunService.UpdateState(jobRunId, coreState); }