private JobResult RunJob(Job job) { int currentJobStep = 1; job.CurrentExecutionStatus = ExecutionStatus.Running; while(currentJobStep > 0) { JobStep step = job.Steps.Find(x => x.Id == currentJobStep); JobStepResult result = RunJobStep(step); _db.LogJobStep(result); if (result.IsError) { if (step.StepIdOnError > 0) currentJobStep = step.StepIdOnError; job.CurrentExecutionStatus = ExecutionStatus.Error; } else { currentJobStep = step.NextStepId; } } job.CurrentExecutionStatus = ExecutionStatus.Finished; //Log result return null; }
public AgentWorker(Job job, ManualResetEvent doneEvent) { this._db = new AgentDb(); this._job = job; this._doneEvent = doneEvent; }