private void FailedExecution(IEnumerable <TaskExecutionResult> taskFailureInfos) { _session.Transact(session => taskFailureInfos.ForEach( taskFailureInfo => { AdHocTask executableTask = taskFailureInfo.Task; executableTask.Entity.OnFailure(executableTask, taskFailureInfo.Exception); session.Update(executableTask.Entity); })); }
private TaskExecutionResult Execute(AdHocTask executableTask) { try { return(executableTask.Execute()); } catch (Exception exception) { CurrentRequestData.ErrorSignal.Raise(exception); return(TaskExecutionResult.Failure(executableTask, exception)); } }
public virtual void OnFailure(AdHocTask executableTask, Exception exception) { executableTask.OnFailure(exception); if (Tries < 5) { Status = TaskExecutionStatus.Pending; } else { Status = TaskExecutionStatus.Failed; FailedAt = CurrentRequestData.Now; executableTask.OnFinalFailure(exception); } Tries++; }
public BatchExecutionResult Execute(AdHocTask task) { if (task != null) { IList <AdHocTask> tasksToExecute = new List <AdHocTask> { task }; foreach (var handler in _executionHandlers.OrderByDescending(handler => handler.Priority)) { var tasks = handler.ExtractTasksToHandle(ref tasksToExecute); if (tasks.Any()) { return new BatchExecutionResult { Results = handler.ExecuteTasks(tasks) } } ; } } return(new BatchExecutionResult()); } }
public static TaskExecutionResult Failure(AdHocTask task, Exception exception) { return(new TaskExecutionResult { Success = false, Task = task, Exception = exception }); }
public static TaskExecutionResult Successful(AdHocTask task) { return(new TaskExecutionResult { Success = true, Task = task }); }
public virtual void OnSuccess(AdHocTask executableTask) { Status = TaskExecutionStatus.Completed; CompletedAt = CurrentRequestData.Now; executableTask.OnSuccess(); }
public virtual void OnStarting(AdHocTask executableTask) { Status = TaskExecutionStatus.Executing; StartedAt = CurrentRequestData.Now; executableTask.OnStarting(); }