Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/30/18 12:56:00 (7 years ago)
Author:
jzenisek
Message:

#2839

  • adapted computation of DimClient and FactClientInfo stats
  • adapted web app according to new stats computation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveProjectManagement/HeuristicLab.Services.WebApp.Statistics/3.3/WebApi/ClientController.cs

    r14185 r15671  
    7474                  on client.Id equals info.ClientId into clientInfoJoin
    7575                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
    7778                select new DT.ClientDetails {
    7879                  Id = client.Id,
     
    8586                  State = offline ? SlaveState.Offline.ToString() : clientInfo.SlaveState.ToString(),
    8687                  LastUpdate = clientInfo.Time,
    87                   GroupId = client.ResourceGroupId,
    88                   GroupName = client.GroupName,
     88                  GroupId = client.ParentResourceId,
     89                  GroupName = parent != null ? parent.Name : null,
    8990                  UpTime = offline ? 0 : upTime,
    9091                  TotalUnavailableTime = timeData != null ? timeData.TotalUnavailableTime : 0,
     
    117118      var factClientInfoDao = pm.FactClientInfoDao;
    118119      return pm.UseTransaction(() => {
    119         var clients = expired ? dimClientDao.GetExpiredClients() : dimClientDao.GetActiveClients();
     120        var clients = expired ? dimClientDao.GetAllExpiredSlaves() : dimClientDao.GetAllOnlineSlaves();
    120121        var query = (from client in clients
    121122                     join info in factClientInfoDao.GetAll()
     
    123124                     from clientInfo in clientInfoJoin.OrderByDescending(x => x.Time).Take(1)
    124125                     let offline = (expired || clientInfo.SlaveState == SlaveState.Offline)
     126                     let parent = client.ParentResourceId.HasValue ? dimClientDao.GetById(client.ParentResourceId.Value) : null
    125127                     select new DT.Client {
    126128                       Id = client.Id,
     
    132134                       CpuUtilization = offline ? 0 : clientInfo.CpuUtilization,
    133135                       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,
    136138                       IsAllowedToCalculate = clientInfo.IsAllowedToCalculate
    137139                     });
     
    200202      var factClientInfoDao = pm.FactClientInfoDao;
    201203      return pm.UseTransaction(() => {
    202         var clients = expired ? dimClientDao.GetExpiredClients() : 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);
    204206        var query = (from client in clients
    205207                     join info in factClientInfoDao.GetAll()
     
    207209                     from clientInfo in clientInfoJoin.OrderByDescending(x => x.Time).Take(1)
    208210                     let offline = (expired || clientInfo.SlaveState == SlaveState.Offline)
     211                     let parent = client.ParentResourceId.HasValue ? dimClientDao.GetById(client.ParentResourceId.Value) : null
    209212                     select new DT.Client {
    210213                       Id = client.Id,
     
    216219                       CpuUtilization = offline ? 0 : clientInfo.CpuUtilization,
    217220                       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,
    220223                       IsAllowedToCalculate = clientInfo.IsAllowedToCalculate
    221224                     });
     
    247250          client => client.Id,
    248251          (fact, client) => new {
    249             client.ResourceGroupId,
     252            client.ParentResourceId,
    250253            fact.Time,
    251254            fact.CpuUtilization,
     
    255258            fact.UsedMemory
    256259          })
    257         .Where(x => x.ResourceGroupId == id)
     260        .Where(x => x.ParentResourceId == id)
    258261        .ToList();
    259262      var clientStatus = new DT.ClientStatus {
Note: See TracChangeset for help on using the changeset viewer.