public void Initialise(IConfigSource config)
 {
     m_processorJobEngine = new JobEngine(
         "ServiceThrottle", "ServiceThrottle");
     m_processorJobEngine.RequestProcessTimeoutOnStop = 31000; // many webrequests have 30s expire
     m_processorJobEngine.Start();
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            JobEngine engine = new JobEngine();

            engine.StartEngine();

            MonteCarloSimulationJob job2 = new MonteCarloSimulationJob();

            job2.Box = new SimulationBox();
            job2.Box.Objects.Add(new Circle());
            job2.Box.Objects.Add(new Circle()
            {
                Radius = 6
            });
            job2.Box.Objects.Add(new Circle());
            job2.Box.Objects.Add(new Circle());
            job2.Box.Objects.Add(new Circle());
            job2.Box.Objects.Add(new Circle());
            job2.Box.Objects.Add(new Circle());
            job2.Box.Objects.Add(new Circle());

            job2.ProgressEvent += Job1_ProgressEvent;


            engine.JobsToDo.Enqueue(job2);

            while (true)
            {
                Thread.Sleep(1000);
            }
        }
Beispiel #3
0
        public override void AddRegion(Scene scene)
        {
            base.AddRegion(scene);

            if (m_Enabled)
            {
                scene.RegisterModuleInterface <IUserAgentVerificationModule>(this);
                //scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject;

                m_incomingSceneObjectEngine
                    = new JobEngine(
                          string.Format("HG Incoming Scene Object Engine ({0})", scene.Name),
                          "HG INCOMING SCENE OBJECT ENGINE", 30000);

                StatsManager.RegisterStat(
                    new Stat(
                        "HGIncomingAttachmentsWaiting",
                        "Number of incoming attachments waiting for processing.",
                        "",
                        "",
                        "entitytransfer",
                        Name,
                        StatType.Pull,
                        MeasuresOfInterest.None,
                        stat => stat.Value = m_incomingSceneObjectEngine.JobsWaiting,
                        StatVerbosity.Debug));

                m_incomingSceneObjectEngine.Start();
            }
        }
 static void Main(string[] args)
 {
     JobEngine engine = new JobEngine(3, true);
     ProxyManager.Instance.ForceProxies = true;
     engine.AddJob(new ProxyTestJob("64.46.24.119"));
     engine.Start().Wait();
 }
Beispiel #5
0
        public Form1()
        {
            InitializeComponent();

            _engine = new JobEngine();
            _engine.StartEngine();
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            JobEngine engine = new JobEngine();

            engine.StartEngine();

            Task.Run(() =>
            {
                Console.WriteLine("Add first job");
                int job1 = engine.AddJob(new SampleJob(1), new SampleTrigger());

                Console.WriteLine("Add second job");
                int job2 = engine.AddJob(new SampleJob(2), new SampleTrigger());

                Thread.Sleep(200);
                engine.RemoveJob(job2);

                Thread.Sleep(200);
                engine.RemoveJob(job1);
            });

            Console.WriteLine("Press enter to end");
            Console.ReadLine();
            engine.StopEngine();
        }
Beispiel #7
0
        static void Main()
        {
            JobEngine.Start();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
        public void ShouldSuccessWhenRunEmptyWorkflow()
        {
            var inputs = new Dictionary <string, object>();
            var job    = JobEngine.Start("workflowpack.empty", inputs);
            var result = job.Task.Result;

            Assert.IsTrue(result.IsSuccess);
            Assert.AreEqual("empty", result.Result);
        }
Beispiel #9
0
        protected override void OnStart(string[] args)
        {
            _logger.Info("Starting DocViewerService");

            _listener = ServiceActivator.Get <MessageListener>();
            _listener.Start();

            _jobEngine = ServiceActivator.Get <JobEngine>();
            _jobEngine.Start();

            _logger.Info("DocViewerService is started.");
        }
Beispiel #10
0
        public void SetUp()
        {
            _mockJobRepository    = new Mock <IJobRepository>();
            _mockJobBag           = new Mock <IJobBag>();
            _mockHashJobProcessor = new Mock <IHashJobProcessor>();

            _classUnderTest = new JobEngine(
                _mockJobRepository.Object,
                _mockJobBag.Object,
                _mockHashJobProcessor.Object
                );
        }
        public void ShouldSuccessWhenRunAdd100Workflow()
        {
            var inputs = new Dictionary <string, object>()
            {
                { "num", 500 },
            };
            var job    = JobEngine.Start("workflowpack.add100", inputs);
            var result = job.Task.Result;

            Assert.IsTrue(result.IsSuccess);
            Assert.AreEqual(600L, result.Result);
        }
Beispiel #12
0
        public void ShouldInvokeSuccessWhenAddTwoArgument()
        {
            var inputs = new Dictionary <string, object>()
            {
                { "num1", 100 },
                { "num2", 200 }
            };
            var job    = JobEngine.Start("nodepack.add", inputs);
            var result = job.Task.Result;

            Assert.IsTrue(result.IsSuccess);
            Assert.AreEqual(300L, result.Result);
        }
Beispiel #13
0
        public void ShouldSuccessWhenHelloActionCalled()
        {
            var inputs = new Dictionary <string, object>()
            {
                { "name", "Bob" }
            };
            var job    = JobEngine.Start("advancepack.hello", inputs);
            var result = job.Task.Result;

            Assert.IsTrue(result.IsSuccess);
            Assert.AreEqual(null, result.Result);
            Assert.AreEqual("Hello,Bob", result.Logger.Trim());
        }
Beispiel #14
0
        public void ShouldInvokeDotnetVersionSuccess()
        {
            var inputs = new Dictionary <string, object>()
            {
            };
            var           job    = JobEngine.Start("apppack.dotversion", inputs);
            ExecuteResult result = job.Task.Result;

            Assert.IsTrue(result.IsSuccess);
            Assert.IsTrue(result.Result is AppResult);
            var appResult = result.Result as AppResult;

            Assert.AreEqual(0, appResult.ExitCode);
        }
Beispiel #15
0
        public void Close()
        {
            int n = Interlocked.Decrement(ref m_numberScenes);

            if (n == 0)
            {
                lock (m_mainLock)
                {
                    if (m_jobEngine != null)
                    {
                        m_jobEngine.Stop();
                        m_jobEngine = null;
                    }
                }
            }
        }
Beispiel #16
0
        public void ShouldSuccessWhenMergeComplexObject(string mergeActionName)
        {
            var inputs = new Dictionary <string, object>()
            {
                { "persons", new [] {
                      new { id = 1001, name = "zhangsan" }
                  } },

                { "other", new { id = 1002, name = "lisi" } }
            };
            var job    = JobEngine.Start(mergeActionName, inputs);
            var result = job.Task.Result;

            Assert.IsTrue(result.IsSuccess);
            Assert.AreEqual("[{\"id\":1001,\"name\":\"zhangsan\"},{\"id\":1002,\"name\":\"lisi\"}]", ToJsonString(result.Result));
        }
Beispiel #17
0
        public void ShouldInvokeHelloSuccess()
        {
            var inputs = new Dictionary <string, object>()
            {
                ["name"] = "zhangsan"
            };
            var     job    = JobEngine.Start(IsWindows ? "apppack.hello_win" : "apppack.hello", inputs);
            dynamic result = job.Task.Result;

            Assert.IsTrue(result.IsSuccess);
            Assert.IsTrue(result.Result is AppResult);
            var appResult = result.Result as AppResult;

            Assert.AreEqual(0, appResult.ExitCode);
            Assert.IsTrue(appResult.Output.Contains("hello,zhangsan"));
        }
Beispiel #18
0
        public void ShouldSuccessWhenConcatLargeStrings()
        {
            var arg1   = string.Join("\n", Enumerable.Range(1, 1000000).Select(p => $"{p:d8}"));
            var arg2   = string.Join("\n", Enumerable.Range(100000000, 1000000).Select(p => $"{p:d8}"));
            var inputs = new Dictionary <string, object>()
            {
                { "a", arg1 },
                { "b", arg2 }
            };
            var job    = JobEngine.Start("nodepack.concat", inputs);
            var result = job.Task.Result;

            Assert.IsTrue(result.IsSuccess);
            var resultText = result.Result as string;

            Assert.AreEqual(arg1.Length + arg2.Length, resultText.Length);
        }
Beispiel #19
0
        public int Run()
        {
            var serializeService = JobHost.Instance.GetRequiredService <ISerializeService>();
            var args             = serializeService.Deserialize <Dictionary <string, object> >(JsonArgs);
            var startTime        = DateTimeOffset.UtcNow;
            var job    = JobEngine.Start(ActionName, args);
            var result = job.Task.Result;

            if (result.IsSuccess)
            {
                WriteSuccessResult(startTime, result.Result);
            }
            else
            {
                WriteException(startTime, result.ExecuteError);
            }
            return(0);
        }
Beispiel #20
0
        private void runSimulationButton_Click(object sender, EventArgs e)
        {
            //var widthHeight = 100;

            //var box = new SimulationBox(widthHeight, widthHeight, widthHeight);

            //var radius = 10;
            //int N = 10;

            //double x = 0;
            //double y = 0;

            //for (int i = 0; i < N; i++)
            //{
            //    box.MonteCarloObjects.Add(new CircleWithPotential(x,y, radius));
            //    x += 2*radius;
            //    if (x > widthHeight)
            //    {
            //        x = 0;
            //        y += 2*radius;
            //    }
            //}

            //radius = 4;
            //for (int i = 0; i < 2*N; i++)
            //{
            //    box.MonteCarloObjects.Add(new CircleWithPotential(x, y, radius));
            //    x += 2 * radius;
            //    if (x > widthHeight)
            //    {
            //        x = 0;
            //        y += 2 * radius;
            //    }
            //}

            UpdateMonteCarloPlot(_currentJob.Box);

            _currentJob.ProgressEvent             += NewJob_ProgressEvent;
            _currentJob.StartEvent                += NewJob_StartEvent;
            _currentJob.StopEvent                 += NewJob_StopEvent;
            _currentJob.SimulationBoxChangedEvent += NewMonteCarloJob_SimulationBoxChangedEvent;
            JobEngine.EnqueueNewJob(_currentJob);
        }
Beispiel #21
0
        public void Initialise(IConfigSource config)
        {
            lock (m_mainLock)
            {
                // shared items
                if (m_jobEngine == null)
                {
                    m_proxyurl     = config.Configs["Startup"].GetString("HttpProxy");
                    m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");

                    HttpRequestClass.HttpBodyMaxLenMAX = config.Configs["Network"].GetInt("HttpBodyMaxLenMAX", 16384);

                    m_outboundUrlFilter = new OutboundUrlFilter("Script HTTP request module", config);

                    int     maxThreads = 8;
                    IConfig httpConfig = config.Configs["ScriptsHttpRequestModule"];
                    if (httpConfig != null)
                    {
                        maxThreads        = httpConfig.GetInt("MaxPoolThreads", maxThreads);
                        m_primBurst       = httpConfig.GetFloat("PrimRequestsBurst", m_primBurst);
                        m_primPerSec      = httpConfig.GetFloat("PrimRequestsPerSec", m_primPerSec);
                        m_primOwnerBurst  = httpConfig.GetFloat("PrimOwnerRequestsBurst", m_primOwnerBurst);
                        m_primOwnerPerSec = httpConfig.GetFloat("PrimOwnerRequestsPerSec", m_primOwnerPerSec);
                        m_httpTimeout     = httpConfig.GetInt("RequestsTimeOut", m_httpTimeout);
                        if (m_httpTimeout > 60000)
                        {
                            m_httpTimeout = 60000;
                        }
                        else if (m_httpTimeout < 200)
                        {
                            m_httpTimeout = 200;
                        }
                    }

                    m_pendingRequests = new Dictionary <UUID, HttpRequestClass>();

                    m_jobEngine = new JobEngine("ScriptsHttpReq", "ScriptsHttpReq", 2000, maxThreads);
                    m_jobEngine.Start();
                }
            }
        }
Beispiel #22
0
        public void ShouldSuccessWhenMergeComplexObject()
        {
            var inputs = new Dictionary <string, object>()
            {
                { "persons", new [] {
                      new { id = 1001, name = "zhangsan" }
                  } },

                { "other", new { id = 1002, name = "lisi" } }
            };
            var job    = JobEngine.Start("advancepack.merge", inputs);
            var result = job.Task.Result;

            Assert.IsTrue(result.IsSuccess);
            var fullResult = JsonConvert.SerializeObject(result.Result, Formatting.None, new JsonSerializerSettings
            {
                ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
            });

            Assert.AreEqual("[{\"id\":1001,\"name\":\"zhangsan\"},{\"id\":1002,\"name\":\"lisi\"}]", fullResult);
        }
Beispiel #23
0
        static void Main(string[] args)
        {
            var setting = new JobSetting();

            setting.QueueName             = "queue1";
            setting.QueueConnectionString = "JobCenter";
            setting.SystemId           = "JobTest";
            setting.ZkConnectionString = "zkconn";
            setting.RedisConnection    = "RedisConn";
            setting.RedisDb            = 1;
            var engine = new JobEngine <TestTask1>(setting, new Test1Job(), log: new Log());
            var zkconn = ConfigurationManager.AppSettings["zkconn"];

            SlaveUtil.Start(zkconn, 2, "JobTest", new Log());
            //setting.QueueName = "queue2";
            //var engine2= new JobEngine<TestTask1>(setting, new Test1Job());
            do
            {
                engine.Execute().Wait();
                //engine2.Execute();
                Task.Delay(5000).Wait();
            } while (true);
        }
Beispiel #24
0
        static void Main()
        {
            //Start DB Connection
            Database.init();
            Database.AddLog("Starting Up");

            //Is this the first run?
            if (Database.GetSetting("FirstRun", "YAMS") != "true")
            {
                YAMS.Util.FirstRun();
            }
            Database.SaveSetting("AdminPassword", "password");

            SqlCeDataReader readerServers = YAMS.Database.GetServers();

            while (readerServers.Read())
            {
                Database.AddLog("Starting Server " + readerServers["ServerID"]);
                MCServer myServer = new MCServer(Convert.ToInt32(readerServers["ServerID"]));
                if (Convert.ToBoolean(readerServers["ServerAutostart"]))
                {
                    myServer.Start();
                }
                Core.Servers.Add(Convert.ToInt32(readerServers["ServerID"]), myServer);
            }

            //Start job engine
            JobEngine.Init();

            //Start Webserver
            WebServer.Init();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmMain());
        }
 public ScheduleEngine()
 {
     m_jobEngine = JobEngine.Instance;
     m_logger    = LogProvider.Instance.Logger;
 }
 public ScheduleEngine(JobEngine jobEngine, ILogger logger)
 {
     m_jobEngine = jobEngine;
     m_logger    = logger;
 }
Beispiel #27
0
 public void Initialise(IConfigSource config)
 {
     m_processorJobEngine = new JobEngine("ServiceThrottle", "ServiceThrottle", 5000, 2);
     m_processorJobEngine.Start();
 }