Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9025


Ignore:
Timestamp:
12/11/12 16:27:46 (12 years ago)
Author:
ascheibe
Message:

#1994 added displaying statistics for groups

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Services.Hive.Web/Hive-3.3/Status.aspx

    r9023 r9025  
    3737    <asp:Label ID="slavesLabel" runat="server" />
    3838      <br />
     39      Groups:
     40    <asp:Label ID="groupsLabel" runat="server" />
     41      <br />
    3942      <br />
    4043      Number of Calculating Tasks by User:<asp:Table ID="calculatingTasksByUserTable" runat="server" GridLines="Both">
     
    7477    <br />
    7578    Avg. CPU Utilization History of all Slaves<br />
    76     <asp:Chart ID="cpuUtilizationChart" runat="server" Height="270px" Width="1900px">
     79    <asp:Chart ID="cpuUtilizationChart" runat="server" Height="270px" Width="1280px">
    7780      <Series>
    7881        <asp:Series BorderWidth="2" ChartType="Line" Color="0, 176, 80" Name="Series1" XValueType="DateTime"
     
    9699    <br />
    97100    Cores/Used Cores History<br />
    98     <asp:Chart ID="coresChart" runat="server" Palette="None" Width="1900px" PaletteCustomColors="137, 165, 78; 185, 205, 150">
     101    <asp:Chart ID="coresChart" runat="server" Palette="None" Width="1280px" PaletteCustomColors="137, 165, 78; 185, 205, 150">
    99102      <Series>
    100103        <asp:Series ChartType="Area" Name="Cores" XValueType="DateTime" YValueType="Double">
     
    121124    Memory/Used Memory History (GB)<br />
    122125    <asp:Chart ID="memoryChart" runat="server" Palette="None" PaletteCustomColors="170, 70, 67; 209, 147, 146"
    123       Width="1900px">
     126      Width="1280px">
    124127      <Series>
    125128        <asp:Series ChartType="Area" Name="Cores" XValueType="DateTime" YValueType="Double">
  • trunk/sources/HeuristicLab.Services.Hive.Web/Hive-3.3/Status.aspx.cs

    r9023 r9025  
    4444    Dictionary<Guid, int> calculatingTasksByUser = new Dictionary<Guid,int>();
    4545    Dictionary<Guid, int> waitingTasksByUser = new Dictionary<Guid, int>();
     46    List<DT.Resource> groups = new List<DT.Resource>();
     47
     48    transactionManager.UseTransaction(() => {
     49       groups = dao.GetResources(x => x.ResourceType == "GROUP").ToList();
     50    }, false, false);   
    4651
    4752    if (!string.IsNullOrEmpty(resourceName)) {
     
    7681
    7782    slavesLabel.Text = string.Join(", ", onlineSlaves.Select(x => string.Format("<a href=\"?resource={0}\">{0}</a> ({1} %)", x.Name, Math.Round(x.CpuUtilization, 2))));
     83    groupsLabel.Text = string.Join(", ", groups.Select(x => string.Format("<a href=\"?resource={0}\">{0}</a>", x.Name)));
    7884
    7985    overallCpuUtilizationLabel.Text = (onlineSlaves.Count() > 0 ? Math.Round(onlineSlaves.Average(s => s.CpuUtilization), 2).ToString() : "0.0") + " %";
    80     cpuUtilizationLabel.Text = (onlineSlaves.Count() > 0 ? Math.Round(onlineSlaves.Where(x => x.IsAllowedToCalculate).Average(s => s.CpuUtilization), 2).ToString() : "0.0") + " %";
     86    cpuUtilizationLabel.Text = (onlineSlaves.Count() > 0 && onlineSlaves.Where(x => x.IsAllowedToCalculate).Count() > 0 ? Math.Round(onlineSlaves.Where(x => x.IsAllowedToCalculate).Average(s => s.CpuUtilization), 2).ToString() : "0.0") + " %";
    8187
    8288    DT.Statistics[] stats = new DT.Statistics[0];   
  • trunk/sources/HeuristicLab.Services.Hive/3.3/HiveDao.cs

    r9022 r9025  
    639639    public IEnumerable<DT.Resource> GetChildResources(Guid resourceId) {
    640640      using (var db = CreateContext()) {
    641         var childs = new List<DT.Resource>();
    642         foreach (var child in db.Resources.Where(x => x.ParentResourceId == resourceId)) {
    643           childs.Add(DT.Convert.ToDto(child));
    644           childs.AddRange(GetChildResources(child.ResourceId));
    645         }
    646         return childs;
    647       }
     641        return CollectChildResources(resourceId, db);
     642      }
     643    }
     644
     645    public IEnumerable<DT.Resource> CollectChildResources(Guid resourceId, HiveDataContext db) {
     646      var childs = new List<DT.Resource>();
     647      foreach (var child in db.Resources.Where(x => x.ParentResourceId == resourceId)) {
     648        childs.Add(DT.Convert.ToDto(child));
     649        childs.AddRange(CollectChildResources(child.ResourceId, db));
     650      }
     651      return childs;
    648652    }
    649653
     
    842846      using (var db = CreateContext()) {
    843847        var calculatingTasksByUser = from task in db.Tasks
    844                               where task.State == TaskState.Calculating
    845                               group task by task.Job.OwnerUserId into g
    846                               select new { UserId = g.Key, UsedCores = g.Count() };
     848                                     where task.State == TaskState.Calculating
     849                                     group task by task.Job.OwnerUserId into g
     850                                     select new { UserId = g.Key, UsedCores = g.Count() };
    847851        return calculatingTasksByUser.ToDictionary(x => x.UserId, x => x.UsedCores);
    848852      }
Note: See TracChangeset for help on using the changeset viewer.