Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/20/15 16:41:14 (10 years ago)
Author:
dglaser
Message:

#2388 merged trunk into hive statistics branch

Location:
branches/HiveStatistics/sources
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources

  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Web

  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Web/Hive-3.3/App_Data/PublishProfiles/Hive-3.3.pubxml

    r9589 r12395  
    2222      <Objects xmlns="">
    2323        <ObjectGroup Name="HeuristicLab.Services.Hive.DataAccess.Settings.HeuristicLab_Hive_LinqConnectionString" Order="1" Enabled="False">
    24           <Destination Path="Data Source=localhost;Initial Catalog=HeuristicLab.Hive-3.3;Integrated Security=True" />
     24          <Destination Path="Data Source=.\SQLEXPRESS;Initial Catalog=HeuristicLab.Hive-3.3;Integrated Security=True" />
    2525          <Object Type="DbDacFx">
    26             <PreSource Path="Data Source=localhost;Initial Catalog=HeuristicLab.Hive-3.3;Integrated Security=True" includeData="False" />
     26            <PreSource Path="Data Source=.\SQLEXPRESS;Initial Catalog=HeuristicLab.Hive-3.3;Integrated Security=True" includeData="False" />
    2727            <Source Path="$(IntermediateOutputPath)AutoScripts\HeuristicLab.Services.Hive.DataAccess.Settings.HeuristicLab_Hive_LinqConnectionString_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
    2828          </Object>
    2929          <UpdateFrom Type="Web.Config">
    30             <Source MatchValue="Data Source=localhost;Initial Catalog=HeuristicLab.Hive-3.3;Integrated Security=True;" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
     30            <Source MatchValue="Data Source=.\SQLEXPRESS;Initial Catalog=HeuristicLab.Hive-3.3;Integrated Security=True;" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
    3131          </UpdateFrom>
    3232        </ObjectGroup>
     
    3434          <Destination Path="" />
    3535          <Object Type="DbDacFx">
    36             <PreSource Path="data source=localhost;Integrated Security=SSPI;Initial Catalog=HeuristicLab.Authentication" includeData="False" />
     36            <PreSource Path="data source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=HeuristicLab.Authentication" includeData="False" />
    3737            <Source Path="$(IntermediateOutputPath)AutoScripts\HeuristicLab.Authentication_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
    3838          </Object>
    3939          <UpdateFrom Type="Web.Config">
    40             <Source MatchValue="data source=localhost;Integrated Security=SSPI;Initial Catalog=HeuristicLab.Authentication" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
     40            <Source MatchValue="data source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=HeuristicLab.Authentication" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
    4141          </UpdateFrom>
    4242        </ObjectGroup>
    4343      </Objects>
    4444    </PublishDatabaseSettings>
     45    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    4546  </PropertyGroup>
    4647  <ItemGroup>
    4748    <MSDeployParameterValue Include="$(DeployParameterPrefix)HeuristicLab.Authentication-Web.config Connection String" />
    4849    <MSDeployParameterValue Include="$(DeployParameterPrefix)HeuristicLab.Services.Hive.DataAccess.Settings.HeuristicLab_Hive_LinqConnectionString-Web.config Connection String">
    49       <ParameterValue>Data Source=localhost;Initial Catalog=HeuristicLab.Hive-3.3;Integrated Security=True</ParameterValue>
     50      <ParameterValue>Data Source=.\SQLEXPRESS;Initial Catalog=HeuristicLab.Hive-3.3;Integrated Security=True</ParameterValue>
    5051    </MSDeployParameterValue>
    5152  </ItemGroup>
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Web/Hive-3.3/Status.aspx.cs

    r11204 r12395  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2323using System.Collections.Generic;
    2424using System.Linq;
    25 using System.Web;
    26 using System.Web.UI;
    2725using System.Web.UI.WebControls;
    28 using HeuristicLab.Services.Hive.DataAccess;
    2926using HeuristicLab.Services.Hive;
    30 using HeuristicLab.Services.Hive.DataTransfer;
    31 using System.Text;
    3227using System.Web.UI.DataVisualization.Charting;
    3328using DA = HeuristicLab.Services.Hive.DataAccess;
     
    3732  protected void Page_Load(object sender, EventArgs e) {
    3833    var dao = ServiceLocator.Instance.HiveDao;
     34    var optDao = ServiceLocator.Instance.OptimizedHiveDao;
    3935    var transactionManager = ServiceLocator.Instance.TransactionManager;
    4036    var resourceName = Request.QueryString["resource"];
    41     IEnumerable<Guid> resourceIds = new List<Guid>();
    42     IEnumerable<DT.Slave> onlineSlaves = new List<DT.Slave>();
     37    List<Guid> resourceIds = new List<Guid>();
     38    List<DT.Slave> onlineSlaves = new List<DT.Slave>();
    4339    int currentlyJobsWaiting = 0;
    44     Dictionary<Guid, int> calculatingTasksByUser = new Dictionary<Guid,int>();
     40    Dictionary<Guid, int> calculatingTasksByUser = new Dictionary<Guid, int>();
    4541    Dictionary<Guid, int> waitingTasksByUser = new Dictionary<Guid, int>();
    4642    List<DT.Resource> groups = new List<DT.Resource>();
    4743
    4844    transactionManager.UseTransaction(() => {
    49        groups = dao.GetResources(x => x.ResourceType == "GROUP").ToList();
    50     }, false, false);   
     45      groups = dao.GetResources(x => x.ResourceType == "GROUP").ToList();
     46    }, false, false);
    5147
    5248    if (!string.IsNullOrEmpty(resourceName)) {
    53         transactionManager.UseTransaction(() =>
    54         {
    55             var resId = dao.GetResources(x => x.Name == resourceName).Single().Id;
    56             resourceIds = dao.GetChildResources(resId).Select(x => x.Id).Union(new List<Guid> { resId });
    57             calculatingTasksByUser = dao.GetCalculatingTasksByUserForResources(resourceIds.ToList());
    58             waitingTasksByUser = dao.GetWaitingTasksByUserForResources(resourceIds.ToList());
    59         }, false, false);       
     49      transactionManager.UseTransaction(() => {
     50        var resId = dao.GetResources(x => x.Name == resourceName).Single().Id;
     51        resourceIds = dao.GetChildResources(resId).Select(x => x.Id).Union(new List<Guid> { resId }).ToList();
     52        calculatingTasksByUser = dao.GetCalculatingTasksByUserForResources(resourceIds);
     53        waitingTasksByUser = dao.GetWaitingTasksByUserForResources(resourceIds);
     54      }, false, false);
    6055    } else {
    61         transactionManager.UseTransaction(() =>
    62         {
    63              resourceIds = dao.GetResources(x => true).Select(y => y.Id);
    64              calculatingTasksByUser = dao.GetCalculatingTasksByUser();
    65              waitingTasksByUser = dao.GetWaitingTasksByUser();           
    66         }, false, false);
    67     }   
     56      transactionManager.UseTransaction(() => {
     57        resourceIds = optDao.GetAllResourceIds().ToList();
     58        calculatingTasksByUser = optDao.GetCalculatingTasksByUser();
     59        waitingTasksByUser = optDao.GetWaitingTasksByUser();
     60      }, false, false);
     61    }
    6862
    69     transactionManager.UseTransaction(() =>
    70     {                     
    71         onlineSlaves = dao.GetSlaves(x => (x.SlaveState == DA.SlaveState.Calculating || x.SlaveState == DA.SlaveState.Idle) && resourceIds.Contains(x.ResourceId));
    72         currentlyJobsWaiting = dao.GetLightweightTasks(x => x.State == DA.TaskState.Waiting).Count();           
     63    transactionManager.UseTransaction(() => {
     64      if (string.IsNullOrEmpty(resourceName)) {
     65        onlineSlaves = dao.GetSlaves(x => x.SlaveState == DA.SlaveState.Calculating || x.SlaveState == DA.SlaveState.Idle).ToList();
     66      } else {
     67        onlineSlaves = dao.GetSlaves(x => (x.SlaveState == DA.SlaveState.Calculating || x.SlaveState == DA.SlaveState.Idle) && resourceIds.Contains(x.ResourceId)).ToList();
     68      }
     69      currentlyJobsWaiting = optDao.GetNumberOfWaitingTasks();
    7370    }, false, false);
    7471
     
    7673    int currentlyAvailableCores = onlineSlaves.Where(s => s.Cores.HasValue && s.IsAllowedToCalculate).Sum(s => s.Cores.Value);
    7774    int currentlyUsedCores = overallCurrentlyAvailableCores - onlineSlaves.Where(s => s.FreeCores.HasValue).Sum(s => s.FreeCores.Value);
    78    
     75
    7976    this.overallAvailableCoresLabel.Text = overallCurrentlyAvailableCores.ToString();
    8077    this.availableCoresLabel.Text = currentlyAvailableCores.ToString();
     
    8683    groupsLabel.Text += string.Join(", ", groups.Select(x => string.Format("<a href=\"?resource={0}\">{0}</a>", x.Name)));
    8784
    88     overallCpuUtilizationLabel.Text = (onlineSlaves.Count() > 0 ? Math.Round(onlineSlaves.Average(s => s.CpuUtilization), 2).ToString() : "0.0") + " %";
    89     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") + " %";
     85    overallCpuUtilizationLabel.Text = (onlineSlaves.Any() ? Math.Round(onlineSlaves.Average(s => s.CpuUtilization), 2).ToString() : "0.0") + " %";
     86    cpuUtilizationLabel.Text = (onlineSlaves.Any() && onlineSlaves.Any(x => x.IsAllowedToCalculate) ? Math.Round(onlineSlaves.Where(x => x.IsAllowedToCalculate).Average(s => s.CpuUtilization), 2).ToString() : "0.0") + " %";
    9087
    91     DT.Statistics[] stats = new DT.Statistics[0];   
    92     transactionManager.UseTransaction(() =>
    93     {   
    94         if (daysDropDownList.SelectedValue == "All") {
    95           stats = dao.GetStatistics(x => true).OrderBy(x => x.TimeStamp).ToArray();
    96         } else {
    97           stats = dao.GetStatistics(x => x.Timestamp >= DateTime.Now.Subtract(TimeSpan.FromDays(int.Parse(daysDropDownList.SelectedValue)))).OrderBy(x => x.TimeStamp).ToArray();
    98         }
     88    DT.Statistics[] stats = new DT.Statistics[0];
     89    transactionManager.UseTransaction(() => {
     90      if (daysDropDownList.SelectedValue == "All") {
     91        stats = dao.GetStatistics(x => true).OrderBy(x => x.TimeStamp).ToArray();
     92      } else {
     93        stats = dao.GetStatistics(x => x.Timestamp >= DateTime.Now.Subtract(TimeSpan.FromDays(int.Parse(daysDropDownList.SelectedValue)))).OrderBy(x => x.TimeStamp).ToArray();
     94      }
    9995    }, false, false);
    100    
     96
    10197    for (int i = 0; i < stats.Length; i++) {
    10298      var s = stats[i];
    103       var slaveStats = s.SlaveStatistics.Where(x => resourceIds.Contains(x.SlaveId));
     99      var slaveStats = s.SlaveStatistics.Where(x => resourceIds.Contains(x.SlaveId)).ToArray();
    104100
    105       var averageCpuUtilization = slaveStats.Count() > 0 ? slaveStats.Average(x => x.CpuUtilization) : 0.0;
     101      var averageCpuUtilization = slaveStats.Any() ? slaveStats.Average(x => x.CpuUtilization) : 0.0;
    106102      cpuUtilizationChart.Series[0].Points.Add(new DataPoint(s.TimeStamp.ToOADate(), averageCpuUtilization));
    107103
     
    118114    }
    119115
    120     GenerateTasksByUserTable(waitingTasksByUser, waitingTasksByUserTable); 
    121     GenerateTasksByUserTable(calculatingTasksByUser, calculatingTasksByUserTable); 
     116    GenerateTasksByUserTable(waitingTasksByUser, waitingTasksByUserTable);
     117    GenerateTasksByUserTable(calculatingTasksByUser, calculatingTasksByUserTable);
    122118  }
    123119
     
    134130      table.Rows.Add(curRow);
    135131    }
    136     if (tasksByUser.Count() > 0) {
    137       TableRow sumRow = new TableRow();       
     132    if (tasksByUser.Any()) {
     133      TableRow sumRow = new TableRow();
    138134      TableCell sumCell = new TableCell();
    139135      sumCell.BorderWidth = Unit.Pixel(3);
     
    143139      table.Rows.Add(sumRow);
    144140    }
    145   } 
     141  }
    146142}
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Web/Hive-3.3/Web.config

    r9460 r12395  
    33  <configSections>
    44    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    5       <section name="HeuristicLab.Services.Hive.DataAccess.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
     5      <section name="HeuristicLab.Services.Hive.DataAccess.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    66    </sectionGroup>
    77  </configSections>
    8    
     8 
     9  <connectionStrings>
     10    <remove name="HeuristicLab.Authentication" />
     11    <remove name="HeuristicLab.Services.Hive.DataAccess.Settings.HeuristicLab_Hive_LinqConnectionString" />
     12    <add name="HeuristicLab.Authentication" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=HeuristicLab.Authentication" />
     13    <add name="HeuristicLab.Services.Hive.DataAccess.Settings.HeuristicLab_Hive_LinqConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=HeuristicLab.Hive-3.3;Integrated Security=True;" providerName="System.Data.SqlClient" />
     14  </connectionStrings>
     15 
    916  <appSettings>
    10     <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
     17    <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;"/>
    1118  </appSettings>
    1219  <applicationSettings>
    13      <HeuristicLab.Services.Hive.DataAccess.Settings>
     20    <HeuristicLab.Services.Hive.DataAccess.Settings>
    1421      <setting name="LongRunningDatabaseCommandTimeout" serializeAs="String">
    1522        <value>00:05:00</value>
     
    2027    </HeuristicLab.Services.Hive.DataAccess.Settings>
    2128  </applicationSettings>
    22   <connectionStrings>
    23     <add name="HeuristicLab.Authentication" connectionString="data source=localhost;Integrated Security=SSPI;Initial Catalog=HeuristicLab.Authentication"/>
    24    <add name="HeuristicLab.Services.Hive.DataAccess.Settings.HeuristicLab_Hive_LinqConnectionString"
    25       connectionString="Data Source=localhost;Initial Catalog=HeuristicLab.Hive-3.3;Integrated Security=True;"
    26       providerName="System.Data.SqlClient" />
    27   </connectionStrings>
     29 
     30  <!--
     31    For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
     32
     33    The following attributes can be set on the <httpRuntime> tag.
     34      <system.Web>
     35        <httpRuntime targetFramework="4.5" />
     36      </system.Web>
     37  -->
    2838  <system.web>
    29     <authentication mode="Forms" />
    30     <compilation debug="true" targetFramework="4.0">
     39    <authentication mode="Forms"/>
     40    <compilation debug="true" targetFramework="4.5">
    3141      <assemblies>
    3242        <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
     
    3545    <membership>
    3646      <providers>
    37         <clear/>
    38         <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="HeuristicLab.Authentication" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="HeuristicLab.Authentication"/>
     47        <clear />
     48        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="HeuristicLab.Authentication" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="HeuristicLab.Authentication" />
    3949      </providers>
    4050    </membership>
    4151    <roleManager enabled="true">
    4252      <providers>
    43         <clear/>
    44         <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="HeuristicLab.Authentication" applicationName="HeuristicLab.Authentication"/>
     53        <clear />
     54        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="HeuristicLab.Authentication" applicationName="HeuristicLab.Authentication" />
    4555      </providers>
    4656    </roleManager>
    4757    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
    4858      <controls>
    49         <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
    50          assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
     59        <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    5160      </controls>
    5261    </pages>
     
    6069      <wsHttpBinding>
    6170        <binding name="WSHttpBinding_IHiveService" messageEncoding="Mtom" receiveTimeout="00:15:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
    62           <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
     71          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
    6372          <security mode="Message">
    6473            <transport clientCredentialType="Certificate"/>
     
    6978      <netTcpBinding>
    7079        <binding name="NetTcpBinding_IHiveService" portSharingEnabled="true" receiveTimeout="00:15:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
    71           <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
     80          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
    7281          <security mode="TransportWithMessageCredential">
    7382            <transport clientCredentialType="Certificate"/>
     
    100109        <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" name="MexTcpEndpoint" contract="IMetadataExchange"/>
    101110        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHiveService" name="WSHttpBinding_IHiveService" contract="HeuristicLab.Services.Hive.ServiceContracts.IHiveService"/>
    102         <endpoint address="net.tcp://testhive.fh-hagenberg.at/Hive-3.3/HiveService.svc" binding="netTcpBinding"  bindingConfiguration="NetTcpBinding_IHiveService" name="NetBinding_IHiveService" contract="HeuristicLab.Services.Hive.ServiceContracts.IHiveService"/>
     111        <endpoint address="net.tcp://localhost/Hive-3.3/HiveService.svc" binding="netTcpBinding"  bindingConfiguration="NetTcpBinding_IHiveService" name="NetBinding_IHiveService" contract="HeuristicLab.Services.Hive.ServiceContracts.IHiveService"/>
    103112      </service>
    104113    </services>
     
    106115  </system.serviceModel>
    107116  <system.webServer>
    108     <directoryBrowse enabled="true" />
     117    <directoryBrowse enabled="true"/>
    109118    <handlers>
    110       <remove name="ChartImageHandler" />
    111       <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST"
    112        path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
     119      <remove name="ChartImageHandler"/>
     120      <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    113121    </handlers>
    114   </system.webServer> 
     122  </system.webServer>
    115123</configuration>
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Web/Hive-3.3/website.publishproj

    r9589 r12395  
    2121    <SourceWebVirtualPath>/Hive-3.3</SourceWebVirtualPath>
    2222    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    23     <SourceWebProject>
    24     </SourceWebProject>
    25     <SourceWebMetabasePath>
    26     </SourceWebMetabasePath>
     23    <SourceWebProject>C:\dglaser\HiveStatistics\sources\HeuristicLab.Services.Hive.Web\Hive-3.3</SourceWebProject>
     24    <SourceWebMetabasePath>/IISExpress/7.5/LM/W3SVC/4/ROOT</SourceWebMetabasePath>
    2725  </PropertyGroup>
    2826  <PropertyGroup>
Note: See TracChangeset for help on using the changeset viewer.