private void FailedExecution(IEnumerable <TaskExecutionResult> taskFailureInfos) { _session.Transact(session => taskFailureInfos.ForEach( taskFailureInfo => { IExecutableTask executableTask = taskFailureInfo.Task; executableTask.Entity.OnFailure(executableTask, taskFailureInfo.Exception); session.Update(executableTask.Entity); })); }
private TaskExecutionResult Execute(IExecutableTask executableTask) { try { return(executableTask.Execute()); } catch (Exception exception) { CurrentRequestData.ErrorSignal.Raise(exception); return(TaskExecutionResult.Failure(executableTask, exception)); } }
private TaskExecutionResult Execute(IExecutableTask executableTask) { try { return executableTask.Execute(); } catch (Exception exception) { CurrentRequestData.ErrorSignal.Raise(exception); return TaskExecutionResult.Failure(executableTask, exception); } }
public virtual void OnFailure(IExecutableTask executableTask, Exception exception) { executableTask.OnFailure(exception); if (Tries < 5) Status = TaskExecutionStatus.Pending; else { Status = TaskExecutionStatus.Failed; FailedAt = CurrentRequestData.Now; executableTask.OnFinalFailure(exception); } Tries++; }
public virtual void OnFailure(IExecutableTask executableTask, Exception exception) { executableTask.OnFailure(exception); if (Tries < 5) { Status = TaskExecutionStatus.Pending; } else { Status = TaskExecutionStatus.Failed; FailedAt = CurrentRequestData.Now; executableTask.OnFinalFailure(exception); } Tries++; }
public IList <IExecutableTask> GetTasksToExecute(IList <QueuedTask> pendingQueuedTasks, IList <ScheduledTask> pendingScheduledTasks) { List <IExecutableTask> executableTasks = new List <IExecutableTask>(); List <QueuedTask> failedTasks = new List <QueuedTask>(); foreach (QueuedTask queuedTask in pendingQueuedTasks) { try { IExecutableTask task = _kernel.Get(queuedTask.GetTaskType()) as IExecutableTask; task.Site = queuedTask.Site; task.Entity = queuedTask; task.SetData(queuedTask.Data); executableTasks.Add(task); } catch (Exception exception) { CurrentRequestData.ErrorSignal.Raise(exception); failedTasks.Add(queuedTask); } } if (failedTasks.Any()) { _session.Transact(session => failedTasks.ForEach(task => { task.Status = TaskExecutionStatus.Failed; task.FailedAt = CurrentRequestData.Now; session.Update(task); })); } foreach (ScheduledTask scheduledTask in pendingScheduledTasks) { Type taskType = TypeHelper.GetAllTypes().FirstOrDefault(type => type.FullName == scheduledTask.Type); IExecutableTask task = _kernel.Get(taskType) as IExecutableTask; task.Site = scheduledTask.Site; task.Entity = scheduledTask; executableTasks.Add(task); } return(executableTasks); }
public virtual void OnStarting(IExecutableTask executableTask) { Status = TaskExecutionStatus.Executing; StartedAt = CurrentRequestData.Now; executableTask.OnStarting(); }
public GoUpTheMountainOfDoomTask(IExecutableTask originalTask) { this.originalTask = originalTask; monster = new NonCodingArchitect(); }
public virtual void OnSuccess(IExecutableTask executableTask) { Status = TaskExecutionStatus.Pending; LastComplete = CurrentRequestData.Now; executableTask.OnSuccess(); }
public EnterForbiddenForestTask(IExecutableTask originalTask) { this.originalTask = originalTask; monster = new GrumpyDatabaseAdministrator(); }
public virtual void OnStarting(IExecutableTask executableTask) { Status = TaskExecutionStatus.Executing; executableTask.OnStarting(); }
public virtual void OnStarting(IExecutableTask executableTask) { Status = TaskExecutionStatus.Executing; executableTask.OnStarting(); }
public static TaskExecutionResult Failure(IExecutableTask task, Exception exception) { return(new TaskExecutionResult { Success = false, Task = task, Exception = exception }); }
public virtual void OnSuccess(IExecutableTask executableTask) { Status = TaskExecutionStatus.Completed; CompletedAt = CurrentRequestData.Now; executableTask.OnSuccess(); }
public static TaskExecutionResult Failure(IExecutableTask task, Exception exception) { return new TaskExecutionResult {Success = false, Task = task, Exception = exception}; }
public virtual void OnStarting(IExecutableTask executableTask) { Status = TaskExecutionStatus.Executing; StartedAt = CurrentRequestData.Now; executableTask.OnStarting(); }
public Choice(string code, string description, IExecutableTask task) { this.task = task; Code = code; Description = description; }
public virtual void OnFailure(IExecutableTask executableTask, Exception exception) { Status = TaskExecutionStatus.Pending; executableTask.OnFailure(exception); }
public virtual void OnSuccess(IExecutableTask executableTask) { Status = TaskExecutionStatus.Pending; LastComplete = CurrentRequestData.Now; executableTask.OnSuccess(); }
public AttackTask(IMonster monster, IExecutableTask originalTask) { this.monster = monster; this.originalTask = originalTask; }
public NullChoice(IExecutableTask task) { this.task = task; }
public void ExecuteChoice(string code) { currentTask = currentTask.Execute(code, this); }
public virtual void OnFailure(IExecutableTask executableTask, Exception exception) { Status = TaskExecutionStatus.Pending; executableTask.OnFailure(exception); }
public static TaskExecutionResult Successful(IExecutableTask task) { return new TaskExecutionResult {Success = true, Task = task}; }
public virtual void OnSuccess(IExecutableTask executableTask) { Status = TaskExecutionStatus.Completed; CompletedAt = CurrentRequestData.Now; executableTask.OnSuccess(); }
public EnterThePrancingPoneyTask(IExecutableTask originalTask) { this.originalTask = originalTask; monster = new CertifiedDotNetDeveloper(); }
public static TaskExecutionResult Successful(IExecutableTask task) { return(new TaskExecutionResult { Success = true, Task = task }); }