Changeset 9646
- Timestamp:
- 06/19/13 15:29:37 (11 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r9461 r9646 438 438 439 439 refreshableJob.Progress.Status = "Downloading tasks..."; 440 downloader = new TaskDownloader(allTasks.Select(x => x.Id) , refreshableJob.Log);440 downloader = new TaskDownloader(allTasks.Select(x => x.Id)); 441 441 downloader.StartAsync(); 442 442 -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/ChartHelper.cshtml
r9644 r9646 1 1 @* HeuristicLab 2 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)2 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 3 3 * 4 4 * This file is part of HeuristicLab. … … 35 35 } 36 36 37 @helper LineChartTime(string destinationTag, string url, string title = "", 38 double? minY = null, double? maxY = null, string axisYFormat = null) { 39 37 @helper LineChartTime(string destinationTag, string url, string title = "", double? minY = null, double? maxY = null, string axisYFormat = null) { 40 38 <script> 41 39 var @(destinationTag)Plot = $.jqplot("@destinationTag", "@url", { … … 46 44 }, 47 45 seriesDefaults: { 48 markerOptions: { show: false }, 49 //fill: true 46 markerOptions: { show: false } 50 47 }, 51 48 dataRenderer: ajaxDataRenderer, … … 97 94 98 95 @helper RefreshChart(string destinationTag, string url, string startDateVar, string endDateVar) { 99 @:$.ajax({url: "@(new HtmlString(url))?start=" + @startDateVar + "&end=" + @endDateVar, datatype: "json", success: function(result) { 100 @: for (var i = 0; i < result.length; i++) { 101 @: @(destinationTag)Plot.series[i].data = result[i]; 102 @: } 103 @: @(destinationTag)Plot.replot({ resetAxes: true }) 104 @:}}); 96 <text> 97 $.ajax({url: "@(new HtmlString(url))?start=" + @startDateVar + "&end=" + @endDateVar, datatype: "json", success: function(result) { 98 for (var i = 0; i < result.length; i++) { 99 @(destinationTag)Plot.series[i].data = result[i]; 100 } 101 @(destinationTag)Plot.replot({ resetAxes: true }) 102 }}); 103 </text> 105 104 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Start/BundleConfig.cs
r9625 r9646 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Start/FilterConfig.cs
r9625 r9646 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Start/RouteConfig.cs
r9625 r9646 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Content/Site.css
r9625 r9646 75 75 76 76 #login a:hover { 77 color: #333;77 color: gray; 78 78 } 79 79 … … 163 163 margin: 1em 0; 164 164 padding: 1em; 165 padding-top: 0; 165 166 border: 1px solid #CCC; 166 167 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/AccountController.cs
r9604 r9646 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/ChartDataController.cs
r9644 r9646 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/HomeController.cs
r9628 r9646 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Global.asax.cs
r9604 r9646 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Helper/HtmMenulHelper.cs
r9604 r9646 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Models/AccountModels.cs
r9604 r9646 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Properties/AssemblyInfo.cs.frame
r9604 r9646 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 32 32 [assembly: AssemblyCompany("")] 33 33 [assembly: AssemblyProduct("HeuristicLab")] 34 [assembly: AssemblyCopyright("(c) 2002-201 2HEAL")]34 [assembly: AssemblyCopyright("(c) 2002-2013 HEAL")] 35 35 [assembly: AssemblyTrademark("")] 36 36 [assembly: AssemblyCulture("")] -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/Home/Index.cshtml
r9643 r9646 111 111 var startDate = $('#Start').val(); 112 112 var endDate = $('#End').val(); 113 114 @*115 var url = "@Url.Action("AverageCpuUtilization", "ChartData")?start=" + startDate + "&end" + endDate;116 117 @ChartHelper.LineChartTime(118 "AverageCpuUtilization",119 "url",120 title: "Avg. CPU Utilization History of all Slaves",121 axisYFormat: "%.2f%%",122 minY: 0, maxY: 100)123 *@124 113 125 114 @ChartHelper.RefreshChart("AverageCpuUtilization", Url.Action("AverageCpuUtilization", "ChartData"), "startDate", "endDate") -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/HiveStatisticsGenerator.cs
r9578 r9646 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Data.Linq; 3 4 using System.Linq; 4 5 using System.Transactions; … … 8 9 namespace HeuristicLab.Services.Hive { 9 10 public class HiveStatisticsGenerator : IStatisticsGenerator { 10 11 11 private IUserManager userManager { get { return ServiceLocator.Instance.UserManager; } } 12 12 … … 22 22 if (newTime != null) { 23 23 UpdateFactTables(newTime, db); 24 db.SubmitChanges(); 24 try { 25 db.SubmitChanges(); 26 } 27 catch (DuplicateKeyException) { 28 // Propable change from summertime to wintertime, resulting in overlapping times 29 // On wintertime to summertime change, slave timeouts and a fact gap will occur 30 } 25 31 } 26 32 … … 31 37 private DimTime UpdateDimensionTables(HiveDataContext db) { 32 38 var newTime = UpdateTime(db); 33 // Update other tables out of sync with time dimension? 39 34 40 UpdateUsers(db); 35 41 UpdateJobs(db); … … 155 161 156 162 private void UpdateClientInfoFacts(DimTime newTime, HiveDataContext db) { 163 var time = newTime.Time; 164 157 165 var lastFacts = 158 166 from cf in db.FactClientInfos … … 178 186 var clientFacts = 179 187 from s in slaves.ToList() 188 let duration = s.LastFact != null ? (time - s.LastFact.Time).TotalMinutes : SmallestTimeSpan.TotalMinutes 180 189 select new FactClientInfo { 181 190 DimClient = s.Client, 182 191 DimTime = newTime, 183 192 UserId = s.Slave.OwnerUserId ?? Guid.Empty, 184 NumUsedCores = 185 s.Slave.Cores != null && s.Slave.FreeCores != null 186 ? s.Slave.Cores.Value - s.Slave.FreeCores.Value 187 : 0, 193 NumUsedCores = s.Slave.Cores != null && s.Slave.FreeCores != null 194 ? s.Slave.Cores.Value - s.Slave.FreeCores.Value : 0, 188 195 NumTotalCores = s.Slave.Cores ?? 0, 189 UsedMemory = 190 s.Slave.Memory != null && s.Slave.FreeMemory != null 191 ? s.Slave.Memory.Value - s.Slave.FreeMemory.Value 192 : 0, 196 UsedMemory = s.Slave.Memory != null && s.Slave.FreeMemory != null 197 ? s.Slave.Memory.Value - s.Slave.FreeMemory.Value : 0, 193 198 TotalMemory = s.Slave.Memory ?? 0, 194 199 CpuUtilization = s.Slave.CpuUtilization, 195 200 TrafficIn = 0, 196 201 TrafficOut = 0, 197 TotalTimeIdle = CalcNewTotalTime(s.LastFact, newTime.Time, 198 x => x.TotalTimeIdle, 199 () => s.Slave.SlaveState == SlaveState.Idle && s.Slave.IsAllowedToCalculate), 200 TotalTimeCalculating = CalcNewTotalTime(s.LastFact, newTime.Time, 201 x => x.TotalTimeCalculating, 202 () => s.Slave.SlaveState == SlaveState.Calculating), 202 TotalTimeIdle = s.Slave.SlaveState == SlaveState.Idle && s.Slave.IsAllowedToCalculate 203 ? duration : 0.0, 204 TotalTimeCalculating = s.Slave.SlaveState == SlaveState.Calculating 205 ? duration : 0.0, 203 206 TotalTimeTransferring = 0.0, 204 TotalTimeUnavailable = CalcNewTotalTime(s.LastFact, newTime.Time, 205 x => x.TotalTimeUnavailable, 206 () => s.Slave.SlaveState == SlaveState.Idle && !s.Slave.IsAllowedToCalculate), 207 TotalTimeOffline = CalcNewTotalTime(s.LastFact, newTime.Time, 208 x => x.TotalTimeOffline, 209 () => s.Slave.SlaveState == SlaveState.Offline) 207 TotalTimeUnavailable = s.Slave.SlaveState == SlaveState.Idle && !s.Slave.IsAllowedToCalculate 208 ? duration : 0.0, 209 TotalTimeOffline = s.Slave.SlaveState == SlaveState.Offline 210 ? duration : 0.0 210 211 }; 211 212 212 213 db.FactClientInfos.InsertAllOnSubmit(clientFacts); 213 }214 215 private double CalcNewTotalTime(FactClientInfo lastFact, DateTime newTime, Func<FactClientInfo, double> selector, Func<bool> condition) {216 if (lastFact == null) {217 return 0.0;218 }219 return condition()220 ? selector(lastFact) + (newTime - lastFact.Time).TotalMinutes221 : selector(lastFact);222 214 } 223 215 … … 262 254 TaskSize = t.LastFact == null ? t.TaskDataSize : t.LastFact.TaskSize, 263 255 ResultSize = t.Task.State == TaskState.Finished ? t.TaskDataSize : default(long?), 264 NumCalculationRuns = stateLogsLinkedList.EnumerateNodes() 265 .Count(sl => sl.Value.State == TaskState.Calculating && sl.NextIs(nsl => nsl.State == TaskState.Transferring)), 266 NumRetries = stateLogsLinkedList.EnumerateNodes() 267 .Count(sl => sl.Value.State == TaskState.Calculating && sl.Next != null && sl.NextIs(nsl => nsl.State != TaskState.Transferring)), 268 TotalWaitingTime = SumTotalTime(stateLogsLinkedList, stateLog => stateLog.Value.State == TaskState.Waiting), 269 TotalRuntime = SumTotalTime(stateLogsLinkedList, stateLog => stateLog.Value.State == TaskState.Calculating && stateLog.NextIs(x => x.State == TaskState.Transferring)), 270 TotalTransferTime = SumTotalTime(stateLogsLinkedList, stateLog => stateLog.Value.State == TaskState.Transferring), 256 NumCalculationRuns = stateLogsLinkedList.CountCalculationRuns(), 257 NumRetries = stateLogsLinkedList.CountRetries(), 258 TotalWaitingTime = stateLogsLinkedList.SumTotalTimeWhere(stateLog => stateLog.Value.State == TaskState.Waiting), 259 TotalRuntime = stateLogsLinkedList.SumTotalTimeWhere(stateLog => stateLog.Value.State == TaskState.Calculating && stateLog.NextIs(x => x.State == TaskState.Transferring)), 260 TotalTransferTime = stateLogsLinkedList.SumTotalTimeWhere(stateLog => stateLog.Value.State == TaskState.Transferring), 271 261 TaskState = t.Task.State 272 262 }; … … 275 265 db.FactTasks.InsertAllOnSubmit(newTaskFacts); 276 266 } 277 278 private double SumTotalTime(LinkedList<StateLog> stateLogs, Predicate<LinkedListNode<StateLog>> predicate) { 267 } 268 269 public static class StateLogLinkedListExtensions { 270 public static int CountCalculationRuns(this LinkedList<StateLog> stateLogs) { 279 271 return stateLogs.EnumerateNodes() 280 .Where(sl => predicate(sl)) 281 .Sum(stateLog => stateLog.Next != null ? (stateLog.Next.Value.DateTime - stateLog.Value.DateTime).TotalMinutes : 0); 272 .Count(sl => sl.Value.State == TaskState.Calculating && sl.NextIs(nsl => nsl.State == TaskState.Transferring)); 273 } 274 275 public static int CountRetries(this LinkedList<StateLog> stateLogs) { 276 return stateLogs.EnumerateNodes() 277 .Count(sl => sl.Value.State == TaskState.Calculating && sl.Next != null && sl.NextIs(nsl => nsl.State != TaskState.Transferring)); 278 } 279 280 public static double SumTotalTimeWhere(this LinkedList<StateLog> stateLogs, Predicate<LinkedListNode<StateLog>> predicate) { 281 return stateLogs.EnumerateNodes() 282 .Where(stateLog => predicate(stateLog)) 283 .Sum(stateLog => stateLog.Next != null ? (stateLog.Next.Value.DateTime - stateLog.Value.DateTime).TotalMinutes : 0.0); 282 284 } 283 285 } 284 286 285 public static class LinkedList NodeExtensions {287 public static class LinkedListExtensions { 286 288 public static IEnumerable<LinkedListNode<T>> EnumerateNodes<T>(this LinkedList<T> list) { 287 289 var node = list.First;
Note: See TracChangeset
for help on using the changeset viewer.