Changeset 12767 for branches/HiveStatistics
- Timestamp:
- 07/16/15 12:31:59 (9 years ago)
- Location:
- branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3/HeuristicLab.Services.WebApp.Maintenance-3.3.csproj
r12761 r12767 40 40 <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> 41 41 <SpecificVersion>False</SpecificVersion> 42 <HintPath>..\ packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>42 <HintPath>..\..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> 43 43 <Private>False</Private> 44 44 </Reference> 45 <Reference Include="System" /> 46 <Reference Include="System.Core" /> 47 <Reference Include="System.Net.Http" /> 45 <Reference Include="System"> 46 <Private>False</Private> 47 </Reference> 48 <Reference Include="System.Core"> 49 <Private>False</Private> 50 </Reference> 51 <Reference Include="System.Net.Http"> 52 <Private>False</Private> 53 </Reference> 48 54 <Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> 49 55 <SpecificVersion>False</SpecificVersion> 50 <HintPath>..\ packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>56 <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath> 51 57 <Private>False</Private> 52 58 </Reference> 53 59 <Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> 54 60 <SpecificVersion>False</SpecificVersion> 55 <HintPath>..\ packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>61 <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath> 56 62 <Private>False</Private> 57 63 </Reference> 58 64 <Reference Include="System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> 59 65 <SpecificVersion>False</SpecificVersion> 60 <HintPath>..\ packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>66 <HintPath>..\..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath> 61 67 <Private>False</Private> 62 68 </Reference> 63 <Reference Include="System.Xml.Linq" /> 64 <Reference Include="System.Data.DataSetExtensions" /> 65 <Reference Include="Microsoft.CSharp" /> 66 <Reference Include="System.Data" /> 67 <Reference Include="System.Xml" /> 69 <Reference Include="System.Xml.Linq"> 70 <Private>False</Private> 71 </Reference> 72 <Reference Include="System.Data.DataSetExtensions"> 73 <Private>False</Private> 74 </Reference> 75 <Reference Include="Microsoft.CSharp"> 76 <Private>False</Private> 77 </Reference> 78 <Reference Include="System.Data"> 79 <Private>False</Private> 80 </Reference> 81 <Reference Include="System.Xml"> 82 <Private>False</Private> 83 </Reference> 68 84 </ItemGroup> 69 85 <ItemGroup> … … 79 95 <Compile Include="WebApi\PluginController.cs" /> 80 96 <Compile Include="WebApi\SpaceUsageController.cs" /> 81 <Compile Include="WebApi\CleanupController.cs" />82 97 </ItemGroup> 83 98 <ItemGroup> 84 99 <None Include="app.config" /> 85 100 <None Include="HeuristicLab.snk" /> 86 <None Include="packages.config" />87 101 <Content Include="WebApp\factclientinfo\factclientinfoCtrl.js"> 88 102 <CopyToOutputDirectory>Always</CopyToOutputDirectory> … … 92 106 </Content> 93 107 <Content Include="WebApp\plugin\plugin.cshtml"> 108 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 109 </Content> 110 <None Include="packages.config" /> 111 <Content Include="Web.config"> 94 112 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 95 113 </Content> -
branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3/WebApi/FactClientInfoController.cs
r12761 r12767 65 65 var factClientInfoDao = pm.FactClientInfoDao; 66 66 var clientInfos = pm.UseTransaction(() => factClientInfoDao.GetByClientId(clientId).OrderBy(x => x.Time).ToList()); 67 FactClientInfo lastClientInfo = null, sumClientInfo = new FactClientInfo(); 68 int counter = 0; 69 var aggregatedClientInfos = new List<FactClientInfo>(); 70 foreach (var clientInfo in clientInfos) { 71 if (lastClientInfo != null) { 72 if (lastClientInfo.SlaveState != clientInfo.SlaveState || 73 lastClientInfo.IsAllowedToCalculate != clientInfo.IsAllowedToCalculate) { 74 // update into 'lastClientInfo' 75 if (aggregatedClientInfos.Any()) { 76 counter = aggregatedClientInfos.Count(); 77 pm.UseTransaction(() => { 78 factClientInfoDao.Delete(aggregatedClientInfos); 79 lastClientInfo.NumUsedCores = sumClientInfo.NumUsedCores / counter; 80 lastClientInfo.NumTotalCores = sumClientInfo.NumTotalCores / counter; 81 lastClientInfo.UsedMemory = sumClientInfo.UsedMemory / counter; 82 lastClientInfo.TotalMemory = sumClientInfo.TotalMemory / counter; 83 lastClientInfo.CpuUtilization = sumClientInfo.CpuUtilization / counter; 84 lastClientInfo.IdleTime = sumClientInfo.IdleTime; 85 lastClientInfo.OfflineTime = sumClientInfo.OfflineTime; 86 lastClientInfo.UnavailableTime = sumClientInfo.UnavailableTime; 87 pm.SubmitChanges(); 88 }); 89 } 90 aggregatedClientInfos.Clear(); 91 counter = 0; 92 sumClientInfo = new FactClientInfo(); 93 } else { 94 // sum up 95 sumClientInfo.NumUsedCores += clientInfo.NumUsedCores; 96 sumClientInfo.NumTotalCores += clientInfo.NumTotalCores; 97 sumClientInfo.UsedMemory += clientInfo.UsedMemory; 98 sumClientInfo.TotalMemory += clientInfo.TotalMemory; 99 sumClientInfo.CpuUtilization += clientInfo.CpuUtilization; 100 sumClientInfo.IdleTime += clientInfo.IdleTime; 101 sumClientInfo.OfflineTime += clientInfo.OfflineTime; 102 sumClientInfo.UnavailableTime += clientInfo.UnavailableTime; 103 counter++; 104 if (counter >= entries) { 105 pm.UseTransaction(() => { 106 factClientInfoDao.Delete(aggregatedClientInfos); 107 clientInfo.NumUsedCores = sumClientInfo.NumUsedCores / counter; 108 clientInfo.NumTotalCores = sumClientInfo.NumTotalCores / counter; 109 clientInfo.UsedMemory = sumClientInfo.UsedMemory / counter; 110 clientInfo.TotalMemory = sumClientInfo.TotalMemory / counter; 111 clientInfo.CpuUtilization = sumClientInfo.CpuUtilization / counter; 112 clientInfo.IdleTime = sumClientInfo.IdleTime; 113 clientInfo.OfflineTime = sumClientInfo.OfflineTime; 114 clientInfo.UnavailableTime = sumClientInfo.UnavailableTime; 115 pm.SubmitChanges(); 116 }); 117 aggregatedClientInfos.Clear(); 118 counter = 0; 119 sumClientInfo = new FactClientInfo(); 120 } else { 121 aggregatedClientInfos.Add(clientInfo); 122 } 123 } 67 var e = clientInfos.GetEnumerator(); 68 if (!e.MoveNext()) return; 69 do { 70 var infosToAggregate = new List<FactClientInfo> { e.Current }; 71 var prev = e.Current; 72 while (infosToAggregate.Count() != entries && e.MoveNext()) { 73 var cur = e.Current; 74 if (prev.IsAllowedToCalculate != cur.IsAllowedToCalculate || prev.SlaveState != cur.SlaveState) 75 break; 76 infosToAggregate.Add(cur); 77 prev = cur; 124 78 } 125 lastClientInfo = clientInfo; 79 if (infosToAggregate.Count() == entries) { 80 AggregateClientInfos(pm, infosToAggregate); 81 } 82 } while (e.MoveNext()); 83 } 84 85 private void AggregateClientInfos(IPersistenceManager pm, List<FactClientInfo> clientInfos) { 86 var factClientInfoDao = pm.FactClientInfoDao; 87 var last = clientInfos.Last(); 88 var infos = clientInfos.GroupBy(x => x.ClientId).Select(x => new { 89 NumUsedCores = (int)x.Average(y => y.NumUsedCores), 90 NumTotalCores = (int)x.Average(y => y.NumTotalCores), 91 UsedMemory = (int)x.Average(y => y.UsedMemory), 92 TotalMemory = (int)x.Average(y => y.TotalMemory), 93 CpuUtilization = Math.Round(x.Average(y => y.CpuUtilization), 2), 94 IdleTime = x.Sum(y => y.IdleTime), 95 OfflineTime = x.Sum(y => y.OfflineTime), 96 UnavailableTime = x.Sum(y => y.UnavailableTime) 97 }).SingleOrDefault(); 98 if (infos != null) { 99 pm.UseTransaction(() => { 100 last.NumUsedCores = infos.NumUsedCores; 101 last.NumTotalCores = infos.NumTotalCores; 102 last.UsedMemory = infos.UsedMemory; 103 last.TotalMemory = infos.TotalMemory; 104 last.CpuUtilization = infos.CpuUtilization; 105 last.IdleTime = infos.IdleTime; 106 last.OfflineTime = infos.OfflineTime; 107 last.UnavailableTime = infos.UnavailableTime; 108 clientInfos.Remove(last); 109 factClientInfoDao.Delete(clientInfos); 110 pm.SubmitChanges(); 111 }); 126 112 } 127 113 } -
branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3/WebApp/factclientinfo/factclientinfo.cshtml
r12761 r12767 54 54 <div class="panel-body"> 55 55 <form class="form-inline"> 56 <p> 57 Rows: {{factClientInfo.Rows}}<br/> 58 Clients: {{factClientInfo.Clients}} 59 </p> 56 <div class="form-group" style="margin-left: 5px; margin-right: 5px;"> 57 <label>Rows: {{factClientInfo.Rows}}</label> 58 </div> 59 <div class="form-group" style="margin-left: 5px; margin-right: 5px;"> 60 <label>Clients: {{factClientInfo.Clients}}</label> 61 </div> 62 <div class="form-group" style="margin-left: 5px; margin-right: 5px;"> 63 <label for="entries">Entries: </label> 64 <input id="entries" type="number" class="form-control" 65 ng-model="entries" min="2"/> 66 </div> 60 67 <div class="form-group" style="margin-left: 5px; margin-right: 5px;"> 61 68 <button type="button" class="btn btn-default" ng-click="aggregate()">
Note: See TracChangeset
for help on using the changeset viewer.