コード例 #1
0
 public TaskQuerier(Runner.SubtaskRunner runner, ITaskExecutor[] tasks, Utils.Logger logger, Profiler.Timeline profiler = null)
 {
     this.runner        = runner;
     this.tasks         = tasks;
     this.logger        = logger;
     this.profilerTrack = profiler?.CreateTrack <Profiler.TimelineTrack>(GetType().Name);
 }
コード例 #2
0
        public TaskManager(Runner.SubtaskRunner runner, ITask[] tasks, Utils.Logger logger = null, Profiler.Timeline profiler = null)
        {
            this.runner = runner;

            //Create executors for all the tasks
            ITaskExecutor[] executors = new ITaskExecutor[tasks.Length];
            for (int i = 0; i < tasks.Length; i++)
            {
                executors[i] = tasks[i].CreateExecutor(runner, logger, profiler);
            }

            //Create a querier for querying all the executors for work
            querier = new TaskQuerier(runner, executors, logger, profiler);

            //Setup a chain between the executors, starting from the querier
            for (int i = 0; i < executors.Length; i++)
            {
                switch (i)
                {
                case 0: querier.Completed += executors[i].RunSubtasks;  break;

                default: executors[i - 1].Completed += executors[i].RunSubtasks; break;
                }
            }
            if (executors.Length > 0)
            {
                executors[executors.Length - 1].Completed += LastTaskCompleted;
            }
            else
            {
                querier.Completed += LastTaskCompleted;
            }
        }
コード例 #3
0
 public GroupExecutor(
     ITask[] tasks,
     Runner.SubtaskRunner runner,
     Utils.Logger logger        = null,
     Profiler.Timeline profiler = null)
 {
     executors = new ITaskExecutor[tasks.Length];
     for (int i = 0; i < tasks.Length; i++)
     {
         executors[i] = tasks[i].CreateExecutor(runner, logger, profiler);
     }
 }
コード例 #4
0
 public SubtaskExecutor(
     IProvider provider,
     Runner.SubtaskRunner runner,
     int batchSize,
     Utils.Logger logger        = null,
     Profiler.Timeline profiler = null)
 {
     this.provider      = provider;
     this.runner        = runner;
     this.batchSize     = batchSize;
     this.logger        = logger;
     this.profilerTrack = profiler?.CreateTrack <Profiler.TimelineTrack>(provider.GetType().Name);
 }