Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6229 for branches


Ignore:
Timestamp:
05/17/11 18:29:41 (14 years ago)
Author:
cneumuel
Message:

#1233

  • added basic statistics recording for (once per minute)
    • executiontime per user
    • usedcores, usedmemory per slave
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
3 added
14 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/JobResultPoller.cs

    r6219 r6229  
    100100          IsPolling = false;
    101101        }
     102        if (stopRequested) return;
    102103        if (!autoResumeOnException) return;
    103104      }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/RefreshableHiveExperiment.cs

    r6219 r6229  
    175175    }
    176176    private void jobResultPoller_IsPollingChanged(object sender, EventArgs e) {
    177       this.refreshAutomatically = jobResultPoller.IsPolling;
    178       OnRefreshAutomaticallyChanged();
     177      if (this.refreshAutomatically != jobResultPoller.IsPolling) {
     178        this.refreshAutomatically = jobResultPoller.IsPolling;
     179        OnRefreshAutomaticallyChanged();
     180      }
    179181    }
    180182    private void jobResultPoller_JobResultReceived(object sender, EventArgs<IEnumerable<LightweightJob>> e) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/Slave.cs

    r5614 r6229  
    5151    [DataMember]
    5252    public DateTime? LastHeartbeat { get; set; }
     53    [DataMember]
     54    public double CpuUtilization { get; set; }
    5355
    5456    public Slave() {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/HeuristicLab.Services.Hive.Common-3.4.csproj

    r6000 r6229  
    9595  <ItemGroup>
    9696    <Compile Include="ApplicationConstants.cs" />
     97    <Compile Include="DataTransfer\SlaveStatistics.cs" />
     98    <Compile Include="DataTransfer\Statistics.cs" />
     99    <Compile Include="DataTransfer\UserStatistics.cs" />
    97100    <Compile Include="ServiceFaults\PluginAlreadyExistsFault.cs" />
    98101    <None Include="HeuristicLabServicesHiveCommonPlugin.cs.frame" />
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs

    r6006 r6229  
    213213        CpuArchitecture = source.CpuArchitecture,
    214214        OperatingSystem = source.OperatingSystem,
    215         LastHeartbeat = source.LastHeartbeat
     215        LastHeartbeat = source.LastHeartbeat,
     216        CpuUtilization = source.CpuUtilization
    216217      };
    217218    }
     
    236237        target.OperatingSystem = source.OperatingSystem;
    237238        target.LastHeartbeat = source.LastHeartbeat;
     239        target.CpuUtilization = source.CpuUtilization;
    238240      }
    239241    }
     
    273275    }
    274276    #endregion
     277
     278    #region Statistics
     279    public static DT.Statistics ToDto(Statistics source) {
     280      if (source == null) return null;
     281      return new DT.Statistics {
     282        Id = source.StatisticsId,
     283        TimeStamp = source.Timestamp,
     284        SlaveStatistics = source.SlaveStatistics.Select(x => Convert.ToDto(x)).ToArray(),
     285        UserStatistics = source.UserStatistics.Select(x => Convert.ToDto(x)).ToArray()
     286      };
     287    }
     288    public static Statistics ToEntity(DT.Statistics source) {
     289      if (source == null) return null;
     290      var entity = new Statistics(); ToEntity(source, entity);
     291      return entity;
     292    }
     293    public static void ToEntity(DT.Statistics source, Statistics target) {
     294      if ((source != null) && (target != null)) {
     295        target.StatisticsId = source.Id;
     296        target.Timestamp = source.TimeStamp;
     297
     298      }
     299    }
     300    #endregion
     301
     302    #region SlaveStatistics
     303    public static DT.SlaveStatistics ToDto(SlaveStatistics source) {
     304      if (source == null) return null;
     305      return new DT.SlaveStatistics {
     306        Id = source.StatisticsId,
     307        SlaveId = source.SlaveId,
     308        Cores = source.Cores,
     309        CpuUtilization = source.CpuUtilization,
     310        FreeCores = source.FreeCores,
     311        FreeMemory = source.FreeMemory,
     312        Memory = source.Memory
     313      };
     314    }
     315    public static SlaveStatistics ToEntity(DT.SlaveStatistics source) {
     316      if (source == null) return null;
     317      var entity = new SlaveStatistics(); ToEntity(source, entity);
     318      return entity;
     319    }
     320    public static void ToEntity(DT.SlaveStatistics source, SlaveStatistics target) {
     321      if ((source != null) && (target != null)) {
     322        target.StatisticsId = source.Id;
     323        target.SlaveId = source.SlaveId;
     324        target.Cores = source.Cores;
     325        target.CpuUtilization = source.CpuUtilization;
     326        target.FreeCores = source.FreeCores;
     327        target.FreeMemory = source.FreeMemory;
     328        target.Memory = source.Memory;
     329      }
     330    }
     331    #endregion
     332
     333    #region UserStatistics
     334    public static DT.UserStatistics ToDto(UserStatistics source) {
     335      if (source == null) return null;
     336      return new DT.UserStatistics {
     337        Id = source.StatisticsId,
     338        UserId = source.UserId,
     339        UsedCores = source.UsedCores,
     340        ExecutionTime = string.IsNullOrEmpty(source.ExecutionTime) ? TimeSpan.Zero : TimeSpan.Parse(source.ExecutionTime),
     341        ExecutionTimeFinishedJobs = string.IsNullOrEmpty(source.ExecutionTimeFinishedJobs) ? TimeSpan.Zero : TimeSpan.Parse(source.ExecutionTimeFinishedJobs),
     342        StartToEndTime = string.IsNullOrEmpty(source.StartToEndTime) ? TimeSpan.Zero : TimeSpan.Parse(source.StartToEndTime)
     343      };
     344    }
     345    public static UserStatistics ToEntity(DT.UserStatistics source) {
     346      if (source == null) return null;
     347      var entity = new UserStatistics(); ToEntity(source, entity);
     348      return entity;
     349    }
     350    public static void ToEntity(DT.UserStatistics source, UserStatistics target) {
     351      if ((source != null) && (target != null)) {
     352        target.StatisticsId = source.Id;
     353        target.UserId = source.UserId;
     354        target.UsedCores = source.UsedCores;
     355        target.ExecutionTime = source.ExecutionTime.ToString();
     356        target.ExecutionTimeFinishedJobs = source.ExecutionTimeFinishedJobs.ToString();
     357        target.StartToEndTime = source.StartToEndTime.ToString();
     358      }
     359    }
     360    #endregion
    275361  }
    276362}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs

    r6110 r6229  
    9797                       && (from child in db.Jobs
    9898                           where child.ParentJobId == ar.Job.JobId
    99                            select child.State == JobState.Finished 
    100                                || child.State == JobState.Aborted 
     99                           select child.State == JobState.Finished
     100                               || child.State == JobState.Aborted
    101101                               || child.State == JobState.Failed).All(x => x)
    102102                       && (from child in db.Jobs // avoid returning WaitForChildJobs jobs where no child-jobs exist (yet)
     
    607607    #endregion
    608608
    609     #region AppointmentMethods
     609    #region Appointment Methods
    610610    public Appointment GetAppointment(Guid id) {
    611611      using (var db = CreateContext()) {
     
    643643        if (entity != null) db.UptimeCalendars.DeleteOnSubmit(entity);
    644644        db.SubmitChanges();
     645      }
     646    }
     647    #endregion
     648
     649    #region Statistics Methods
     650    public DT.Statistics GetStatistic(Guid id) {
     651      using (var db = CreateContext()) {
     652        return Convert.ToDto(db.Statistics.SingleOrDefault(x => x.StatisticsId == id));
     653
     654      }
     655    }
     656
     657    public IEnumerable<DT.Statistics> GetStatistics(Expression<Func<Statistics, bool>> predicate) {
     658      using (var db = CreateContext()) {
     659        return db.Statistics.Where(predicate).Select(x => Convert.ToDto(x)).ToArray();
     660      }
     661    }
     662
     663    public Guid AddStatistics(DT.Statistics dto) {
     664      using (var db = CreateContext()) {
     665        var entity = Convert.ToEntity(dto);
     666        db.Statistics.InsertOnSubmit(entity);
     667        db.SubmitChanges();
     668        foreach (var slaveStat in dto.SlaveStatistics) {
     669          slaveStat.Id = entity.StatisticsId;
     670          db.SlaveStatistics.InsertOnSubmit(Convert.ToEntity(slaveStat));
     671        }
     672        foreach (var userStat in dto.UserStatistics) {
     673          userStat.Id = entity.StatisticsId;
     674          db.UserStatistics.InsertOnSubmit(Convert.ToEntity(userStat));
     675        }
     676        db.SubmitChanges();
     677        return entity.StatisticsId;
     678      }
     679    }
     680
     681    public void DeleteStatistics(Guid id) {
     682      using (var db = CreateContext()) {
     683        var entity = db.Statistics.FirstOrDefault(x => x.StatisticsId == id);
     684        if (entity != null) db.Statistics.DeleteOnSubmit(entity);
     685        db.SubmitChanges();
     686      }
     687    }
     688
     689    public List<DT.UserStatistics> GetUserStatistics() {
     690      using (var db = CreateContext()) {
     691        var executionTimesByUser = from job in db.Jobs
     692                                   group job by job.HiveExperiment.OwnerUserId into g
     693                                   select new { UserId = g.Key, ExecutionTimes = g.Select(x => x.ExecutionTime) };
     694
     695        var userStats = new List<DT.UserStatistics>();
     696        foreach (var item in executionTimesByUser) {
     697          userStats.Add(new DT.UserStatistics() {
     698            UserId = item.UserId,
     699            ExecutionTime = TimeSpan.FromMilliseconds(item.ExecutionTimes.Select(x => string.IsNullOrEmpty(x) ? 0 : TimeSpan.Parse(x).TotalMilliseconds).Sum())
     700          });
     701        }
     702
     703        // Todo: also consider executiontimes of DeletedJobStats
     704        // Todo: compute executionTimeFinishedJobs und StartToEndTime (=> dient zum errechnen der Efficiency/Overhead)
     705
     706        return userStats;
    645707      }
    646708    }
     
    657719    }
    658720    #endregion
     721
     722
     723
    659724  }
    660725}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.cs

    r4593 r6229  
    11namespace HeuristicLab.Services.Hive.DataAccess {
     2  partial class SlaveStatistics {
     3  }
     4
    25  partial class HiveDataContext {
    36  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml

    r6006 r6229  
    5353        <Column Name="OperatingSystem" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" UpdateCheck="Never" />
    5454        <Column Name="LastHeartbeat" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
     55        <Column Name="CpuUtilization" Type="System.Double" DbType="float" CanBeNull="false" />
    5556      </Type>
    5657      <Type Name="SlaveGroup" InheritanceCode="GROUP" />
     
    102103      <Column Name="LastAccessed" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
    103104      <Column Name="IsHiveEngine" Type="System.Boolean" DbType="Bit" CanBeNull="false" />
     105      <Association Name="HiveExperiment_Job" Member="Jobs" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="Job" />
    104106      <Association Name="HiveExperiment_HiveExperimentPermission" Member="HiveExperimentPermissions" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="HiveExperimentPermission" />
    105       <Association Name="HiveExperiment_Job" Member="Jobs" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="Job" />
    106107    </Type>
    107108  </Table>
     
    151152    </Type>
    152153  </Table>
     154  <Table Name="" Member="DeletedJobStatistics">
     155    <Type Name="DeletedJobStatistics">
     156      <Column Member="UserId" Type="System.String" IsPrimaryKey="true" CanBeNull="false" />
     157      <Column Name="ExecutionTime" Type="System.String" DbType="VarChar(30)" CanBeNull="false" />
     158      <Column Name="ExecutionTimeFinishedJobs" Type="System.String" DbType="VarChar(30)" CanBeNull="false" />
     159      <Column Name="StartToEndTime" Type="System.String" DbType="VarChar(30)" CanBeNull="false" />
     160    </Type>
     161  </Table>
     162  <Table Name="" Member="UserStatistics">
     163    <Type Name="UserStatistics">
     164      <Column Name="StatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
     165      <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
     166      <Column Name="ExecutionTime" Type="System.String" DbType="VarChar(30)" CanBeNull="false" />
     167      <Column Name="UsedCores" Storage="_CoresUsed" Type="System.Int32" DbType="Int" CanBeNull="false" />
     168      <Column Name="ExecutionTimeFinishedJobs" Type="System.String" DbType="VarChar(30)" CanBeNull="false" />
     169      <Column Name="StartToEndTime" Type="System.String" DbType="VarChar(30)" CanBeNull="false" />
     170      <Association Name="Statistics_UserStatistics" Member="Statistics" ThisKey="StatisticsId" OtherKey="StatisticsId" Type="Statistics" IsForeignKey="true" />
     171    </Type>
     172  </Table>
     173  <Table Name="" Member="SlaveStatistics">
     174    <Type Name="SlaveStatistics">
     175      <Column Name="StatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
     176      <Column Name="SlaveId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
     177      <Column Name="Cores" Type="System.Int32" DbType="Int" CanBeNull="false" />
     178      <Column Name="FreeCores" Type="System.Int32" DbType="Int" CanBeNull="false" />
     179      <Column Name="CpuUtilization" Type="System.Double" DbType="float" CanBeNull="false" />
     180      <Column Name="Memory" Type="System.Int32" DbType="Int" CanBeNull="false" />
     181      <Column Name="FreeMemory" Type="System.Int32" DbType="Int" CanBeNull="false" />
     182      <Association Name="Statistics_SlaveStatistics" Member="Statistics" ThisKey="StatisticsId" OtherKey="StatisticsId" Type="Statistics" IsForeignKey="true" />
     183    </Type>
     184  </Table>
     185  <Table Name="" Member="Statistics">
     186    <Type Name="Statistics">
     187      <Column Name="StatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
     188      <Column Name="Timestamp" Type="System.DateTime" CanBeNull="false" />
     189      <Association Name="Statistics_UserStatistics" Member="UserStatistics" ThisKey="StatisticsId" OtherKey="StatisticsId" Type="UserStatistics" />
     190      <Association Name="Statistics_SlaveStatistics" Member="SlaveStatistics" ThisKey="StatisticsId" OtherKey="StatisticsId" Type="SlaveStatistics" />
     191    </Type>
     192  </Table>
    153193</Database>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout

    r6006 r6229  
    11<?xml version="1.0" encoding="utf-8"?>
    2 <ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 15.75, 8.5" name="HiveDataContext">
     2<ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 24.25, 8.5" name="HiveDataContext">
    33  <DataContextMoniker Name="/HiveDataContext" />
    44  <nestedChildShapes>
    5     <classShape Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" absoluteBounds="8.875, 3.875, 2, 1.3862939453124987">
     5    <classShape Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" absoluteBounds="8.875, 4, 2, 1.3862939453124987">
    66      <DataClassMoniker Name="/HiveDataContext/AssignedResource" />
    77      <nestedChildShapes>
    8         <elementListCompartment Id="8b005775-f0ee-41b0-ae10-6d1151003708" absoluteBounds="8.89, 4.3350000000000009, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     8        <elementListCompartment Id="8b005775-f0ee-41b0-ae10-6d1151003708" absoluteBounds="8.89, 4.4600000000000009, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    99      </nestedChildShapes>
    1010    </classShape>
     
    4545      </nestedChildShapes>
    4646    </classShape>
    47     <classShape Id="26f4edfa-91dd-4941-a058-359f89e567a8" absoluteBounds="8.875, 0.75, 2, 2.9247054036458331">
     47    <classShape Id="26f4edfa-91dd-4941-a058-359f89e567a8" absoluteBounds="8.875, 0.75, 2, 3.1170068359375">
    4848      <DataClassMoniker Name="/HiveDataContext/Slave" />
    4949      <nestedChildShapes>
    50         <elementListCompartment Id="1e61f36b-08dc-4df7-8594-c9dcd95c0791" absoluteBounds="8.89, 1.21, 1.9700000000000002, 2.364705403645833" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     50        <elementListCompartment Id="1e61f36b-08dc-4df7-8594-c9dcd95c0791" absoluteBounds="8.89, 1.21, 1.9700000000000002, 2.5570068359375" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    5151      </nestedChildShapes>
    5252    </classShape>
     
    6969      </nodes>
    7070    </inheritanceConnector>
    71     <associationConnector edgePoints="[(11.9843735 : 2.57859537760417); (11.9843735 : 4.56814697265625); (10.875 : 4.56814697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     71    <associationConnector edgePoints="[(11.9843735 : 2.57859537760417); (11.9843735 : 4.69314697265625); (10.875 : 4.69314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    7272      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_AssignedResource" />
    7373      <nodes>
     
    7676      </nodes>
    7777    </associationConnector>
    78     <associationConnector edgePoints="[(7.8398428125 : 4.1170068359375); (7.8398428125 : 4.689150890625); (8.875 : 4.689150890625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     78    <associationConnector edgePoints="[(7.5 : 4.1170068359375); (7.5 : 4.751650890625); (8.875 : 4.751650890625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    7979      <AssociationMoniker Name="/HiveDataContext/Job/Job_AssignedResource" />
    8080      <nodes>
     
    8383      </nodes>
    8484    </associationConnector>
    85     <associationConnector edgePoints="[(7.10742140625 : 4.1170068359375); (7.10742140625 : 5.5)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     85    <associationConnector edgePoints="[(7.10742140625 : 4.1170068359375); (7.10742140625 : 5.5)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    8686      <AssociationMoniker Name="/HiveDataContext/Job/Job_RequiredPlugin" />
    8787      <nodes>
     
    123123      </nodes>
    124124    </associationConnector>
    125     <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     125    <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    126126      <AssociationMoniker Name="/HiveDataContext/Job/Job_JobData" />
    127127      <nodes>
     
    156156      </nestedChildShapes>
    157157    </classShape>
    158     <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     158    <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    159159      <AssociationMoniker Name="/HiveDataContext/Job/Job_StateLog" />
    160160      <nodes>
     
    163163      </nodes>
    164164    </associationConnector>
    165     <associationConnector edgePoints="[(11.25 : 1.78929768880208); (10.9375 : 1.78929768880208); (10.9375 : 0.6875); (2.75 : 0.6875); (2.75 : 1)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     165    <associationConnector edgePoints="[(11.25 : 1.36339684440104); (10.9375 : 1.36339684440104); (10.9375 : 0.6875); (2.75 : 0.6875); (2.75 : 1)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    166166      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_StateLog" />
    167167      <nodes>
     
    170170      </nodes>
    171171    </associationConnector>
    172     <associationConnector edgePoints="[(4.125 : 4.29890055338542); (3.75 : 4.29890055338542)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     172    <associationConnector edgePoints="[(4.125 : 4.29890055338542); (3.75 : 4.29890055338542)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    173173      <AssociationMoniker Name="/HiveDataContext/HiveExperiment/HiveExperiment_HiveExperimentPermission" />
    174174      <nodes>
     
    183183      </nestedChildShapes>
    184184    </classShape>
    185     <associationConnector edgePoints="[(6.125 : 3.37100341796875); (6.5 : 3.37100341796875)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     185    <associationConnector edgePoints="[(6.125 : 3.37100341796875); (6.5 : 3.37100341796875)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    186186      <AssociationMoniker Name="/HiveDataContext/HiveExperiment/HiveExperiment_Job" />
    187187      <nodes>
    188188        <classShapeMoniker Id="e6f840cc-2968-4be1-b234-eef624ccacbb" />
    189189        <classShapeMoniker Id="695bfc39-59f3-4e60-8644-f847964bf62c" />
     190      </nodes>
     191    </associationConnector>
     192    <classShape Id="cdddf4da-eaef-46a1-9cfd-987bb6b3d03e" absoluteBounds="17, 3.125, 2, 1.5785953776041666">
     193      <DataClassMoniker Name="/HiveDataContext/DeletedJobStatistics" />
     194      <nestedChildShapes>
     195        <elementListCompartment Id="b8738381-f696-4dba-a517-47e9cd96a9a6" absoluteBounds="17.015, 3.585, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     196      </nestedChildShapes>
     197    </classShape>
     198    <classShape Id="25442617-ff41-49a0-b5d5-4cbe0b2f0f45" absoluteBounds="22, 4.5, 2, 1.9631982421874996">
     199      <DataClassMoniker Name="/HiveDataContext/UserStatistics" />
     200      <nestedChildShapes>
     201        <elementListCompartment Id="6edf08e7-054a-4253-8d4f-5bf2dfec2d29" absoluteBounds="22.015, 4.96, 1.9700000000000002, 1.4031982421875" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     202      </nestedChildShapes>
     203    </classShape>
     204    <classShape Id="f78ec989-4862-4bac-87e3-9b0aad4bc037" absoluteBounds="19.875, 4.5, 2, 2.1554996744791666">
     205      <DataClassMoniker Name="/HiveDataContext/SlaveStatistics" />
     206      <nestedChildShapes>
     207        <elementListCompartment Id="98cb46fe-820e-4041-aee8-04e8bed3df23" absoluteBounds="19.89, 4.96, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     208      </nestedChildShapes>
     209    </classShape>
     210    <classShape Id="4d9f0606-b7ee-4dae-a8ac-aff88d25a941" absoluteBounds="21, 3, 2, 1.1939925130208327">
     211      <DataClassMoniker Name="/HiveDataContext/Statistics" />
     212      <nestedChildShapes>
     213        <elementListCompartment Id="17821282-8edf-40b7-9065-84f53391d5c1" absoluteBounds="21.015, 3.46, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     214      </nestedChildShapes>
     215    </classShape>
     216    <associationConnector edgePoints="[(21.4375 : 4.19399251302083); (21.4375 : 4.5)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     217      <AssociationMoniker Name="/HiveDataContext/Statistics/Statistics_SlaveStatistics" />
     218      <nodes>
     219        <classShapeMoniker Id="4d9f0606-b7ee-4dae-a8ac-aff88d25a941" />
     220        <classShapeMoniker Id="f78ec989-4862-4bac-87e3-9b0aad4bc037" />
     221      </nodes>
     222    </associationConnector>
     223    <associationConnector edgePoints="[(22.5 : 4.19399251302083); (22.5 : 4.5)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     224      <AssociationMoniker Name="/HiveDataContext/Statistics/Statistics_UserStatistics" />
     225      <nodes>
     226        <classShapeMoniker Id="4d9f0606-b7ee-4dae-a8ac-aff88d25a941" />
     227        <classShapeMoniker Id="25442617-ff41-49a0-b5d5-4cbe0b2f0f45" />
    190228      </nodes>
    191229    </associationConnector>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs

    r6006 r6229  
    33// <auto-generated>
    44//     This code was generated by a tool.
    5 //     Runtime Version:4.0.30319.208
     5//     Runtime Version:4.0.30319.225
    66//
    77//     Changes to this file may cause incorrect behavior and will be lost if
     
    6767    partial void UpdateLifecycle(Lifecycle instance);
    6868    partial void DeleteLifecycle(Lifecycle instance);
     69    partial void InsertDeletedJobStatistics(DeletedJobStatistics instance);
     70    partial void UpdateDeletedJobStatistics(DeletedJobStatistics instance);
     71    partial void DeleteDeletedJobStatistics(DeletedJobStatistics instance);
     72    partial void InsertUserStatistics(UserStatistics instance);
     73    partial void UpdateUserStatistics(UserStatistics instance);
     74    partial void DeleteUserStatistics(UserStatistics instance);
     75    partial void InsertSlaveStatistics(SlaveStatistics instance);
     76    partial void UpdateSlaveStatistics(SlaveStatistics instance);
     77    partial void DeleteSlaveStatistics(SlaveStatistics instance);
     78    partial void InsertStatistics(Statistics instance);
     79    partial void UpdateStatistics(Statistics instance);
     80    partial void DeleteStatistics(Statistics instance);
    6981    #endregion
    7082   
     
    186198      {
    187199        return this.GetTable<Lifecycle>();
     200      }
     201    }
     202   
     203    public System.Data.Linq.Table<DeletedJobStatistics> DeletedJobStatistics
     204    {
     205      get
     206      {
     207        return this.GetTable<DeletedJobStatistics>();
     208      }
     209    }
     210   
     211    public System.Data.Linq.Table<UserStatistics> UserStatistics
     212    {
     213      get
     214      {
     215        return this.GetTable<UserStatistics>();
     216      }
     217    }
     218   
     219    public System.Data.Linq.Table<SlaveStatistics> SlaveStatistics
     220    {
     221      get
     222      {
     223        return this.GetTable<SlaveStatistics>();
     224      }
     225    }
     226   
     227    public System.Data.Linq.Table<Statistics> Statistics
     228    {
     229      get
     230      {
     231        return this.GetTable<Statistics>();
    188232      }
    189233    }
     
    11261170   
    11271171    private System.Nullable<System.DateTime> _LastHeartbeat;
     1172   
     1173    private double _CpuUtilization;
    11281174   
    11291175    #region Extensibility Method Definitions
     
    11531199    partial void OnLastHeartbeatChanging(System.Nullable<System.DateTime> value);
    11541200    partial void OnLastHeartbeatChanged();
     1201    partial void OnCpuUtilizationChanging(double value);
     1202    partial void OnCpuUtilizationChanged();
    11551203    #endregion
    11561204   
     
    13761424          this.SendPropertyChanged("LastHeartbeat");
    13771425          this.OnLastHeartbeatChanged();
     1426        }
     1427      }
     1428    }
     1429   
     1430    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CpuUtilization", DbType="float")]
     1431    public double CpuUtilization
     1432    {
     1433      get
     1434      {
     1435        return this._CpuUtilization;
     1436      }
     1437      set
     1438      {
     1439        if ((this._CpuUtilization != value))
     1440        {
     1441          this.OnCpuUtilizationChanging(value);
     1442          this.SendPropertyChanging();
     1443          this._CpuUtilization = value;
     1444          this.SendPropertyChanged("CpuUtilization");
     1445          this.OnCpuUtilizationChanged();
    13781446        }
    13791447      }
     
    22172285    private bool _IsHiveEngine;
    22182286   
     2287    private EntitySet<Job> _Jobs;
     2288   
    22192289    private EntitySet<HiveExperimentPermission> _HiveExperimentPermissions;
    2220    
    2221     private EntitySet<Job> _Jobs;
    22222290   
    22232291    #region Extensibility Method Definitions
     
    22452313    public HiveExperiment()
    22462314    {
     2315      this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs));
    22472316      this._HiveExperimentPermissions = new EntitySet<HiveExperimentPermission>(new Action<HiveExperimentPermission>(this.attach_HiveExperimentPermissions), new Action<HiveExperimentPermission>(this.detach_HiveExperimentPermissions));
    2248       this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs));
    22492317      OnCreated();
    22502318    }
     
    24102478    }
    24112479   
     2480    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_Job", Storage="_Jobs", ThisKey="HiveExperimentId", OtherKey="HiveExperimentId")]
     2481    public EntitySet<Job> Jobs
     2482    {
     2483      get
     2484      {
     2485        return this._Jobs;
     2486      }
     2487      set
     2488      {
     2489        this._Jobs.Assign(value);
     2490      }
     2491    }
     2492   
    24122493    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_HiveExperimentPermission", Storage="_HiveExperimentPermissions", ThisKey="HiveExperimentId", OtherKey="HiveExperimentId")]
    24132494    public EntitySet<HiveExperimentPermission> HiveExperimentPermissions
     
    24232504    }
    24242505   
    2425     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_Job", Storage="_Jobs", ThisKey="HiveExperimentId", OtherKey="HiveExperimentId")]
    2426     public EntitySet<Job> Jobs
    2427     {
    2428       get
    2429       {
    2430         return this._Jobs;
    2431       }
    2432       set
    2433       {
    2434         this._Jobs.Assign(value);
    2435       }
    2436     }
    2437    
    24382506    public event PropertyChangingEventHandler PropertyChanging;
    24392507   
     
    24562524    }
    24572525   
    2458     private void attach_HiveExperimentPermissions(HiveExperimentPermission entity)
     2526    private void attach_Jobs(Job entity)
    24592527    {
    24602528      this.SendPropertyChanging();
     
    24622530    }
    24632531   
    2464     private void detach_HiveExperimentPermissions(HiveExperimentPermission entity)
     2532    private void detach_Jobs(Job entity)
    24652533    {
    24662534      this.SendPropertyChanging();
     
    24682536    }
    24692537   
    2470     private void attach_Jobs(Job entity)
     2538    private void attach_HiveExperimentPermissions(HiveExperimentPermission entity)
    24712539    {
    24722540      this.SendPropertyChanging();
     
    24742542    }
    24752543   
    2476     private void detach_Jobs(Job entity)
     2544    private void detach_HiveExperimentPermissions(HiveExperimentPermission entity)
    24772545    {
    24782546      this.SendPropertyChanging();
     
    33553423    }
    33563424  }
     3425 
     3426  [global::System.Data.Linq.Mapping.TableAttribute(Name="")]
     3427  public partial class DeletedJobStatistics : INotifyPropertyChanging, INotifyPropertyChanged
     3428  {
     3429   
     3430    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
     3431   
     3432    private string _UserId;
     3433   
     3434    private string _ExecutionTime;
     3435   
     3436    private string _ExecutionTimeFinishedJobs;
     3437   
     3438    private string _StartToEndTime;
     3439   
     3440    #region Extensibility Method Definitions
     3441    partial void OnLoaded();
     3442    partial void OnValidate(System.Data.Linq.ChangeAction action);
     3443    partial void OnCreated();
     3444    partial void OnUserIdChanging(string value);
     3445    partial void OnUserIdChanged();
     3446    partial void OnExecutionTimeChanging(string value);
     3447    partial void OnExecutionTimeChanged();
     3448    partial void OnExecutionTimeFinishedJobsChanging(string value);
     3449    partial void OnExecutionTimeFinishedJobsChanged();
     3450    partial void OnStartToEndTimeChanging(string value);
     3451    partial void OnStartToEndTimeChanged();
     3452    #endregion
     3453   
     3454    public DeletedJobStatistics()
     3455    {
     3456      OnCreated();
     3457    }
     3458   
     3459    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", CanBeNull=false, IsPrimaryKey=true)]
     3460    public string UserId
     3461    {
     3462      get
     3463      {
     3464        return this._UserId;
     3465      }
     3466      set
     3467      {
     3468        if ((this._UserId != value))
     3469        {
     3470          this.OnUserIdChanging(value);
     3471          this.SendPropertyChanging();
     3472          this._UserId = value;
     3473          this.SendPropertyChanged("UserId");
     3474          this.OnUserIdChanged();
     3475        }
     3476      }
     3477    }
     3478   
     3479    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="VarChar(30)", CanBeNull=false)]
     3480    public string ExecutionTime
     3481    {
     3482      get
     3483      {
     3484        return this._ExecutionTime;
     3485      }
     3486      set
     3487      {
     3488        if ((this._ExecutionTime != value))
     3489        {
     3490          this.OnExecutionTimeChanging(value);
     3491          this.SendPropertyChanging();
     3492          this._ExecutionTime = value;
     3493          this.SendPropertyChanged("ExecutionTime");
     3494          this.OnExecutionTimeChanged();
     3495        }
     3496      }
     3497    }
     3498   
     3499    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="VarChar(30)", CanBeNull=false)]
     3500    public string ExecutionTimeFinishedJobs
     3501    {
     3502      get
     3503      {
     3504        return this._ExecutionTimeFinishedJobs;
     3505      }
     3506      set
     3507      {
     3508        if ((this._ExecutionTimeFinishedJobs != value))
     3509        {
     3510          this.OnExecutionTimeFinishedJobsChanging(value);
     3511          this.SendPropertyChanging();
     3512          this._ExecutionTimeFinishedJobs = value;
     3513          this.SendPropertyChanged("ExecutionTimeFinishedJobs");
     3514          this.OnExecutionTimeFinishedJobsChanged();
     3515        }
     3516      }
     3517    }
     3518   
     3519    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="VarChar(30)", CanBeNull=false)]
     3520    public string StartToEndTime
     3521    {
     3522      get
     3523      {
     3524        return this._StartToEndTime;
     3525      }
     3526      set
     3527      {
     3528        if ((this._StartToEndTime != value))
     3529        {
     3530          this.OnStartToEndTimeChanging(value);
     3531          this.SendPropertyChanging();
     3532          this._StartToEndTime = value;
     3533          this.SendPropertyChanged("StartToEndTime");
     3534          this.OnStartToEndTimeChanged();
     3535        }
     3536      }
     3537    }
     3538   
     3539    public event PropertyChangingEventHandler PropertyChanging;
     3540   
     3541    public event PropertyChangedEventHandler PropertyChanged;
     3542   
     3543    protected virtual void SendPropertyChanging()
     3544    {
     3545      if ((this.PropertyChanging != null))
     3546      {
     3547        this.PropertyChanging(this, emptyChangingEventArgs);
     3548      }
     3549    }
     3550   
     3551    protected virtual void SendPropertyChanged(String propertyName)
     3552    {
     3553      if ((this.PropertyChanged != null))
     3554      {
     3555        this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
     3556      }
     3557    }
     3558  }
     3559 
     3560  [global::System.Data.Linq.Mapping.TableAttribute(Name="")]
     3561  public partial class UserStatistics : INotifyPropertyChanging, INotifyPropertyChanged
     3562  {
     3563   
     3564    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
     3565   
     3566    private System.Guid _StatisticsId;
     3567   
     3568    private System.Guid _UserId;
     3569   
     3570    private string _ExecutionTime;
     3571   
     3572    private int _CoresUsed;
     3573   
     3574    private string _ExecutionTimeFinishedJobs;
     3575   
     3576    private string _StartToEndTime;
     3577   
     3578    private EntityRef<Statistics> _Statistics;
     3579   
     3580    #region Extensibility Method Definitions
     3581    partial void OnLoaded();
     3582    partial void OnValidate(System.Data.Linq.ChangeAction action);
     3583    partial void OnCreated();
     3584    partial void OnStatisticsIdChanging(System.Guid value);
     3585    partial void OnStatisticsIdChanged();
     3586    partial void OnUserIdChanging(System.Guid value);
     3587    partial void OnUserIdChanged();
     3588    partial void OnExecutionTimeChanging(string value);
     3589    partial void OnExecutionTimeChanged();
     3590    partial void OnUsedCoresChanging(int value);
     3591    partial void OnUsedCoresChanged();
     3592    partial void OnExecutionTimeFinishedJobsChanging(string value);
     3593    partial void OnExecutionTimeFinishedJobsChanged();
     3594    partial void OnStartToEndTimeChanging(string value);
     3595    partial void OnStartToEndTimeChanged();
     3596    #endregion
     3597   
     3598    public UserStatistics()
     3599    {
     3600      this._Statistics = default(EntityRef<Statistics>);
     3601      OnCreated();
     3602    }
     3603   
     3604    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StatisticsId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
     3605    public System.Guid StatisticsId
     3606    {
     3607      get
     3608      {
     3609        return this._StatisticsId;
     3610      }
     3611      set
     3612      {
     3613        if ((this._StatisticsId != value))
     3614        {
     3615          if (this._Statistics.HasLoadedOrAssignedValue)
     3616          {
     3617            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
     3618          }
     3619          this.OnStatisticsIdChanging(value);
     3620          this.SendPropertyChanging();
     3621          this._StatisticsId = value;
     3622          this.SendPropertyChanged("StatisticsId");
     3623          this.OnStatisticsIdChanged();
     3624        }
     3625      }
     3626    }
     3627   
     3628    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
     3629    public System.Guid UserId
     3630    {
     3631      get
     3632      {
     3633        return this._UserId;
     3634      }
     3635      set
     3636      {
     3637        if ((this._UserId != value))
     3638        {
     3639          this.OnUserIdChanging(value);
     3640          this.SendPropertyChanging();
     3641          this._UserId = value;
     3642          this.SendPropertyChanged("UserId");
     3643          this.OnUserIdChanged();
     3644        }
     3645      }
     3646    }
     3647   
     3648    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="VarChar(30)", CanBeNull=false)]
     3649    public string ExecutionTime
     3650    {
     3651      get
     3652      {
     3653        return this._ExecutionTime;
     3654      }
     3655      set
     3656      {
     3657        if ((this._ExecutionTime != value))
     3658        {
     3659          this.OnExecutionTimeChanging(value);
     3660          this.SendPropertyChanging();
     3661          this._ExecutionTime = value;
     3662          this.SendPropertyChanged("ExecutionTime");
     3663          this.OnExecutionTimeChanged();
     3664        }
     3665      }
     3666    }
     3667   
     3668    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CoresUsed", DbType="Int")]
     3669    public int UsedCores
     3670    {
     3671      get
     3672      {
     3673        return this._CoresUsed;
     3674      }
     3675      set
     3676      {
     3677        if ((this._CoresUsed != value))
     3678        {
     3679          this.OnUsedCoresChanging(value);
     3680          this.SendPropertyChanging();
     3681          this._CoresUsed = value;
     3682          this.SendPropertyChanged("UsedCores");
     3683          this.OnUsedCoresChanged();
     3684        }
     3685      }
     3686    }
     3687   
     3688    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="VarChar(30)", CanBeNull=false)]
     3689    public string ExecutionTimeFinishedJobs
     3690    {
     3691      get
     3692      {
     3693        return this._ExecutionTimeFinishedJobs;
     3694      }
     3695      set
     3696      {
     3697        if ((this._ExecutionTimeFinishedJobs != value))
     3698        {
     3699          this.OnExecutionTimeFinishedJobsChanging(value);
     3700          this.SendPropertyChanging();
     3701          this._ExecutionTimeFinishedJobs = value;
     3702          this.SendPropertyChanged("ExecutionTimeFinishedJobs");
     3703          this.OnExecutionTimeFinishedJobsChanged();
     3704        }
     3705      }
     3706    }
     3707   
     3708    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="VarChar(30)", CanBeNull=false)]
     3709    public string StartToEndTime
     3710    {
     3711      get
     3712      {
     3713        return this._StartToEndTime;
     3714      }
     3715      set
     3716      {
     3717        if ((this._StartToEndTime != value))
     3718        {
     3719          this.OnStartToEndTimeChanging(value);
     3720          this.SendPropertyChanging();
     3721          this._StartToEndTime = value;
     3722          this.SendPropertyChanged("StartToEndTime");
     3723          this.OnStartToEndTimeChanged();
     3724        }
     3725      }
     3726    }
     3727   
     3728    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Statistics_UserStatistics", Storage="_Statistics", ThisKey="StatisticsId", OtherKey="StatisticsId", IsForeignKey=true)]
     3729    public Statistics Statistics
     3730    {
     3731      get
     3732      {
     3733        return this._Statistics.Entity;
     3734      }
     3735      set
     3736      {
     3737        Statistics previousValue = this._Statistics.Entity;
     3738        if (((previousValue != value)
     3739              || (this._Statistics.HasLoadedOrAssignedValue == false)))
     3740        {
     3741          this.SendPropertyChanging();
     3742          if ((previousValue != null))
     3743          {
     3744            this._Statistics.Entity = null;
     3745            previousValue.UserStatistics.Remove(this);
     3746          }
     3747          this._Statistics.Entity = value;
     3748          if ((value != null))
     3749          {
     3750            value.UserStatistics.Add(this);
     3751            this._StatisticsId = value.StatisticsId;
     3752          }
     3753          else
     3754          {
     3755            this._StatisticsId = default(System.Guid);
     3756          }
     3757          this.SendPropertyChanged("Statistics");
     3758        }
     3759      }
     3760    }
     3761   
     3762    public event PropertyChangingEventHandler PropertyChanging;
     3763   
     3764    public event PropertyChangedEventHandler PropertyChanged;
     3765   
     3766    protected virtual void SendPropertyChanging()
     3767    {
     3768      if ((this.PropertyChanging != null))
     3769      {
     3770        this.PropertyChanging(this, emptyChangingEventArgs);
     3771      }
     3772    }
     3773   
     3774    protected virtual void SendPropertyChanged(String propertyName)
     3775    {
     3776      if ((this.PropertyChanged != null))
     3777      {
     3778        this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
     3779      }
     3780    }
     3781  }
     3782 
     3783  [global::System.Data.Linq.Mapping.TableAttribute(Name="")]
     3784  public partial class SlaveStatistics : INotifyPropertyChanging, INotifyPropertyChanged
     3785  {
     3786   
     3787    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
     3788   
     3789    private System.Guid _StatisticsId;
     3790   
     3791    private System.Guid _SlaveId;
     3792   
     3793    private int _Cores;
     3794   
     3795    private int _FreeCores;
     3796   
     3797    private double _CpuUtilization;
     3798   
     3799    private int _Memory;
     3800   
     3801    private int _FreeMemory;
     3802   
     3803    private EntityRef<Statistics> _Statistics;
     3804   
     3805    #region Extensibility Method Definitions
     3806    partial void OnLoaded();
     3807    partial void OnValidate(System.Data.Linq.ChangeAction action);
     3808    partial void OnCreated();
     3809    partial void OnStatisticsIdChanging(System.Guid value);
     3810    partial void OnStatisticsIdChanged();
     3811    partial void OnSlaveIdChanging(System.Guid value);
     3812    partial void OnSlaveIdChanged();
     3813    partial void OnCoresChanging(int value);
     3814    partial void OnCoresChanged();
     3815    partial void OnFreeCoresChanging(int value);
     3816    partial void OnFreeCoresChanged();
     3817    partial void OnCpuUtilizationChanging(double value);
     3818    partial void OnCpuUtilizationChanged();
     3819    partial void OnMemoryChanging(int value);
     3820    partial void OnMemoryChanged();
     3821    partial void OnFreeMemoryChanging(int value);
     3822    partial void OnFreeMemoryChanged();
     3823    #endregion
     3824   
     3825    public SlaveStatistics()
     3826    {
     3827      this._Statistics = default(EntityRef<Statistics>);
     3828      OnCreated();
     3829    }
     3830   
     3831    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StatisticsId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
     3832    public System.Guid StatisticsId
     3833    {
     3834      get
     3835      {
     3836        return this._StatisticsId;
     3837      }
     3838      set
     3839      {
     3840        if ((this._StatisticsId != value))
     3841        {
     3842          if (this._Statistics.HasLoadedOrAssignedValue)
     3843          {
     3844            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
     3845          }
     3846          this.OnStatisticsIdChanging(value);
     3847          this.SendPropertyChanging();
     3848          this._StatisticsId = value;
     3849          this.SendPropertyChanged("StatisticsId");
     3850          this.OnStatisticsIdChanged();
     3851        }
     3852      }
     3853    }
     3854   
     3855    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SlaveId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
     3856    public System.Guid SlaveId
     3857    {
     3858      get
     3859      {
     3860        return this._SlaveId;
     3861      }
     3862      set
     3863      {
     3864        if ((this._SlaveId != value))
     3865        {
     3866          this.OnSlaveIdChanging(value);
     3867          this.SendPropertyChanging();
     3868          this._SlaveId = value;
     3869          this.SendPropertyChanged("SlaveId");
     3870          this.OnSlaveIdChanged();
     3871        }
     3872      }
     3873    }
     3874   
     3875    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Cores", DbType="Int")]
     3876    public int Cores
     3877    {
     3878      get
     3879      {
     3880        return this._Cores;
     3881      }
     3882      set
     3883      {
     3884        if ((this._Cores != value))
     3885        {
     3886          this.OnCoresChanging(value);
     3887          this.SendPropertyChanging();
     3888          this._Cores = value;
     3889          this.SendPropertyChanged("Cores");
     3890          this.OnCoresChanged();
     3891        }
     3892      }
     3893    }
     3894   
     3895    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeCores", DbType="Int")]
     3896    public int FreeCores
     3897    {
     3898      get
     3899      {
     3900        return this._FreeCores;
     3901      }
     3902      set
     3903      {
     3904        if ((this._FreeCores != value))
     3905        {
     3906          this.OnFreeCoresChanging(value);
     3907          this.SendPropertyChanging();
     3908          this._FreeCores = value;
     3909          this.SendPropertyChanged("FreeCores");
     3910          this.OnFreeCoresChanged();
     3911        }
     3912      }
     3913    }
     3914   
     3915    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CpuUtilization", DbType="float")]
     3916    public double CpuUtilization
     3917    {
     3918      get
     3919      {
     3920        return this._CpuUtilization;
     3921      }
     3922      set
     3923      {
     3924        if ((this._CpuUtilization != value))
     3925        {
     3926          this.OnCpuUtilizationChanging(value);
     3927          this.SendPropertyChanging();
     3928          this._CpuUtilization = value;
     3929          this.SendPropertyChanged("CpuUtilization");
     3930          this.OnCpuUtilizationChanged();
     3931        }
     3932      }
     3933    }
     3934   
     3935    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Memory", DbType="Int")]
     3936    public int Memory
     3937    {
     3938      get
     3939      {
     3940        return this._Memory;
     3941      }
     3942      set
     3943      {
     3944        if ((this._Memory != value))
     3945        {
     3946          this.OnMemoryChanging(value);
     3947          this.SendPropertyChanging();
     3948          this._Memory = value;
     3949          this.SendPropertyChanged("Memory");
     3950          this.OnMemoryChanged();
     3951        }
     3952      }
     3953    }
     3954   
     3955    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeMemory", DbType="Int")]
     3956    public int FreeMemory
     3957    {
     3958      get
     3959      {
     3960        return this._FreeMemory;
     3961      }
     3962      set
     3963      {
     3964        if ((this._FreeMemory != value))
     3965        {
     3966          this.OnFreeMemoryChanging(value);
     3967          this.SendPropertyChanging();
     3968          this._FreeMemory = value;
     3969          this.SendPropertyChanged("FreeMemory");
     3970          this.OnFreeMemoryChanged();
     3971        }
     3972      }
     3973    }
     3974   
     3975    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Statistics_SlaveStatistics", Storage="_Statistics", ThisKey="StatisticsId", OtherKey="StatisticsId", IsForeignKey=true)]
     3976    public Statistics Statistics
     3977    {
     3978      get
     3979      {
     3980        return this._Statistics.Entity;
     3981      }
     3982      set
     3983      {
     3984        Statistics previousValue = this._Statistics.Entity;
     3985        if (((previousValue != value)
     3986              || (this._Statistics.HasLoadedOrAssignedValue == false)))
     3987        {
     3988          this.SendPropertyChanging();
     3989          if ((previousValue != null))
     3990          {
     3991            this._Statistics.Entity = null;
     3992            previousValue.SlaveStatistics.Remove(this);
     3993          }
     3994          this._Statistics.Entity = value;
     3995          if ((value != null))
     3996          {
     3997            value.SlaveStatistics.Add(this);
     3998            this._StatisticsId = value.StatisticsId;
     3999          }
     4000          else
     4001          {
     4002            this._StatisticsId = default(System.Guid);
     4003          }
     4004          this.SendPropertyChanged("Statistics");
     4005        }
     4006      }
     4007    }
     4008   
     4009    public event PropertyChangingEventHandler PropertyChanging;
     4010   
     4011    public event PropertyChangedEventHandler PropertyChanged;
     4012   
     4013    protected virtual void SendPropertyChanging()
     4014    {
     4015      if ((this.PropertyChanging != null))
     4016      {
     4017        this.PropertyChanging(this, emptyChangingEventArgs);
     4018      }
     4019    }
     4020   
     4021    protected virtual void SendPropertyChanged(String propertyName)
     4022    {
     4023      if ((this.PropertyChanged != null))
     4024      {
     4025        this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
     4026      }
     4027    }
     4028  }
     4029 
     4030  [global::System.Data.Linq.Mapping.TableAttribute(Name="")]
     4031  public partial class Statistics : INotifyPropertyChanging, INotifyPropertyChanged
     4032  {
     4033   
     4034    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
     4035   
     4036    private System.Guid _StatisticsId;
     4037   
     4038    private System.DateTime _Timestamp;
     4039   
     4040    private EntitySet<UserStatistics> _UserStatistics;
     4041   
     4042    private EntitySet<SlaveStatistics> _SlaveStatistics;
     4043   
     4044    #region Extensibility Method Definitions
     4045    partial void OnLoaded();
     4046    partial void OnValidate(System.Data.Linq.ChangeAction action);
     4047    partial void OnCreated();
     4048    partial void OnStatisticsIdChanging(System.Guid value);
     4049    partial void OnStatisticsIdChanged();
     4050    partial void OnTimestampChanging(System.DateTime value);
     4051    partial void OnTimestampChanged();
     4052    #endregion
     4053   
     4054    public Statistics()
     4055    {
     4056      this._UserStatistics = new EntitySet<UserStatistics>(new Action<UserStatistics>(this.attach_UserStatistics), new Action<UserStatistics>(this.detach_UserStatistics));
     4057      this._SlaveStatistics = new EntitySet<SlaveStatistics>(new Action<SlaveStatistics>(this.attach_SlaveStatistics), new Action<SlaveStatistics>(this.detach_SlaveStatistics));
     4058      OnCreated();
     4059    }
     4060   
     4061    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StatisticsId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     4062    public System.Guid StatisticsId
     4063    {
     4064      get
     4065      {
     4066        return this._StatisticsId;
     4067      }
     4068      set
     4069      {
     4070        if ((this._StatisticsId != value))
     4071        {
     4072          this.OnStatisticsIdChanging(value);
     4073          this.SendPropertyChanging();
     4074          this._StatisticsId = value;
     4075          this.SendPropertyChanged("StatisticsId");
     4076          this.OnStatisticsIdChanged();
     4077        }
     4078      }
     4079    }
     4080   
     4081    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Timestamp")]
     4082    public System.DateTime Timestamp
     4083    {
     4084      get
     4085      {
     4086        return this._Timestamp;
     4087      }
     4088      set
     4089      {
     4090        if ((this._Timestamp != value))
     4091        {
     4092          this.OnTimestampChanging(value);
     4093          this.SendPropertyChanging();
     4094          this._Timestamp = value;
     4095          this.SendPropertyChanged("Timestamp");
     4096          this.OnTimestampChanged();
     4097        }
     4098      }
     4099    }
     4100   
     4101    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Statistics_UserStatistics", Storage="_UserStatistics", ThisKey="StatisticsId", OtherKey="StatisticsId")]
     4102    public EntitySet<UserStatistics> UserStatistics
     4103    {
     4104      get
     4105      {
     4106        return this._UserStatistics;
     4107      }
     4108      set
     4109      {
     4110        this._UserStatistics.Assign(value);
     4111      }
     4112    }
     4113   
     4114    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Statistics_SlaveStatistics", Storage="_SlaveStatistics", ThisKey="StatisticsId", OtherKey="StatisticsId")]
     4115    public EntitySet<SlaveStatistics> SlaveStatistics
     4116    {
     4117      get
     4118      {
     4119        return this._SlaveStatistics;
     4120      }
     4121      set
     4122      {
     4123        this._SlaveStatistics.Assign(value);
     4124      }
     4125    }
     4126   
     4127    public event PropertyChangingEventHandler PropertyChanging;
     4128   
     4129    public event PropertyChangedEventHandler PropertyChanged;
     4130   
     4131    protected virtual void SendPropertyChanging()
     4132    {
     4133      if ((this.PropertyChanging != null))
     4134      {
     4135        this.PropertyChanging(this, emptyChangingEventArgs);
     4136      }
     4137    }
     4138   
     4139    protected virtual void SendPropertyChanged(String propertyName)
     4140    {
     4141      if ((this.PropertyChanged != null))
     4142      {
     4143        this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
     4144      }
     4145    }
     4146   
     4147    private void attach_UserStatistics(UserStatistics entity)
     4148    {
     4149      this.SendPropertyChanging();
     4150      entity.Statistics = this;
     4151    }
     4152   
     4153    private void detach_UserStatistics(UserStatistics entity)
     4154    {
     4155      this.SendPropertyChanging();
     4156      entity.Statistics = null;
     4157    }
     4158   
     4159    private void attach_SlaveStatistics(SlaveStatistics entity)
     4160    {
     4161      this.SendPropertyChanging();
     4162      entity.Statistics = this;
     4163    }
     4164   
     4165    private void detach_SlaveStatistics(SlaveStatistics entity)
     4166    {
     4167      this.SendPropertyChanging();
     4168      entity.Statistics = null;
     4169    }
     4170  }
    33574171}
    33584172#pragma warning restore 1591
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs

    r6110 r6229  
    116116    #endregion
    117117
     118    #region Statistics Methods
     119    DT.Statistics GetStatistic(Guid id);
     120    IEnumerable<DT.Statistics> GetStatistics(Expression<Func<Statistics, bool>> predicate);
     121    Guid AddStatistics(DT.Statistics dto);
     122    void DeleteStatistics(Guid id);
     123    List<DT.UserStatistics> GetUserStatistics();
     124    #endregion
     125
     126
     127
    118128  }
    119129}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/prepareHiveDatabase.sql

    r6033 r6229  
    104104GO
    105105
     106ALTER TABLE [dbo].[Statistics] ALTER COLUMN StatisticsId ADD ROWGUIDCOL;
     107ALTER TABLE [dbo].[Statistics] WITH NOCHECK ADD CONSTRAINT [DF_Statistics_StatisticsId] DEFAULT (newid()) FOR StatisticsId;
     108GO
     109
     110ALTER TABLE [dbo].[SlaveStatistics]  DROP  CONSTRAINT [Statistics_SlaveStatistics]
     111ALTER TABLE [dbo].[SlaveStatistics]  WITH CHECK ADD  CONSTRAINT [Statistics_SlaveStatistics] FOREIGN KEY([StatisticsId])
     112REFERENCES [dbo].[Statistics] ([StatisticsId])
     113ON UPDATE CASCADE
     114ON DELETE CASCADE
     115GO
     116
     117ALTER TABLE [dbo].[UserStatistics]  DROP  CONSTRAINT [Statistics_UserStatistics]
     118ALTER TABLE [dbo].[UserStatistics]  WITH CHECK ADD  CONSTRAINT [Statistics_UserStatistics] FOREIGN KEY([StatisticsId])
     119REFERENCES [dbo].[Statistics] ([StatisticsId])
     120ON UPDATE CASCADE
     121ON DELETE CASCADE
     122GO
     123
    106124/* create indices */
    107125CREATE INDEX Index_RequiredPlugins_JobId ON RequiredPlugins(JobId);
     
    159177  DELETE Job FROM Job INNER JOIN #Table ON Job.JobId = #Table.JobId
    160178END
     179GO
     180
     181-- =============================================
     182-- Author:    cneumuel
     183-- Create date: 17.05.2011
     184-- Description: Writes the execution times of deleted jobs into DeletedJobStats to ensure correct statistics
     185-- =============================================
     186--CREATE TRIGGER [dbo].[tr_DeletedJobStats] ON [dbo].[Job] AFTER DELETE AS
     187--BEGIN
     188--  INSERT INTO DeletedJobStats SELECT JobId, ExecutionTime FROM deleted
     189--END
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs

    r6006 r6229  
    77
    88namespace HeuristicLab.Services.Hive.Tests {
     9  using System.Collections.Generic;
    910  using System.Threading;
    1011  using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
     
    8384        Assert.IsTrue(Math.Abs((job1.StateLog[i].DateTime - job1loaded.StateLog[i].DateTime).TotalSeconds) < 1);
    8485      }
    85      
     86
    8687      job1 = job1loaded;
    8788
     
    236237
    237238    }
     239
     240
     241    [TestMethod]
     242    public void TestStatistics() {
     243      IHiveDao dao = ServiceLocator.Instance.HiveDao;
     244
     245      var stats = new DT.Statistics();
     246      stats.TimeStamp = DateTime.Now;
     247      var slaveStats = new List<DT.SlaveStatistics>();
     248      slaveStats.Add(new DT.SlaveStatistics() { Cores = 8, FreeCores = 3, Memory = 8000, FreeMemory = 3000, CpuUtilization = 0.8, SlaveId = Guid.NewGuid() });
     249      slaveStats.Add(new DT.SlaveStatistics() { Cores = 2, FreeCores = 0, Memory = 1024, FreeMemory = 100, CpuUtilization = 0.99, SlaveId = Guid.NewGuid() });
     250      slaveStats.Add(new DT.SlaveStatistics() { Cores = 4, FreeCores = 4, Memory = 3024, FreeMemory = 2300, CpuUtilization = 0.01, SlaveId = Guid.NewGuid() });
     251      stats.SlaveStatistics = slaveStats;
     252
     253      var userStats = new List<DT.UserStatistics>();
     254      userStats.Add(new DT.UserStatistics() { UsedCores = 15, ExecutionTime = TimeSpan.FromHours(123), UserId = Guid.NewGuid() });
     255      userStats.Add(new DT.UserStatistics() { UsedCores = 42, ExecutionTime = TimeSpan.FromHours(945), UserId = Guid.NewGuid() });
     256      stats.UserStatistics = userStats;
     257
     258      stats.Id = dao.AddStatistics(stats);
     259
     260      var statsLoaded = dao.GetStatistic(stats.Id);
     261      Assert.AreEqual(stats.Id, statsLoaded.Id);
     262      Assert.IsTrue(Math.Abs((stats.TimeStamp - statsLoaded.TimeStamp).TotalSeconds) < 1);
     263
     264      for (int i = 0; i  < slaveStats.Count; i ++) {
     265        Assert.AreEqual(slaveStats[i].Cores, statsLoaded.SlaveStatistics.Single(x => x.SlaveId == slaveStats[i].SlaveId).Cores);
     266        Assert.AreEqual(slaveStats[i].FreeCores, statsLoaded.SlaveStatistics.Single(x => x.SlaveId == slaveStats[i].SlaveId).FreeCores);
     267        Assert.AreEqual(slaveStats[i].Memory, statsLoaded.SlaveStatistics.Single(x => x.SlaveId == slaveStats[i].SlaveId).Memory);
     268        Assert.AreEqual(slaveStats[i].FreeMemory, statsLoaded.SlaveStatistics.Single(x => x.SlaveId == slaveStats[i].SlaveId).FreeMemory);
     269        Assert.AreEqual(slaveStats[i].CpuUtilization, statsLoaded.SlaveStatistics.Single(x => x.SlaveId == slaveStats[i].SlaveId).CpuUtilization);
     270      }
     271
     272      for (int i = 0; i < userStats.Count; i++) {
     273        Assert.AreEqual(userStats[i].ExecutionTime, statsLoaded.UserStatistics.Single(x => x.UserId == userStats[i].UserId).ExecutionTime);
     274        Assert.AreEqual(userStats[i].UsedCores, statsLoaded.UserStatistics.Single(x => x.UserId == userStats[i].UserId).UsedCores);       
     275      }
     276
     277      dao.DeleteStatistics(stats.Id);
     278      Assert.AreEqual(null, dao.GetStatistic(stats.Id));
     279    }
    238280  }
    239281}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/LifecycleManager.cs

    r5786 r6229  
    11using System;
     2using System.Collections.Generic;
    23using System.Linq;
    34using HeuristicLab.Services.Hive.Common;
     
    2627      SetTimeoutSlavesOffline();
    2728      SetTimeoutJobsWaiting();
    28       FinishParentJobs();     
     29      FinishParentJobs();
     30      UpdateStatistics();
     31    }
     32
     33    private void UpdateStatistics() {
     34      var slaves = dao.GetSlaves(x => x.SlaveState == SlaveState.Calculating || x.SlaveState == SlaveState.Idle);
     35
     36      var stats = new Statistics();
     37      stats.TimeStamp = DateTime.Now;
     38      var slaveStats = new List<SlaveStatistics>();
     39      foreach (var slave in slaves) {
     40        slaveStats.Add(new SlaveStatistics() {
     41          SlaveId = slave.Id,
     42          Cores = slave.Cores.HasValue ? slave.Cores.Value : 0,
     43          FreeCores = slave.FreeCores.HasValue ? slave.FreeCores.Value : 0,
     44          Memory = slave.Memory.HasValue ? slave.Memory.Value : 0,
     45          FreeMemory = slave.FreeMemory.HasValue ? slave.FreeMemory.Value : 0,
     46          CpuUtilization = slave.CpuUtilization
     47        });
     48      }
     49      stats.SlaveStatistics = slaveStats;
     50
     51      stats.UserStatistics = dao.GetUserStatistics();
     52
     53      dao.AddStatistics(stats);
     54
     55      //int slaveCount = slaves.Count();
     56      //int cores = slaves.Select(x => x.Cores.HasValue ? x.Cores.Value : 0).Sum();
     57      //int usedCores = slaves.Select(x => x.FreeCores.HasValue ? x.FreeCores.Value : 0).Sum();
     58
     59      //long memoryMb = slaves.Select(x => x.Memory.HasValue ? x.Memory.Value : 0).Sum(); ;
     60      //long memoryUsedMb = slaves.Select(x => x.FreeMemory.HasValue ? x.FreeMemory.Value : 0).Sum();
     61
     62      //double averageCpuUtilization = slaves.Select(x => x.CpuUtilization.HasValue ? x.CpuUtilization.Value : 0).Average();
     63
     64      //int executionTimeDelta = 0; // since last update
     65
     66      //{ // per user
     67      //  int activeJobs = 0; // calculating, transferring
     68      //  int waitingJobs = 0; // waiting
     69      //  int stoppedJobs = 0; // finished, failed, aborted, paused
     70      //}
     71
     72      //{ // per slave
     73      //  int activeJobs = 0; // calculating, transferring
     74      //  double cpuUtilization = 0.0;
     75      //}
     76
    2977    }
    3078
Note: See TracChangeset for help on using the changeset viewer.