public virtual void SetJobStatus(int jobID, int status) { SqlJobRecord job = null; lock (this) { job = GetJobRecord(jobID); job.Status = status; safeDataContext.SubmitChanges(); } jobStatusChanged.OnNext(job); }
public virtual IJobRecord AddJob(int rootID, int parentID, int priority, Func <IJobContext, Task> action, string dataUri, string requestUri, int partitionNo = 0, int partitionCount = 1) { if (action.GetInvocationList().Count() != 1) { throw new ArgumentException("No multicast delegates supported", "action"); } if (!action.Method.IsStatic) { throw new ArgumentException("Action method must be static", "action"); } lock (this) { var job = new SqlJobRecord { ParentID = parentID, RootID = rootID, Priority = priority, TypeName = action.Method.DeclaringType.AssemblyQualifiedName, MethodName = action.Method.Name, DataUri = dataUri, SubmitTime = DateTime.Now, AccessTime = DateTime.Now, NodeID = -1, RequestUri = requestUri, Status = JobStatus.WaitingToRun, PartitionNo = partitionNo, PartitionCount = partitionCount }; safeDataContext.GetTable <SqlJobRecord>().InsertOnSubmit(job); safeDataContext.SubmitChanges(); return(job); } }