Esempio n. 1
0
 private void OnCohortCreatedSuccessfully(IPipelineRunner runner, ICohortCreationRequest request)
 {
     if (request.CohortCreatedIfAny != null)
     {
         Publish(request.CohortCreatedIfAny);
     }
 }
Esempio n. 2
0
        /// <summary>
        ///     Initializes the context checker
        /// </summary>
        /// <param name="pageModeAccess">an IPageModeAccess implementation</param>
        /// <param name="pipelineRunner">a pipeline runner</param>
        /// <param name="settings">settings</param>
        public SelectBaseLayoutContextChecker(IPageModeAccess pageModeAccess, IPipelineRunner pipelineRunner)
        {
            Assert.ArgumentNotNull(pageModeAccess, "pageModeAccess");
            Assert.ArgumentNotNull(pipelineRunner, "pipelineRunner");

            _pageModeAccess = pageModeAccess;
            _pipelineRunner = pipelineRunner;
        }
        /// <summary>
        ///     Initializes the context checker
        /// </summary>
        /// <param name="pageModeAccess">an IPageModeAccess implementation</param>
        /// <param name="pipelineRunner">a pipeline runner</param>
        /// <param name="settings">settings</param>
        public SelectBaseLayoutContextChecker(IPageModeAccess pageModeAccess, IPipelineRunner pipelineRunner)
        {
            Assert.ArgumentNotNull(pageModeAccess, "pageModeAccess");
            Assert.ArgumentNotNull(pipelineRunner, "pipelineRunner");

            _pageModeAccess = pageModeAccess;
            _pipelineRunner = pipelineRunner;
        }
 public static Task Run(this IPipeline pipeline, object args, IPipelineRunner runner = null)
 {
     runner = runner ?? Runner.Instance;
     if (!(args is Bag bag))
     {
         bag = new Bag(args);
     }
     return(runner.Run(pipeline, bag));
 }
        protected void PostItemsAndPrintProcessedWithDefaultConditionToStop <TInput, TOutput>(
            IPipelineRunner <TInput, TOutput> pipelineRunner,
            IEnumerable <TInput> items)
        {
            var processedCount = 0;

            // Post items and retrieve WaitHandle
            var waitHandle = (this, pipelineRunner)
                             .PostItemsAndPrintProcessed(items, x => StopExecutionConditionByTotalProcessed(ref processedCount));

            waitHandle.WaitOne();
        }
        /// <summary>
        /// The constructor that accepts a <paramref name="pipeline"/> hold to be used when <see cref="Run{TContext}(TContext)"/> method is used
        /// and <see cref="runner"/> that runs a pipeline.
        /// </summary>
        /// <param name="pipeline">
        /// The pipeline that is hold to be executed later.
        /// </param>
        /// <param name="runner">
        /// The pipeline runner that is hold to be used when <see cref="Run{TContext}(TContext)"/> method is used.
        /// </param>
        public PipelineExecutor(IPipeline pipeline, IPipelineRunner runner)
        {
            if (pipeline.HasNoValue())
            {
                throw new ArgumentNullException(nameof(pipeline), PipelineIsNotSetError);
            }

            if (runner.HasNoValue())
            {
                throw new ArgumentNullException(nameof(runner), RunnerIsNotSetError);
            }

            Pipeline = pipeline;
            Runner   = runner;
        }
Esempio n. 7
0
        public static WaitHandle PostItemsAndPrintProcessed <TInput, TOutput>(
            this IPipelineRunner <TInput, TOutput> pipelineRunner,
            IEnumerable <TInput> items,
            PipelineTestBase pipelineTest,
            Func <TOutput, bool> stopExecutionCondition)
        {
            var cancellationTokenSource = new CancellationTokenSource();
            // Start timer
            var stopWatch = pipelineTest.StartTimer();

            // Setup cancellationToken for finalize Pipeline execution
            pipelineRunner.SetupCancellationToken(cancellationTokenSource.Token);

            // Subscribe for processed items
            pipelineRunner.ItemReceivedEvent +=
                x => PipelineRunner_ItemReceivedEvent(x, pipelineTest, cancellationTokenSource, stopExecutionCondition, stopWatch);

            // Post items
            pipelineRunner.Post(items);

            // Return WaitHandle
            return(cancellationTokenSource.Token.WaitHandle);
        }
 /// <summary>
 /// Converts a pipeline to a simple processor.
 /// This way pipelines may be nested and reused in other pipelines.
 /// </summary>
 /// <param name="pipeline">
 /// The pipeline to be converted to a processor.
 /// </param>
 /// <param name="runner">
 /// The runner which will be used to run the wrapped pipeline.
 /// </param>
 /// <returns>
 /// The processor that simply wraps a call to pipeline with a <paramref name="runner"/>
 /// or if it is not specified, with a static
 /// instance of <see cref="Runner"/> - <see cref="Runner.Instance"/>.
 /// </returns>
 public static IProcessor ToProcessor(this IPipeline pipeline, IPipelineRunner runner)
 {
     return(Processor.From(async args => await pipeline.Run(args, runner).ConfigureAwait(false)));
 }
Esempio n. 9
0
 public PipelineRunnerHandler(IPipelineRunner p_PipelineRunner)
 {
     m_PipelineRunner = p_PipelineRunner;
 }
 public PipelineService(IPipelineRepository repository, IPipelineTaskService taskService, IPipelineRunner runner)
 {
     _repository  = repository;
     _taskService = taskService;
     _runner      = runner;
 }
        public static async Task <TContext> Run <TContext>(this TContext context, IPipeline pipeline, IPipelineRunner runner = null) where TContext : Bag
        {
            await pipeline.Run(context, runner).ConfigureAwait(false);

            return(context);
        }
 public SelectBaseLayoutDialogResultProcessor(IPipelineRunner pipelineRunner)
 {
     Assert.ArgumentNotNull(pipelineRunner, "pipelineRunner");
     _pipelineRunner = pipelineRunner;
 }
Esempio n. 13
0
 public SelectBaseLayoutDialogLocator(IPipelineRunner pipelineRunner)
 {
     Assert.ArgumentNotNull(pipelineRunner, "pipelineRunner");
     _pipelineRunner = pipelineRunner;
 }
 public SelectBaseLayoutDialogLocator(IPipelineRunner pipelineRunner)
 {
     Assert.ArgumentNotNull(pipelineRunner, "pipelineRunner");
     _pipelineRunner = pipelineRunner;
 }
Esempio n. 15
0
 public NotifierPipelineService(IPipelineRepository repository, IPipelineTaskService taskService, IPipelineRunner runner, IPipelineHubNotifier pipelineNotifier)
     : base(repository, taskService, runner)
 {
     _notifier = pipelineNotifier;
 }
        /// <summary>
        /// Runs a pipeline with <paramref name="args"/> context
        /// and <paramref name="runner"/>, and then returns a result.
        /// </summary>
        /// <typeparam name="TResult">
        /// The type of the result that is supposed to be returned from the method.
        /// </typeparam>
        /// <param name="pipeline">
        /// The pipeline to be executed. Each processor of this pipeline
        /// will be executed by <see cref="IPipelineRunner.Run{TArgs}"/>
        /// method with <paramref name="args"/> passed.
        /// </param>
        /// <param name="args">
        /// The context which will be passed to each processor of
        /// the pipeline during execution.
        /// </param>
        /// <param name="runner">
        /// The runner which will be used to run the wrapped pipeline.
        /// </param>
        /// <returns>
        /// The task object indicating the status of an executing pipeline.
        /// </returns>
        public static async Task <TResult> Run <TResult>(this IPipeline pipeline, Bag args = null, IPipelineRunner runner = null) where TResult : class
        {
            args = args ?? new Bag();
            await pipeline.Run(args, runner).ConfigureAwait(false);

            return(args.ResultOrThrow <TResult>());
        }
 public static TResult RunSync <TResult>(this IPipeline pipeline, object args = null, IPipelineRunner runner = null) where TResult : class
 {
     return(pipeline.Run <TResult>(args, runner).Result);
 }
 public static void RunSync(this IPipeline pipeline, object args, IPipelineRunner runner = null)
 {
     pipeline.Run(args, runner).Wait();
 }
        public static async Task <TResult> Run <TResult>(this IPipeline pipeline, object args = null, IPipelineRunner runner = null) where TResult : class
        {
            if (!(args is Bag bag))
            {
                bag = new Bag(args);
            }
            await pipeline.Run(bag, runner).ConfigureAwait(false);

            return(bag.ResultOrThrow <TResult>());
        }
 public SelectBaseLayoutDialogResultProcessor(IPipelineRunner pipelineRunner)
 {
     Assert.ArgumentNotNull(pipelineRunner, "pipelineRunner");
     _pipelineRunner = pipelineRunner;
 }
 /// <summary>
 /// Runs a pipeline with <paramref name="args"/> context
 /// and <paramref name="runner"/>.
 /// </summary>
 /// <typeparam name="TContext">
 /// The type of the context that is used during pipeline execution.
 /// </typeparam>
 /// <param name="pipeline">
 /// The pipeline to be executed. Each processor of this pipeline
 /// will be executed by <see cref="IPipelineRunner.Run{TArgs}"/>
 /// method with <paramref name="args"/> passed.
 /// </param>
 /// <param name="args">
 /// The context which will be passed to each processor of
 /// the pipeline during execution.
 /// </param>
 /// <param name="runner">
 /// The runner which will be used to run the wrapped pipeline.
 /// </param>
 /// <returns>
 /// The task object indicating the status of an executing pipeline.
 /// </returns>
 public static Task Run(this IPipeline pipeline, Bag args = null, IPipelineRunner runner = null)
 {
     runner = runner ?? Runner.Instance;
     args   = args ?? new Bag();
     return(runner.Run(pipeline, args));
 }