public static JobInfo FromJob(Job job) { return new JobInfo { Created = job.Created, Ended = job.EndDate, ItemsProcessed = job.ItemsProcessed, RowsCreated = job.RowsCreated, LastException = job.LastException != null ? job.LastException.ToString() : null, Progress = job.Progress, Status = job.Status, StatusText = job.StatusText, HasResult = Directory.Exists(job.TempDirectory) && job.Status == JobStatus.Completed, Specification = job.Specification != null ? job.Specification.ToString() : null, SizeLimitExceeded = job.SizeLimitExceeded, Id = job.Id }; }
public void Initialize(Job job) { Prototype.Initialize(job); }
private Job Add(IJobSpecification specification) { Job job; lock (_jobListSyncRoot) { var lockKey = specification.LockKey; List<Job> jobList = null; if (!string.IsNullOrEmpty(lockKey)) { jobList = GetJobList(lockKey, true); if (jobList.Any(j => !j.EndDate.HasValue)) { throw new InvalidOperationException(string.Format("Another job is running with the lock key '{0}'", lockKey)); } } job = new Job(specification, JobExecutionSettings); if (!_jobs.TryAdd(job.Id, job)) { throw new InvalidOperationException("Dupplicate job ID"); } if (jobList != null) { jobList.Add(job); } } PurgeOld(); return job; }
protected virtual JobInfo GetJobInfo(Job job) { var info = JobInfo.FromJob(job); return info; }
private void Remove(Job job) { Job removed; if (_jobs.TryRemove(job.Id, out removed) && !string.IsNullOrEmpty(removed.Specification.LockKey)) { lock (_jobListSyncRoot) { var list = GetJobList(removed.Specification.LockKey); if (list != null) { list.Remove(job); } } } }
public void Initialize(Job job) { }