- Timestamp:
- 08/30/18 11:32:56 (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Services.WebApp.Statistics
- Property svn:mergeinfo changed
/branches/HiveProjectManagement/HeuristicLab.Services.WebApp.Statistics (added) merged: 15671
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Services.WebApp.Statistics/3.3/WebApi/ClientController.cs
r15583 r16117 74 74 on client.Id equals info.ClientId into clientInfoJoin 75 75 from clientInfo in clientInfoJoin.OrderByDescending(x => x.Time).Take(1) 76 let offline = (client.ExpirationTime != null || clientInfo.SlaveState == SlaveState.Offline) 76 let offline = (client.DateExpired != null || clientInfo.SlaveState == SlaveState.Offline) 77 let parent = client.ParentResourceId.HasValue ? dimClientDao.GetById(client.ParentResourceId.Value) : null 77 78 select new DT.ClientDetails { 78 79 Id = client.Id, … … 85 86 State = offline ? SlaveState.Offline.ToString() : clientInfo.SlaveState.ToString(), 86 87 LastUpdate = clientInfo.Time, 87 GroupId = client. ResourceGroupId,88 GroupName = client.GroupName,88 GroupId = client.ParentResourceId, 89 GroupName = parent != null ? parent.Name : null, 89 90 UpTime = offline ? 0 : upTime, 90 91 TotalUnavailableTime = timeData != null ? timeData.TotalUnavailableTime : 0, … … 117 118 var factClientInfoDao = pm.FactClientInfoDao; 118 119 return pm.UseTransaction(() => { 119 var clients = expired ? dimClientDao.Get ExpiredClients() : dimClientDao.GetActiveClients();120 var clients = expired ? dimClientDao.GetAllExpiredSlaves() : dimClientDao.GetAllOnlineSlaves(); 120 121 var query = (from client in clients 121 122 join info in factClientInfoDao.GetAll() … … 123 124 from clientInfo in clientInfoJoin.OrderByDescending(x => x.Time).Take(1) 124 125 let offline = (expired || clientInfo.SlaveState == SlaveState.Offline) 126 let parent = client.ParentResourceId.HasValue ? dimClientDao.GetById(client.ParentResourceId.Value) : null 125 127 select new DT.Client { 126 128 Id = client.Id, … … 132 134 CpuUtilization = offline ? 0 : clientInfo.CpuUtilization, 133 135 State = offline ? SlaveState.Offline.ToString() : clientInfo.SlaveState.ToString(), 134 GroupId = client. ResourceGroupId,135 GroupName = client.GroupName,136 GroupId = client.ParentResourceId, 137 GroupName = parent != null ? parent.Name : null, 136 138 IsAllowedToCalculate = clientInfo.IsAllowedToCalculate 137 139 }); … … 200 202 var factClientInfoDao = pm.FactClientInfoDao; 201 203 return pm.UseTransaction(() => { 202 var clients = expired ? dimClientDao.Get ExpiredClients() : dimClientDao.GetActiveClients();203 clients = clients.Where(x => x. ResourceGroupId == id);204 var clients = expired ? dimClientDao.GetAllExpiredClients() : dimClientDao.GetAllOnlineClients(); 205 clients = clients.Where(x => x.ParentResourceId == id); 204 206 var query = (from client in clients 205 207 join info in factClientInfoDao.GetAll() … … 207 209 from clientInfo in clientInfoJoin.OrderByDescending(x => x.Time).Take(1) 208 210 let offline = (expired || clientInfo.SlaveState == SlaveState.Offline) 211 let parent = client.ParentResourceId.HasValue ? dimClientDao.GetById(client.ParentResourceId.Value) : null 209 212 select new DT.Client { 210 213 Id = client.Id, … … 216 219 CpuUtilization = offline ? 0 : clientInfo.CpuUtilization, 217 220 State = offline ? SlaveState.Offline.ToString() : clientInfo.SlaveState.ToString(), 218 GroupId = client. ResourceGroupId,219 GroupName = client.GroupName,221 GroupId = client.ParentResourceId, 222 GroupName = parent != null ? parent.Name : null, 220 223 IsAllowedToCalculate = clientInfo.IsAllowedToCalculate 221 224 }); … … 247 250 client => client.Id, 248 251 (fact, client) => new { 249 client. ResourceGroupId,252 client.ParentResourceId, 250 253 fact.Time, 251 254 fact.CpuUtilization, … … 255 258 fact.UsedMemory 256 259 }) 257 .Where(x => x. ResourceGroupId == id)260 .Where(x => x.ParentResourceId == id) 258 261 .ToList(); 259 262 var clientStatus = new DT.ClientStatus { -
trunk/HeuristicLab.Services.WebApp.Statistics/3.3/WebApi/GroupController.cs
r15583 r16117 42 42 var clientTimeData = factClientInfoDao.GetAll() 43 43 .Join(dimClientDao.GetAll(), x => x.ClientId, y => y.Id, (x, y) => new { 44 y. ResourceGroupId,44 y.ParentResourceId, 45 45 x.IdleTime, 46 46 x.OfflineTime, 47 47 x.UnavailableTime 48 48 }) 49 .Where(x => x. ResourceGroupId == id)50 .GroupBy(x => x. ResourceGroupId)49 .Where(x => x.ParentResourceId == id) 50 .GroupBy(x => x.ParentResourceId) 51 51 .Select(x => new { 52 52 TotalIdleTime = x.Sum(y => y.IdleTime), … … 68 68 }) 69 69 .FirstOrDefault(); 70 return (from client in dimClientDao.GetA ctiveClients().Where(x => x.ResourceGroupId == id)70 return (from client in dimClientDao.GetAllOnlineSlaves().Where(x => x.ParentResourceId == id) 71 71 join info in factClientInfoDao.GetAll() 72 72 on client.Id equals info.ClientId into clientInfoJoin 73 73 from clientInfo in clientInfoJoin.OrderByDescending(x => x.Time).Take(1) 74 74 let offline = (clientInfo.SlaveState == DA.SlaveState.Offline) 75 let parent = client.ParentResourceId.HasValue ? dimClientDao.GetById(client.ParentResourceId.Value) : null 75 76 select new { 76 ResourceGroupId = client. ResourceGroupId,77 GroupName = client.GroupName,77 ResourceGroupId = client.ParentResourceId, 78 GroupName = parent != null ? parent.Name : null, 78 79 TotalCores = clientInfo.NumTotalCores, 79 80 UsedCores = offline ? 0 : clientInfo.NumUsedCores, … … 114 115 var dimClientDao = pm.DimClientDao; 115 116 var factClientInfoDao = pm.FactClientInfoDao; 116 var data = (from client in dimClientDao.GetA ctiveClients()117 var data = (from client in dimClientDao.GetAllOnlineSlaves() 117 118 join info in factClientInfoDao.GetAll() 118 119 on client.Id equals info.ClientId into clientInfoJoin … … 120 121 let offline = (clientInfo.SlaveState == DA.SlaveState.Offline) 121 122 select new { 122 ResourceGroupId = client. ResourceGroupId,123 ResourceGroupId = client.ParentResourceId, 123 124 TotalCores = clientInfo.NumTotalCores, 124 125 UsedCores = offline ? 0 : clientInfo.NumUsedCores, … … 137 138 CpuUtilization = x.Where(y => y.SlaveState != DA.SlaveState.Offline).Average(y => (double?)y.CpuUtilization) ?? 0.0 138 139 }); 139 var query = dimClientDao.GetAll() 140 .GroupBy(x => new { x.ResourceGroupId, x.GroupName }) 141 .Select(x => new { 142 Id = x.Key.ResourceGroupId ?? default(Guid), 143 Name = x.Key.GroupName 144 }); 140 141 var query = dimClientDao.GetAllOnlineSlaveGroups().Select(x => new { 142 Id = x.ResourceId, 143 Name = x.Name 144 }); 145 145 return pm.UseTransaction(() => new DT.GroupPage { 146 146 TotalGroups = query.Count(),
Note: See TracChangeset
for help on using the changeset viewer.