Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/30/15 13:12:07 (9 years ago)
Author:
dglaser
Message:

#2388:

HeuristicLab.Services.Hive.DataAccess-3.3:

  • updated database schema
  • updated sql scripts
  • updated HiveStatisticsGenerator

HeuristicLab.Services.WebApp-3.3:

  • merged from trunk

HeuristicLab.Services.WebApp.Status-3.3:

  • updated data api controller

HeuristicLab.Services.WebApp.Statistics-3.3:

  • added exception page
  • improved jobs, clients, users and groups page
Location:
branches/HiveStatistics/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources

  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Statistics/3.3/WebApi/GroupController.cs

    r12525 r12551  
    3838        var dimClientDao = pm.DimClientDao;
    3939        var factClientInfoDao = pm.FactClientInfoDao;
     40        var factTaskDao = pm.FactTaskDao;
    4041        return pm.UseTransaction(() => {
     42          var clientTimeData = factClientInfoDao.GetAll()
     43            .Join(dimClientDao.GetAll(), x => x.ClientId, y => y.Id, (x, y) => new {
     44              y.ResourceGroupId,
     45              x.IdleTime,
     46              x.OfflineTime,
     47              x.UnavailableTime
     48            })
     49            .Where(x => x.ResourceGroupId == id)
     50            .GroupBy(x => x.ResourceGroupId)
     51            .Select(x => new {
     52              TotalIdleTime = x.Sum(y => y.IdleTime),
     53              TotalOfflineTime = x.Sum(y => y.OfflineTime),
     54              TotalUnavailableTime = x.Sum(y => y.UnavailableTime)
     55            })
     56            .FirstOrDefault();
     57
     58          var taskTimeData = factTaskDao.GetByGroupId(id)
     59            .Select(x => new {
     60              id,
     61              x.CalculatingTime,
     62              x.TransferTime
     63            })
     64            .GroupBy(x => x.id)
     65            .Select(x => new {
     66              CalculatingTime = x.Sum(y => y.CalculatingTime),
     67              TransferTime = x.Sum(y => y.TransferTime)
     68            })
     69            .FirstOrDefault();
    4170          return (from client in dimClientDao.GetActiveClients().Where(x => x.ResourceGroupId == id)
    4271                  join info in factClientInfoDao.GetAll()
     
    5180                    TotalMemory = clientInfo.TotalMemory,
    5281                    UsedMemory = offline ? 0 : clientInfo.UsedMemory,
    53                     CpuUtilization = offline ? 0 : clientInfo.CpuUtilization
     82                    CpuUtilization = offline ? 0 : clientInfo.CpuUtilization,
     83                    SlaveState = clientInfo.SlaveState
    5484                  })
    5585            .GroupBy(x => new { x.ResourceGroupId, x.GroupName })
    5686            .Select(x => new DT.GroupDetails {
    57               Id = x.Key.ResourceGroupId ?? default(Guid),
     87              Id = id,
    5888              Name = x.Key.GroupName,
    59               Clients = x.Count(),
     89              TotalClients = x.Count(),
     90              OnlineClients = x.Count(y => y.SlaveState != DA.SlaveState.Offline),
    6091              TotalCores = x.Sum(y => y.TotalCores),
    6192              UsedCores = x.Sum(y => y.UsedCores),
    6293              TotalMemory = x.Sum(y => y.TotalMemory),
    6394              UsedMemory = x.Sum(y => y.UsedMemory),
    64               CpuUtilization = x.Average(y => y.CpuUtilization)
     95              TotalCpuUtilization = x.Average(y => (double?)y.CpuUtilization) ?? 0.0,
     96              ActiveCpuUtilization = x.Where(y => y.SlaveState != DA.SlaveState.Offline).Average(y => (double?)y.CpuUtilization) ?? 0.0,
     97              TotalUnavailableTime = clientTimeData != null ? clientTimeData.TotalUnavailableTime : 0,
     98              TotalCalculatingTime = taskTimeData != null ? taskTimeData.CalculatingTime : 0,
     99              TotalIdleTime = clientTimeData != null ? clientTimeData.TotalIdleTime : 0,
     100              TotalOfflineTime = clientTimeData != null ? clientTimeData.TotalOfflineTime : 0,
     101              TotalTransferringTime = taskTimeData != null ? taskTimeData.TransferTime : 0,
     102              TasksStates = factTaskDao.GetByGroupId(id)
     103                                    .GroupBy(y => y.TaskState)
     104                                    .Select(y => new DT.TaskStateCount {
     105                                      State = y.Key.ToString(),
     106                                      Count = y.Count()
     107                                    }).ToList()
    65108            }).FirstOrDefault();
    66109        });
     
    83126                      TotalMemory = clientInfo.TotalMemory,
    84127                      UsedMemory = offline ? 0 : clientInfo.UsedMemory,
    85                       CpuUtilization = offline ? 0 : clientInfo.CpuUtilization
     128                      CpuUtilization = offline ? 0 : clientInfo.CpuUtilization,
     129                      SlaveState = clientInfo.SlaveState
    86130                    }).GroupBy(x => x.ResourceGroupId).Select(x => new {
    87131                      GroupId = x.Key,
    88                       Count = x.Count(),
     132                      TotalClients = x.Count(),
     133                      OnlineClients = x.Count(y => y.SlaveState != DA.SlaveState.Offline),
    89134                      TotalCores = x.Sum(y => y.TotalCores),
    90135                      UsedCores = x.Sum(y => y.UsedCores),
    91136                      TotalMemory = x.Sum(y => y.TotalMemory),
    92137                      UsedMemory = x.Sum(y => y.UsedMemory),
    93                       CpuUtilization = x.Average(y => y.CpuUtilization)
     138                      CpuUtilization = x.Where(y => y.SlaveState != DA.SlaveState.Offline).Average(y => (double?)y.CpuUtilization) ?? 0.0
    94139                    });
    95140        var query = dimClientDao.GetAll()
     
    108153              Id = group.Id,
    109154              Name = group.Name,
    110               Clients = info.Count,
     155              TotalClients = info.TotalClients,
     156              OnlineClients = info.OnlineClients,
    111157              TotalCores = info.TotalCores,
    112158              UsedCores = info.UsedCores,
Note: See TracChangeset for help on using the changeset viewer.