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(); }
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)); }
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); }
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); }
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(); } } }
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); }
public void Initialise(IConfigSource config) { m_processorJobEngine = new JobEngine("ServiceThrottle", "ServiceThrottle", 5000, 2); m_processorJobEngine.Start(); }