Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/20/11 13:54:57 (12 years ago)
Author:
spimming
Message:

#1680:

  • merged changes from trunk into branch

' removed pre-build event for multiple app.configs

Location:
branches/HeuristicLab.Hive.Azure
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive.Azure

  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Services.Hive.Web/Hive-3.3/Status.aspx

    r6983 r7215  
    66<html xmlns="http://www.w3.org/1999/xhtml">
    77<head runat="server">
    8   <title></title>
     8  <title>HeuristicLab Hive Status Monitor</title>
     9  <link rel="icon" type="image/ico" href="HeuristicLab.ico" />
    910</head>
    1011<body>
     12  <center>
     13    <h1>HeuristicLab Hive Status Monitor</h1>
     14  </center>
    1115  <form id="form1" runat="server">
    1216  <div>
     
    2024    <asp:Label ID="waitingJobsLabel" runat="server" />
    2125    <br />
     26    Avg. CPU Utilization:
     27    <asp:Label ID="cpuUtilizationLabel" runat="server" />
     28      <br />
    2229    Slaves (CPU Utilization):
    2330    <asp:Label ID="slavesLabel" runat="server" />
    24     <br />
    25     Avg. CPU Utilization:
    26     <asp:Label ID="cpuUtilizationLabel" runat="server" />
    27     <br />
    28     ExecutionTime on Hive:
    29     <asp:Label ID="totalExecutionTimeLabel" runat="server" />
    30     <br />
     31      <br />
    3132    <br />
    3233    Days:
    33     <asp:DropDownList ID="daysDropDownList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="daysDropDownList_SelectedIndexChanged">
     34    <asp:DropDownList ID="daysDropDownList" runat="server" AutoPostBack="True">
    3435      <asp:ListItem Value="1"></asp:ListItem>
    3536      <asp:ListItem Value="2"></asp:ListItem>
     
    121122    </asp:Chart>
    122123    <br />
    123     Speedup (ComputedMinutes/Minute)<br />
    124     <asp:Chart ID="speedupChartMinutes" runat="server" Palette="None" Width="1900px"
    125       PaletteCustomColors="79, 129, 189">
    126       <Series>
    127         <asp:Series ChartType="Area" Name="Speedup" XValueType="DateTime" YValueType="Double">
    128         </asp:Series>
    129         <asp:Series BorderWidth="2" ChartArea="ChartArea1"
    130           ChartType="Line" Color="185, 205, 150" Name="Cores">
    131         </asp:Series>
    132       </Series>
    133       <ChartAreas>
    134         <asp:ChartArea BackColor="Black" BackHatchStyle="DottedGrid" BackSecondaryColor="0, 96, 43"
    135           BorderColor="DarkGreen" BorderDashStyle="Dot" Name="ChartArea1">
    136           <AxisY Minimum="-5">
    137             <MajorGrid Enabled="False" />
    138           </AxisY>
    139           <AxisX IntervalAutoMode="VariableCount" IntervalOffset="1" IntervalOffsetType="Hours"
    140             IntervalType="Hours" IsLabelAutoFit="False" >
    141             <MajorGrid Enabled="False" />
    142             <LabelStyle Format="d/M/yyyy HH:mm" IsStaggered="True" />
    143           </AxisX>
    144         </asp:ChartArea>
    145       </ChartAreas>
    146     </asp:Chart>
    147     <br />
    148     Speedup (ComputedHours/Hour)<br />
    149     <br />
    150     <asp:Chart ID="speedupChartHours" runat="server" Palette="None" Width="1900px" PaletteCustomColors="79, 129, 189">
    151       <Series>
    152         <asp:Series ChartType="Area" Name="Speedup" XValueType="DateTime"
    153           YValueType="Double">
    154         </asp:Series>
    155         <asp:Series BorderWidth="2" ChartArea="ChartArea1"
    156           ChartType="Line" Color="185, 205, 150" Name="Cores">
    157         </asp:Series>
    158       </Series>
    159       <ChartAreas>
    160         <asp:ChartArea BackColor="Black" BackHatchStyle="DottedGrid" BackSecondaryColor="0, 96, 43"
    161           BorderColor="DarkGreen" BorderDashStyle="Dot" Name="ChartArea1">
    162           <AxisY>
    163             <MajorGrid Enabled="False" />
    164           </AxisY>
    165           <AxisX IntervalAutoMode="VariableCount" IntervalOffset="1" IntervalOffsetType="Hours"
    166             IntervalType="Hours" IsLabelAutoFit="False">
    167             <MajorGrid Enabled="False" />
    168             <LabelStyle Format="d/M/yyyy HH:mm" IsStaggered="True" />
    169           </AxisX>
    170         </asp:ChartArea>
    171       </ChartAreas>
    172     </asp:Chart>
    173     <br />
     124      <br />
    174125  </div>
    175126  </form>
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Services.Hive.Web/Hive-3.3/Status.aspx.cs

    r6983 r7215  
    3232using System.Web.UI.DataVisualization.Charting;
    3333using DA = HeuristicLab.Services.Hive.DataAccess;
     34using DT = HeuristicLab.Services.Hive.DataTransfer;
    3435
    3536public partial class Status : System.Web.UI.Page {
    3637  protected void Page_Load(object sender, EventArgs e) {
    3738    var dao = ServiceLocator.Instance.HiveDao;
     39    var transactionManager = ServiceLocator.Instance.TransactionManager;
    3840    var resourceName = Request.QueryString["resource"];
    39     IEnumerable<Guid> resourceIds;
     41    IEnumerable<Guid> resourceIds = new List<Guid>();
     42    IEnumerable<DT.Slave> onlineSlaves = new List<DT.Slave>();
     43    int currentlyJobsWaiting = 0;
     44
    4045    if (!string.IsNullOrEmpty(resourceName)) {
    41       var resId = dao.GetResources(x => x.Name == resourceName).Single().Id;
    42       resourceIds = dao.GetChildResources(resId).Select(x => x.Id).Union(new List<Guid> { resId });
    43       speedupChartHours.Visible = false;
    44       speedupChartMinutes.Visible = false;
     46        transactionManager.UseTransaction(() =>
     47        {
     48            var resId = dao.GetResources(x => x.Name == resourceName).Single().Id;
     49            resourceIds = dao.GetChildResources(resId).Select(x => x.Id).Union(new List<Guid> { resId });
     50        }, false, false);       
    4551    } else {
    46       resourceIds = dao.GetResources(x => true).Select(y => y.Id);
    47       speedupChartHours.Visible = true;
    48       speedupChartMinutes.Visible = true;
    49     }
    50                                  
    51     var onlineSlaves = dao.GetSlaves(x => (x.SlaveState == DA.SlaveState.Calculating || x.SlaveState == DA.SlaveState.Idle) && resourceIds.Contains(x.ResourceId));
     52        transactionManager.UseTransaction(() =>
     53        {
     54             resourceIds = dao.GetResources(x => true).Select(y => y.Id);
     55        }, false, false);
     56    }   
     57
     58    transactionManager.UseTransaction(() =>
     59    {                     
     60        onlineSlaves = dao.GetSlaves(x => (x.SlaveState == DA.SlaveState.Calculating || x.SlaveState == DA.SlaveState.Idle) && resourceIds.Contains(x.ResourceId));
     61        currentlyJobsWaiting = dao.GetTasks(x => x.State == DA.TaskState.Waiting).Count();
     62    }, false, false);
    5263
    5364    int currentlyAvailableCores = onlineSlaves.Where(s => s.Cores.HasValue).Sum(s => s.Cores.Value);
    5465    int currentlyUsedCores = currentlyAvailableCores - onlineSlaves.Where(s => s.FreeCores.HasValue).Sum(s => s.FreeCores.Value);
    55     int currentlyJobsWaiting = ServiceLocator.Instance.HiveDao.GetTasks(x => x.State == DA.TaskState.Waiting).Count();
    56 
     66   
    5767    this.availableCoresLabel.Text = currentlyAvailableCores.ToString();
    5868    this.usedCoresLabel.Text = currentlyUsedCores.ToString();
     
    6373    cpuUtilizationLabel.Text = (onlineSlaves.Count() > 0 ? Math.Round(onlineSlaves.Average(s => s.CpuUtilization), 2).ToString() : "0.0") + " %";
    6474
    65     HeuristicLab.Services.Hive.DataTransfer.Statistics[] stats;
    66     if (daysDropDownList.SelectedValue == "All") {
    67       stats = dao.GetStatistics(x => true).OrderBy(x => x.TimeStamp).ToArray();
    68     } else {
    69       stats = dao.GetStatistics(x => x.Timestamp >= DateTime.Now.Subtract(TimeSpan.FromDays(int.Parse(daysDropDownList.SelectedValue)))).OrderBy(x => x.TimeStamp).ToArray();
    70     }
    71                                                      
    72     if (stats.Length != 0) {
    73       var firstStatisticsDate = stats.OrderBy(x => x.TimeStamp).First().TimeStamp;
    74       var statisticsSince = DateTime.Now - firstStatisticsDate;
    75       totalExecutionTimeLabel.Text = new TimeSpan(stats.Last().UserStatistics.Sum(x => x.ExecutionTime.Ticks)).ToString() + " (since " + Math.Round(statisticsSince.TotalDays, 2) + " days)";
    76     } else {
    77       totalExecutionTimeLabel.Text = "00:00:00.00";
    78     }
     75    DT.Statistics[] stats = new DT.Statistics[0];   
     76    transactionManager.UseTransaction(() =>
     77    {   
     78        if (daysDropDownList.SelectedValue == "All") {
     79          stats = dao.GetStatistics(x => true).OrderBy(x => x.TimeStamp).ToArray();
     80        } else {
     81          stats = dao.GetStatistics(x => x.Timestamp >= DateTime.Now.Subtract(TimeSpan.FromDays(int.Parse(daysDropDownList.SelectedValue)))).OrderBy(x => x.TimeStamp).ToArray();
     82        }
     83    }, false, false);
    7984   
    8085    for (int i = 0; i < stats.Length; i++) {
     
    95100      memoryChart.Series[0].Points.AddXY(s.TimeStamp.ToOADate(), memory / 1024.0);
    96101      memoryChart.Series[1].Points.AddXY(s.TimeStamp.ToOADate(), usedMemory / 1024.0);
    97 
    98       if (i > 0) {
    99         var execTime = new TimeSpan(s.UserStatistics.Sum(x => x.ExecutionTime.Ticks));
    100         var execTimePrev = new TimeSpan(stats[i - 1].UserStatistics.Sum(x => x.ExecutionTime.Ticks));
    101         var execTimeDifference = execTimePrev - execTime;
    102 
    103         var timeDifference = stats[i - 1].TimeStamp - s.TimeStamp; // the difference between statistic entries is not alway exactly 1 minute
    104         var speedup = execTimeDifference.TotalMinutes / timeDifference.TotalMinutes;
    105         speedupChartMinutes.Series[0].Points.AddXY(s.TimeStamp.ToOADate(), speedup);
    106         speedupChartMinutes.Series[1].Points.AddXY(s.TimeStamp.ToOADate(), cores);
    107       }
    108       if (i - 60 >= 0) {
    109         var execTime = new TimeSpan(s.UserStatistics.Sum(x => x.ExecutionTime.Ticks));
    110         var execTimePrev = new TimeSpan(stats[i - 60].UserStatistics.Sum(x => x.ExecutionTime.Ticks));
    111         var execTimeDifference = execTimePrev - execTime;
    112 
    113         var timeDifference = stats[i - 60].TimeStamp - s.TimeStamp; // the difference between statistic entries is not alway exactly 1 minute
    114         var speedup = execTimeDifference.TotalMinutes / timeDifference.TotalMinutes;
    115         speedupChartHours.Series[0].Points.AddXY(s.TimeStamp.ToOADate(), speedup);
    116         speedupChartHours.Series[1].Points.AddXY(s.TimeStamp.ToOADate(), cores);
    117       }
    118102    }
    119103  }
    120 
    121   protected void daysDropDownList_SelectedIndexChanged(object sender, EventArgs e) {
    122 
    123   }
    124104}
Note: See TracChangeset for help on using the changeset viewer.