Ejemplo n.º 1
0
        /*
         * consumer stub throughput ratings
                10000 at 940 ms. tp 1 at ,09ms :: internal module throughput (same appdomain)
                10000 at 3722 ms. tp 1 at ,37 :: external module throughput (cross appdomain)
         * 
         */
        public Broker(RestartApplication restartApp = null, RestartApplication resetBroker = null)
        {
            this.restartApp = restartApp;
            this.resetBroker = resetBroker;

            logger.Debug("intitialising broker");
            // logger for modules only
            ModulesLogger = new TaskBroker.Logger.CommonTape(new Logger.LoggerEndpoint[]{
                new Logger.ConsoleEndpoint()
            });

            ClearConfiguration();

            Statistics = new StatHub();
            Scheduler = new TaskScheduler.ThreadPool();
            AssemblyHolder = new Assemblys.AssemblyPackages();

            MaintenanceTasks = new List<PlanItem>()
            {
                // include statistic flush task
                new PlanItem(){
                     intervalType = IntervalType.intervalSeconds,
                     intervalValue = 15,
                     NameAndDescription="statistic maintenance task",
                     JobEntry = (ThreadContext ti, PlanItem pi)=>{ Statistics.FlushRetairedChunks(); return 1;
                     }
                },
                // 
                //new PlanItem(){
                //     intervalType = IntervalType.intervalSeconds,
                //     intervalValue = 30,
                //     NameAndDescription="assemblies maintenance task",
                //     JobEntry = (ThreadContext ti, PlanItem pi)=>
                //     { 
                //         AssemblyHolder.assemblySources.FetchAllIfRequired();
                //         AssemblyHolder.assemblySources.BuildAllIfRequired();
                //         AssemblyHolder.assemblySources.UpdateAllIfRequired();
                //     }
                //}

                // TODO:
                // performance tune
                // by channel level growing -> increment tasks for channel -> increment working threads
                // check for throughput if doesn't change -> rollback to default execution plan
                //new PlanItem(){
                //     intervalType = IntervalType.intervalSeconds,
                //     intervalValue = 10,
                //     NameAndDescription="channel throughput tune",
                //     planEntry = (ThreadItem ti, PlanItem pi)=>{  }
                //}
                // with 10sec interval->update quilifier
                // with 30sec with quilifier data do recommendations from recommedationsHub
            };

            Modules = new ModHolder(this);

            QueueInterfaces = new QueueClassificator();

            Configurations = new ConfigurationDepot();
        }
Ejemplo n.º 2
0
        public void Run(ManualResetEvent signal, bool customDomain = false)
        {
            if (customDomain)
            {
                // reinitiate tape within domain
                TaskBroker.Logger.CommonTape tape = new TaskBroker.Logger.CommonTape(
                    new TaskBroker.Logger.LoggerEndpoint[] {
                    new TaskBroker.Logger.ConsoleEndpoint(),
                    new TaskBroker.Logger.FileEndpoint("log.txt", true)
                });

                TaskUniversum.ModApi.ScopeLogger.RegisterCommonTape(tape);
            }
            //if (!AttachConsole(-1))
            ////if (FreeConsole())
            //{
            //    AllocConsole();
            //    logger.Warning("consoleattached");
            //}
            broker = new Broker(Restart, Reset);

            BsonBenchService.ModProducer amqm = new BsonBenchService.ModProducer();
            QueueService.ModProducer     m    = new QueueService.ModProducer();// todo: force loading local dep's
            BenchModules.ModConsumer     cons = new BenchModules.ModConsumer();

            //m.Description = "";
            //cons.Description = "";

            broker.RevokeBroker(true);
            this.Signal = signal;
            exportConfiguration();
        }
Ejemplo n.º 3
0
        public void Run(ManualResetEvent signal, bool benchConf, bool customDomain)
        {
            if (customDomain)
            {
                // reinitiate tape within domain
                TaskBroker.Logger.CommonTape tape = new TaskBroker.Logger.CommonTape(
                    new TaskBroker.Logger.LoggerEndpoint[]{
                    new TaskBroker.Logger.ConsoleEndpoint(),
                    new TaskBroker.Logger.FileEndpoint("log.txt", true)
                });

                TaskUniversum.ModApi.ScopeLogger.RegisterCommonTape(tape);
            }
            //if (!AttachConsole(-1))
            ////if (FreeConsole())
            //{
            //    AllocConsole();
            //    logger.Warning("consoleattached");
            //}
            broker = new Broker(Restart, Reset);

            //BsonBenchService.ModProducer amqm = new BsonBenchService.ModProducer();
            QueueService.ModProducer m = new QueueService.ModProducer();// todo: force loading local dep's
            //BenchModules.ModConsumer cons = new BenchModules.ModConsumer();
            EmailConsumer.ModConsumer mc = new EmailConsumer.ModConsumer();

            //m.Description = "";
            //cons.Description = "";

            broker.RevokeBroker(benchConf, true, false);
            this.Signal = signal;
            exportConfiguration();
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            TaskBroker.Logger.CommonTape tape = new TaskBroker.Logger.CommonTape(new TaskBroker.Logger.LoggerEndpoint[] {
                new TaskBroker.Logger.ConsoleEndpoint(),
                new TaskBroker.Logger.FileEndpoint("log.txt")
            });

            TaskUniversum.ModApi.ScopeLogger.RegisterCommonTape(tape);
            bool benchConfiguration = true;// Array.IndexOf(args, "benchTasks") >= 0;// for plan or other params depends on tasks calculation

            if (Array.IndexOf(args, "inline") >= 0 || System.Diagnostics.Debugger.IsAttached)
            {
                ManualResetEvent  mre = new ManualResetEvent(false);
                BrokerApplication ba  = new BrokerApplication();
                ba.Run(mre, benchConfiguration, false);
                mre.WaitOne();
            }
            else
            {
                ApplicationKeeper.AppdomainLoop(benchConfiguration);
            }
            Console.WriteLine("! Application MAIN EXIT.");
            Console.ReadLine();
            return;
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            TaskBroker.Logger.CommonTape tape = new TaskBroker.Logger.CommonTape(new TaskBroker.Logger.LoggerEndpoint[]{
                    new TaskBroker.Logger.ConsoleEndpoint(),
                    new TaskBroker.Logger.FileEndpoint("log.txt")
                });

            TaskUniversum.ModApi.ScopeLogger.RegisterCommonTape(tape);
            bool benchConfiguration = false;// Array.IndexOf(args, "benchTasks") >= 0;// for plan or other params depends on tasks calculation

            if (Array.IndexOf(args, "inline") >= 0 || System.Diagnostics.Debugger.IsAttached)
            {
                ManualResetEvent mre = new ManualResetEvent(false);
                BrokerApplication ba = new BrokerApplication();
                ba.Run(mre, benchConfiguration, false);
                mre.WaitOne();
            }
            else
            {
                ApplicationKeeper.AppdomainLoop(benchConfiguration);
            }
            Console.WriteLine("! Application MAIN EXIT.");
            Console.ReadLine();
            return;
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            TaskBroker.Logger.CommonTape tape = new TaskBroker.Logger.CommonTape(new TaskBroker.Logger.LoggerEndpoint[] {
                new TaskBroker.Logger.ConsoleEndpoint(),
                new TaskBroker.Logger.FileEndpoint("log.txt")
            });

            TaskUniversum.ModApi.ScopeLogger.RegisterCommonTape(tape);

            if (System.Diagnostics.Debugger.IsAttached)
            {
                ManualResetEvent  mre = new ManualResetEvent(false);
                BrokerApplication ba  = new BrokerApplication();
                ba.Run(mre);
                mre.WaitOne();
            }
            else
            {
                ApplicationKeeper.AppdomainLoop();
            }
            Console.WriteLine("! Application MAIN EXIT.");
            Console.ReadLine();
            return;
        }