Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/18/15 11:56:31 (9 years ago)
Author:
dglaser
Message:

#2388: Merged trunk into HiveStatistics branch

Location:
branches/HiveStatistics/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources

  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Status/3.3/WebApi/DataController.cs

    r12435 r12467  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Data.Linq;
    2425using System.Linq;
    2526using System.Web.Http;
     
    4243        SELECT
    4344          DISTINCT UserId,
    44           (SELECT Count FROM UserTasks WHERE TaskState = 'Calculating' AND UserId = ut.UserId) AS CalculatingTasks,
    45           (SELECT Count FROM UserTasks WHERE TaskState = 'Waiting' AND UserId = ut.UserId) AS WaitingTasks
     45          ISNULL((SELECT Count FROM UserTasks WHERE TaskState = 'Calculating' AND UserId = ut.UserId), 0) AS CalculatingTasks,
     46          ISNULL((SELECT Count FROM UserTasks WHERE TaskState = 'Waiting' AND UserId = ut.UserId), 0) AS WaitingTasks
    4647        FROM UserTasks ut;";
    47 
    4848
    4949    private class UserTaskStatus {
     
    7373        var activeSlaves = onlineSlaves.Where(s => s.IsAllowedToCalculate).ToList();
    7474        var calculatingSlaves = activeSlaves.Where(s => s.SlaveState == SlaveState.Calculating).ToList();
    75 
    7675        int calculatingMemory = calculatingSlaves.Any() ? (int)calculatingSlaves.Sum(s => s.Memory) / 1024 : 0;
    7776        int freeCalculatingMemory = calculatingSlaves.Any() ? (int)calculatingSlaves.Sum(s => s.FreeMemory) / 1024 : 0;
     
    129128      }
    130129      using (var db = new HiveDataContext()) {
    131         var statistics = db.Statistics.Where(s => s.Timestamp >= start && s.Timestamp <= end);
     130        DataLoadOptions loadOptions = new DataLoadOptions();
     131        loadOptions.LoadWith<Statistics>(o => o.SlaveStatistics);
     132        db.LoadOptions = loadOptions;
     133        db.DeferredLoadingEnabled = false;
     134        var statistics = db.Statistics.Where(s => s.Timestamp >= start && s.Timestamp <= end)
     135                                      .OrderBy(s => s.Timestamp)
     136                                      .ToList();
    132137        var status = new DTO.Status {
    133138          CoreStatus = new DTO.CoreStatus(),
Note: See TracChangeset for help on using the changeset viewer.