Пример #1
0
 public void OnStepCanceled(ITaskStep step, TaskDefinition task)
 {
     _stepCanceled?.Invoke(new StepCanceledEvent
     {
         Step      = step,
         Task      = task,
         Timestamp = DateTimeUtils.Now
     });
 }
Пример #2
0
 public TaskExecutionException(
     Exception innerException,
     ITaskStep taskStep,
     object additionalData = null)
     : base("Error while executing task. See inner exception.", innerException)
 {
     StepName = taskStep.Name;
     AdditionalData = additionalData;
 }
Пример #3
0
 public void OnStepFailed(TaskExecutionException exception, ITaskStep step, TaskDefinition task)
 {
     _stepFailed?.Invoke(new StepFailedEvent
     {
         Exception = exception,
         Step      = step,
         Task      = task,
         Timestamp = DateTimeUtils.Now
     });
 }
Пример #4
0
 public void OnStepEnded(ITaskStep step, TaskDefinition task, TimeSpan duration)
 {
     _stepEnded?.Invoke(new StepEndedEvent
     {
         Step      = step,
         Task      = task,
         Duration  = duration,
         Timestamp = DateTimeUtils.Now
     });
 }
Пример #5
0
 public void OnStepProgressed(float progress, TimeSpan durationSoFar, ITaskStep step, TaskDefinition task)
 {
     _stepProgressed?.Invoke(new StepProgressedEvent
     {
         Progress      = progress,
         DurationSoFar = durationSoFar,
         Step          = step,
         Task          = task,
         Timestamp     = DateTimeUtils.Now
     });
 }
Пример #6
0
 public void OnItemEnded(int itemNumber, object item, ITaskStep step, TaskDefinition task, TimeSpan duration)
 {
     _itemEnded?.Invoke(new ItemEndedEvent
     {
         ItemNumber = itemNumber,
         Item       = item,
         Step       = step,
         Task       = task,
         Duration   = duration,
         Timestamp  = DateTimeUtils.Now
     });
 }
Пример #7
0
 public void OnBlockEnded(IPipelineBlock block, int itemNumber, object item, ITaskStep step, TaskDefinition task, TimeSpan duration)
 {
     _blockEnded?.Invoke(new BlockEndedEvent
     {
         Block      = block,
         ItemNumber = itemNumber,
         Item       = item,
         Step       = step,
         Task       = task,
         Duration   = duration,
         Timestamp  = DateTimeUtils.Now
     });
 }
Пример #8
0
        private void test(
            ResolverType resolverType,
            ITaskStep taskStep,
            ICollection <float> expectedProgressReports)
        {
            // Arrange
            var progressReports = new List <StepProgressedEvent>();

            var task   = new TaskDefinition(taskStep);
            var events = new TaskExecutionEvents(stepProgressed: progressReports.Add);

            // Act
            task.Execute(resolverType, events: events);

            // Assert
            progressReports.Should().HaveCount(expectedProgressReports.Count);
            progressReports.Select(x => x.Step.Name).Should().OnlyContain(x => x == taskStep.Name);
            progressReports.Select(x => x.Progress).Should().BeEquivalentTo(expectedProgressReports);
        }
Пример #9
0
        private void test(
            ResolverType resolverType,
            ITaskStep taskStep,
            ICollection <byte> expectedProgressReports)
        {
            // Arrange
            var progressReports = new List <TaskProgress>();

            var task = new TaskDefinition(taskStep);

            var progress = new SynchronousProgress <TaskProgress>(x => progressReports.Add(x));

            // Act
            task.Execute(resolverType, progress);

            // Assert
            progressReports.Select(x => x.StepName).Should().OnlyContain(x => x == taskStep.Name);
            progressReports.Select(x => x.ProgressPercentage).Should().BeEquivalentTo(expectedProgressReports);
        }
Пример #10
0
 public void OnPipelineEnded(TimeSpan totalInputMaterializationDuration, IReadOnlyDictionary <string, TimeSpan> totalBlockDurations, ITaskStep step, TaskDefinition task)
 {
     _pipelineEnded?.Invoke(new PipelineEndedEvent
     {
         TotalInputMaterializationDuration = totalInputMaterializationDuration,
         TotalBlockDurations = totalBlockDurations,
         Step      = step,
         Task      = task,
         Timestamp = DateTimeUtils.Now
     });
 }
Пример #11
0
 public void OnItemMaterialized(int itemNumber, object item, DateTimeOffset itemStartTimestamp, TimeSpan materializationDuration, ITaskStep step, TaskDefinition task)
 {
     _itemMaterialized?.Invoke(new ItemMaterializedEvent
     {
         ItemNumber              = itemNumber,
         Item                    = item,
         ItemStartTimestamp      = itemStartTimestamp.UtcDateTime,
         MaterializationDuration = materializationDuration,
         Step                    = step,
         Task                    = task,
         Timestamp               = DateTimeUtils.Now
     });
 }
Пример #12
0
        public void OnStepProgressed(int itemNumber, int expectedItemsCount, TimeSpan durationSoFar, ITaskStep step, TaskDefinition task)
        {
            var progress = itemNumber < expectedItemsCount
                ? (float)itemNumber / expectedItemsCount
                : 1f;

            OnStepProgressed(progress, durationSoFar, step, task);
        }