public void BuildExperimentsSummary() { var domain = new Z3Domain(); var benchmarkResults1 = Enumerable.Concat(BuildResults(1, 3, "a"), BuildResults(1, 2, "b")); var catSummary1 = ExperimentSummary.Build(benchmarkResults1, domain); Assert.AreEqual(2, catSummary1.Count, "2 categories"); AssertCatSummary(3, catSummary1["a"]); AssertCatSummary(2, catSummary1["b"]); Table table0 = Table.Empty; var experimentSummary1 = new ExperimentSummary(1, DateTimeOffset.Now, catSummary1); Table table1 = ExperimentSummaryStorage.AppendOrReplace(table0, experimentSummary1); var benchmarkResults2 = Enumerable.Concat(BuildResults(1, 3, "b"), BuildResults(1, 2, "c")); var catSummary2 = ExperimentSummary.Build(benchmarkResults2, domain); var experimentSummary2 = new ExperimentSummary(2, DateTimeOffset.Now, catSummary2); Table table2 = ExperimentSummaryStorage.AppendOrReplace(table1, experimentSummary2); Assert.IsTrue(table2.Count >= 2 + 3 * (5 + 8), "Number of columns"); Assert.AreEqual(2, table2.RowsCount, "Number of rows"); AreEqualArrays(new[] { "1", "2" }, table2["ID"].Rows.AsString.ToArray()); AreEqualArrays(new[] { "3", "" }, table2["a|SAT"].Rows.AsString.ToArray()); AreEqualArrays(new[] { "2", "3" }, table2["b|SAT"].Rows.AsString.ToArray()); AreEqualArrays(new[] { "", "2" }, table2["c|SAT"].Rows.AsString.ToArray()); }
public ExperimentViewModel(ExperimentSummary summary, bool isFinished, DateTime submitted, TimeSpan timeout) { this.summary = summary; this.IsFinished = isFinished; this.SubmissionTime = submitted; this.Timeout = timeout; }
public async Task SendReport(AzureSummaryManager manager, ExperimentSummary expSummary, ExperimentSummary refSummary, string recipientsStr, string linkPage) { int expId = expSummary.Id; int?refId = refSummary != null ? (int?)refSummary.Id : null; var submissionTime = expSummary.Date; var statusSummary = await manager.GetStatusSummary(expId, refId); var alerts = new ExperimentAlerts(expSummary, statusSummary, linkPage); if (alerts != null && alerts[""].Count > 0 && alerts[""].Level != AlertLevel.None) { Trace.WriteLine("Building summary HTML report..."); string new_report = "<body>"; new_report += "<h1>Z3 Nightly Alert Report</h1>"; new_report += "<p>This are alerts for <a href=" + linkPage + "?job=" + expId + " style='text-decoration:none'>job #" + expId + "</a> (submitted " + submissionTime + ").</p>"; if (alerts[""].Count == 0) { new_report += "<p>"; new_report += "<img src='cid:ok'/> "; new_report += "<font color=Green>All is well everywhere!</font>"; new_report += "</p>"; } else { new_report += "<h2>Alert Summary</h2>"; new_report += createReportTable("", alerts); //detailed report new_report += "<h2>Detailed alerts</h2>"; foreach (string cat in alerts.Categories) { if (cat != "" && alerts[cat].Count > 0) { new_report += "<h3><a href='" + linkPage + "?job=" + expId + "&cat=" + cat + "' style='text-decoration:none'>" + cat + "</a></h3>"; new_report += createReportTable(cat, alerts); } } new_report += "<p>For more information please see the <a href='" + linkPage + "' style='text-decoration:none'>Z3 Nightly Webpage</a>.</p>"; } new_report += "</body>"; Trace.WriteLine("Send emails with report..."); try { var recipients = recipientsStr.Split(';'); foreach (string recipient in recipients) { Send(recipient, "Z3 Alerts", new_report, true); } } catch (Exception ex) { Trace.WriteLine("Failed to send email: " + ex.Message); } } }
public ShortCircuitResult ShortCircuit(ExperimentSummary experimentSummary, string userId) { var cookie = Context.Request.Cookies["ABsoluteMaybe-ShortCircuit"]; return(cookie != null && cookie.Values.AllKeys.Contains(experimentSummary.Name) ? new ShortCircuitResult(true, cookie.Values[experimentSummary.Name]) : ShortCircuitResult.False); }
public List <ExperimentSummary> GetExperimentStatuses() { var summaries = new Dictionary <int, ExperimentSummary>(); using (DbCommand cmd = _db.GetSqlStringCommand(DashboardQueries.GetExperimentStatuses)) { using (IDataReader reader = _db.ExecuteReader(cmd)) { while (reader.Read()) { var experimentid = Convert.ToInt32(reader["Experiment Id"]); if (!summaries.ContainsKey(experimentid)) { var newSummary = new ExperimentSummary(); newSummary.Name = reader["Experiment Name"].ToString(); summaries.Add(experimentid, newSummary); } var summary = summaries[experimentid]; var hypothesisId = Convert.ToInt32(reader["Hypothesis Id"]); if (!summary.Hypotheses.ContainsKey(hypothesisId)) { var newHyp = new HypothesisSummary(); newHyp.Name = reader["Hypothesis Name"].ToString(); newHyp.Visitors = Convert.ToInt32(reader["Visitors"]); summary.Hypotheses.Add(hypothesisId, newHyp); } var hypothesis = summary.Hypotheses[hypothesisId]; var goalName = reader["Goal Name"].ToString(); if (!summary.Goals.ContainsKey(goalName)) { GoalSummary goalSummary = new GoalSummary(); goalSummary.Name = goalName; goalSummary.GoalValue = Convert.ToDouble(reader["Goal Value"]); summary.Goals.Add(goalName, goalSummary); } var conversions = Convert.ToInt32(reader["Conversions"]); var convValue = Convert.ToDouble(reader["Conversion Value"]); hypothesis.GoalConversions.Add(goalName, conversions); hypothesis.GoalValues.Add(goalName, convValue); } } } return(summaries.Values.ToList()); }
private static AlertSet FindCategoryAlerts(ExperimentSummary summary, ExperimentStatusSummary statusSummary, string category) { AlertSet res = new AlertSet(); // Check for bugs != 0; This is critical. int bugs = category == "" ? summary.Overall.Bugs : summary.CategorySummary[category].Bugs; if (bugs != 0) { res.Add(AlertLevel.Critical, string.Format("There {0} {1} bug{2}.", bugs == 1 ? "is" : "are", bugs, bugs == 1 ? "" : "s")); } // Infrastructure errors; this is just an information. int ierrs = category == "" ? summary.Overall.InfrastructureErrors : summary.CategorySummary[category].InfrastructureErrors; if (ierrs != 0) { res.Add(AlertLevel.None, string.Format("There {0} {1} infrastructure error{2}.", ierrs == 1 ? "is" : "are", ierrs, ierrs == 1 ? "" : "s")); } // Check for errors != 0; this is just a warning. int errors = category == "" ? summary.Overall.Errors : summary.CategorySummary[category].Errors; if (errors != 0) { res.Add(AlertLevel.Warning, string.Format("There {0} {1} error{2}.", errors == 1 ? "is" : "are", errors, errors == 1 ? "" : "s")); } // See whether something got slower. int dippers = GetStatuses(statusSummary.DippersByCategory, category).Count; if (dippers != 0) { res.Add(AlertLevel.None, string.Format("There {0} {1} benchmark{2} that show{3} a dip in performance.", dippers == 1 ? "is" : "are", dippers, dippers == 1 ? "" : "s", dippers == 1 ? "s" : "")); } return(res); }
public ExperimentAlerts(ExperimentSummary summary, ExperimentStatusSummary statusSummary, string _linkPage) { alertSets = new Dictionary <string, AlertSet>(); var overall = new AlertSet(); foreach (var catSum in summary.CategorySummary) { if (catSum.Key != "") { var set = FindCategoryAlerts(summary, statusSummary, catSum.Key); alertSets.Add(catSum.Key, set); if (set.Messages.Count != 0) { overall.Add(set.Level, string.Format("{0} alert{1} in <a href='" + _linkPage + "?cat={2}' style='text-decoration:none;'>{2}</a>.", set.Count, set.Count == 1 ? "" : "s", catSum.Key)); } } } alertSets.Add("", overall); }
public async Task <ExperimentSummary[]> Update(string timelineName, params int[] experiments) { if (experiments == null) { throw new ArgumentNullException(nameof(experiments)); } Trace.WriteLine("Downloading experiment results..."); var all_summaries = await DownloadSummary(timelineName); Table timeline = all_summaries.Item1; RecordsTable records = all_summaries.Item2; string etag = all_summaries.Item3; foreach (var experimentId in experiments) { var exp = await storage.GetExperiment(experimentId); // fails if not found var domain = resolveDomain.GetDomain(exp.DomainName); var results = (await storage.GetResults(experimentId)).Benchmarks; Trace.WriteLine("Building summary for the experiment " + experimentId); var catSummary = ExperimentSummary.Build(results, domain, ExperimentSummary.DuplicateResolution.Ignore); var expSummary = new ExperimentSummary(experimentId, DateTimeOffset.Now, catSummary); timeline = ExperimentSummaryStorage.AppendOrReplace(timeline, expSummary); Trace.WriteLine("Updating records..."); records.UpdateWith(results, domain); } await UploadSummary(timelineName, timeline, records, all_summaries.Item3); var resultfromTable = ExperimentSummaryStorage.LoadFromTable(timeline); Array.Sort(resultfromTable, (el1, el2) => DateTimeOffset.Compare(el2.Date, el1.Date)); return(resultfromTable); }
/// <summary> /// Requests data on the given experiment and displays the results /// </summary> /// <param name="id">The experiment ID</param> public async Task GetSummary(int id) { var query = new ExperimentSummary() { ExperimentId = id }; var experiment = await QueryManager.Request(query); descriptionBox.Text = experiment["Description"]; //designBox.Text = experiment["Design"]; cropBox.Content = experiment["Crop"]; fieldBox.Content = experiment["Field"]; metBox.Content = experiment["Met"]; repsBox.Content = experiment["Reps"]; ratingBox.Content = experiment["Rating"]; startBox.Content = experiment["Start"]; endBox.Content = experiment["End"]; var items = experiment["List"].Split('\n'); researchersBox.Items.Clear(); researchersBox.Items.AddRange(items); notesBox.Text = experiment["Notes"]; var sowing = await QueryManager.Request(new SowingSummary() { ExperimentId = id }); sowingMethodBox.Content = sowing["Method"]; sowingDateBox.Content = sowing["Date"]; sowingDepthBox.Content = sowing["Depth"]; sowingRowBox.Content = sowing["Row"]; sowingPopBox.Content = sowing["Pop"]; }
public ExperimentViewModel(ExperimentSummary summary, bool isFinished) { this.summary = summary; this.IsFinished = isFinished; }
public ShortCircuitResult ShortCircuit(ExperimentSummary experimentSummary, string userId) { return(Context.Request.QueryString.AllKeys.Contains(experimentSummary.Name) ? new ShortCircuitResult(true, Context.Request.QueryString[experimentSummary.Name]) : ShortCircuitResult.False); }
public ShortCircuitResult ShortCircuit(ExperimentSummary experimentSummary, string userId) { return(experimentSummary.HasEnded ? new ShortCircuitResult(true, experimentSummary.AlwaysUseOption) : ShortCircuitResult.False); }