public ActionResult DeltaSolveTest() { var failed = false; var exceptionMessage = ""; var stackTrace = ""; var missingNodeIDs = new List <string>(); var graph = new Graph(); var dirtyModelNodes = HttpRequestStorage.DatabaseEntities.DirtyModelNodes.ToList(); var stopwatch = new Stopwatch(); stopwatch.Start(); try { NereidUtilities.DeltaSolve(out stackTrace, out missingNodeIDs, out graph, HttpRequestStorage.DatabaseEntities, HttpClient, dirtyModelNodes, true); } catch (NereidException <SolutionRequestObject, SolutionResponseObject> nexc) { var data = new SolutionSummary { NodesProcessed = graph.Nodes.Count(x => x.Results != null), MissingNodeIDs = missingNodeIDs, Failed = true, ExceptionMessage = nexc.Message, InnerExceptionStackTrace = nexc.InnerException?.StackTrace, FailingRequest = nexc.Request, FailureResponse = nexc.Response }; { return(Content(JsonConvert.SerializeObject(data))); } } catch (Exception exception) { failed = true; exceptionMessage = exception.Message; stackTrace = exception.StackTrace; } var deltaSolveTime = stopwatch.ElapsedMilliseconds; stopwatch.Stop(); return(Json( new SolutionSummary() { SolveTime = deltaSolveTime, NodesProcessed = graph.Nodes.Count(x => x.Results != null), MissingNodeIDs = missingNodeIDs, Failed = failed, ExceptionMessage = exceptionMessage, InnerExceptionStackTrace = stackTrace }, JsonRequestBehavior.AllowGet)); }
protected override void RunJobImplementation() { var dirtyModelNodes = DbContext.DirtyModelNodes.ToList(); NereidUtilities.DeltaSolve(out _, out _, out _, DbContext, HttpClient, dirtyModelNodes, true); NereidUtilities.DeltaSolve(out _, out _, out _, DbContext, HttpClient, dirtyModelNodes, false); DbContext.DirtyModelNodes.DeleteDirtyModelNode(dirtyModelNodes); DbContext.Database.CommandTimeout = 600; DbContext.SaveChangesWithNoAuditing(); }