Changeset 15671
- Timestamp:
- 01/30/18 12:56:00 (7 years ago)
- Location:
- branches/HiveProjectManagement
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/HiveStatistics/DimClientDao.cs
r14185 r15671 33 33 } 34 34 35 public IQueryable<DimClient> GetA ctiveClients() {36 return Table.Where(x => x. ExpirationTime== null);35 public IQueryable<DimClient> GetAllOnlineClients() { 36 return Table.Where(x => x.DateExpired == null); 37 37 } 38 38 39 public IQueryable<DimClient> GetExpiredClients() { 40 return Table.Where(x => x.ExpirationTime != null); 39 public IQueryable<DimClient> GetAllExpiredClients() { 40 return Table.Where(x => x.DateExpired != null); 41 } 42 43 public IQueryable<DimClient> GetAllOnlineSlaves() { 44 return Table.Where(x => x.DateExpired == null && x.ResourceType == "Slave"); 45 } 46 47 public IQueryable<DimClient> GetAllOnlineSlaveGroups() { 48 return Table.Where(x => x.DateExpired == null && x.ResourceType == "GROUP"); 49 } 50 51 public IQueryable<DimClient> GetAllExpiredSlaves() { 52 return Table.Where(x => x.DateExpired != null && x.ResourceType == "Slave"); 53 } 54 55 public IQueryable<DimClient> GetAllExpiredSlaveGroups() { 56 return Table.Where(x => x.DateExpired != null && x.ResourceType == "GROUP"); 41 57 } 42 58 … … 44 60 string paramIds = string.Join(",", ids.Select(x => string.Format("'{0}'", x))); 45 61 if (!string.IsNullOrWhiteSpace(paramIds)) { 46 string query = string.Format(Update ExpirationTimeQuery, "{0}", paramIds);62 string query = string.Format(UpdateDateExpiredQuery, "{0}", paramIds); 47 63 return DataContext.ExecuteCommand(query, time); 48 64 } … … 59 75 60 76 #region String queries 61 private const string Update ExpirationTimeQuery =77 private const string UpdateDateExpiredQuery = 62 78 @"UPDATE [statistics].[DimClient] 63 SET ExpirationTime= {0}79 SET DateExpired = {0} 64 80 WHERE Id IN ({1});"; 65 81 #endregion -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/HiveStatistics/DimProjectDao.cs
r15659 r15671 60 60 (from dimProject in db.GetTable<DimProject>() 61 61 where dimProject.ProjectId == projectId 62 orderby dimProject.DateCreated 62 && dimProject.DateExpired == null 63 orderby dimProject.DateCreated descending 63 64 select dimProject.Id).SingleOrDefault()); 64 65 private static readonly Func<DataContext, IEnumerable<DimProject>> GetAllOnlineProjectsQuery = -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/HiveStatistics/FactTaskDao.cs
r14185 r15671 66 66 return from factTask in Table 67 67 join client in DimClientTable on factTask.LastClientId equals client.Id 68 where client. ResourceGroupId == id68 where client.ParentResourceId == id 69 69 select factTask; 70 70 } -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml
r15659 r15671 167 167 <Column Name="Name" Type="System.String" DbType="VarChar(MAX) NOT NULL" CanBeNull="false" /> 168 168 <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" /> 169 <Column Name="ExpirationTime" Type="System.DateTime" DbType="DateTime" CanBeNull="true" /> 170 <Column Name="ResourceGroupId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" /> 171 <Column Name="ResourceGroup2Id" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" /> 172 <Column Name="GroupName" Type="System.String" CanBeNull="true" /> 173 <Column Name="GroupName2" Type="System.String" CanBeNull="true" /> 169 <Column Name="ParentResourceId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" /> 170 <Column Name="ResourceType" Type="System.String" CanBeNull="false" /> 171 <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" /> 172 <Column Name="DateExpired" Type="System.DateTime" DbType="DateTime" CanBeNull="true" /> 174 173 <Association Name="DimClient_FactTask" Member="FactTasks" ThisKey="Id" OtherKey="LastClientId" Type="FactTask" /> 175 174 <Association Name="DimClient_FactClientInfo" Member="FactClientInfos" ThisKey="Id" OtherKey="ClientId" Type="FactClientInfo" /> … … 301 300 <Column Name="Id" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> 302 301 <Column Name="ProjectId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" /> 303 <Column Name="ParentProjectId" Storage="_ParentId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="true" />302 <Column Name="ParentProjectId" Storage="_ParentId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" /> 304 303 <Column Name="Name" Type="System.String" CanBeNull="false" /> 305 304 <Column Name="Description" Type="System.String" CanBeNull="true" /> -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml.layout
r15659 r15671 182 182 </nestedChildShapes> 183 183 </classShape> 184 <classShape Id="b5b919c2-4efc-4f09-8f52-9d541a11e961" absoluteBounds="5.5, 12.25, 2, 2. 3478011067708344">184 <classShape Id="b5b919c2-4efc-4f09-8f52-9d541a11e961" absoluteBounds="5.5, 12.25, 2, 2.1554996744791666"> 185 185 <DataClassMoniker Name="/HiveDataContext/DimClient" /> 186 186 <nestedChildShapes> 187 <elementListCompartment Id="30f62a7b-0b16-404e-b972-fb12bfe978dd" absoluteBounds="5.5150000000000006, 12.71, 1.9700000000000002, 1. 7878011067708333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />187 <elementListCompartment Id="30f62a7b-0b16-404e-b972-fb12bfe978dd" absoluteBounds="5.5150000000000006, 12.71, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> 188 188 </nestedChildShapes> 189 189 </classShape> … … 218 218 </nestedChildShapes> 219 219 </classShape> 220 <associationConnector edgePoints="[(7.5 : 13. 4239005533854); (8.25 : 13.4239005533854)]" fixedFrom="NotFixed" fixedTo="NotFixed">220 <associationConnector edgePoints="[(7.5 : 13.3277498372396); (8.25 : 13.3277498372396)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 221 221 <AssociationMoniker Name="/HiveDataContext/DimClient/DimClient_FactTask" /> 222 222 <nodes> … … 232 232 </nodes> 233 233 </associationConnector> 234 <associationConnector edgePoints="[(6.5 : 14. 5978011067708); (6.5 : 17)]" fixedFrom="NotFixed" fixedTo="NotFixed">234 <associationConnector edgePoints="[(6.5 : 14.4054996744792); (6.5 : 17)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 235 235 <AssociationMoniker Name="/HiveDataContext/DimClient/DimClient_FactClientInfo" /> 236 236 <nodes> … … 313 313 </nodes> 314 314 </associationConnector> 315 <associationConnector edgePoints="[(5.125 : 4.78049967447917); (5.125 : 5.14024983723958); ( 8.875 : 5.14024983723958)]" fixedFrom="NotFixed" fixedTo="NotFixed">315 <associationConnector edgePoints="[(5.125 : 4.78049967447917); (5.125 : 5.14024983723958); (7.41666666666667 : 5.14024983723958 : JumpStart); (7.58333333333333 : 5.14024983723958 : JumpEnd); (8.875 : 5.14024983723958)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 316 316 <AssociationMoniker Name="/HiveDataContext/Job/Job_AssignedJobResource" /> 317 317 <nodes> -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs
r15659 r15671 3727 3727 private System.Guid _ResourceId; 3728 3728 3729 private System.Nullable<System.DateTime> _ExpirationTime; 3730 3731 private System.Nullable<System.Guid> _ResourceGroupId; 3732 3733 private System.Nullable<System.Guid> _ResourceGroup2Id; 3734 3735 private string _GroupName; 3736 3737 private string _GroupName2; 3729 private System.Nullable<System.Guid> _ParentResourceId; 3730 3731 private string _ResourceType; 3732 3733 private System.DateTime _DateCreated; 3734 3735 private System.Nullable<System.DateTime> _DateExpired; 3738 3736 3739 3737 private EntitySet<FactTask> _FactTasks; … … 3751 3749 partial void OnResourceIdChanging(System.Guid value); 3752 3750 partial void OnResourceIdChanged(); 3753 partial void OnExpirationTimeChanging(System.Nullable<System.DateTime> value); 3754 partial void OnExpirationTimeChanged(); 3755 partial void OnResourceGroupIdChanging(System.Nullable<System.Guid> value); 3756 partial void OnResourceGroupIdChanged(); 3757 partial void OnResourceGroup2IdChanging(System.Nullable<System.Guid> value); 3758 partial void OnResourceGroup2IdChanged(); 3759 partial void OnGroupNameChanging(string value); 3760 partial void OnGroupNameChanged(); 3761 partial void OnGroupName2Changing(string value); 3762 partial void OnGroupName2Changed(); 3751 partial void OnParentResourceIdChanging(System.Nullable<System.Guid> value); 3752 partial void OnParentResourceIdChanged(); 3753 partial void OnResourceTypeChanging(string value); 3754 partial void OnResourceTypeChanged(); 3755 partial void OnDateCreatedChanging(System.DateTime value); 3756 partial void OnDateCreatedChanged(); 3757 partial void OnDateExpiredChanging(System.Nullable<System.DateTime> value); 3758 partial void OnDateExpiredChanged(); 3763 3759 #endregion 3764 3760 … … 3830 3826 } 3831 3827 3832 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExpirationTime", DbType="DateTime")] 3833 public System.Nullable<System.DateTime> ExpirationTime 3834 { 3835 get 3836 { 3837 return this._ExpirationTime; 3838 } 3839 set 3840 { 3841 if ((this._ExpirationTime != value)) 3842 { 3843 this.OnExpirationTimeChanging(value); 3844 this.SendPropertyChanging(); 3845 this._ExpirationTime = value; 3846 this.SendPropertyChanged("ExpirationTime"); 3847 this.OnExpirationTimeChanged(); 3848 } 3849 } 3850 } 3851 3852 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceGroupId", DbType="UniqueIdentifier")] 3853 public System.Nullable<System.Guid> ResourceGroupId 3854 { 3855 get 3856 { 3857 return this._ResourceGroupId; 3858 } 3859 set 3860 { 3861 if ((this._ResourceGroupId != value)) 3862 { 3863 this.OnResourceGroupIdChanging(value); 3864 this.SendPropertyChanging(); 3865 this._ResourceGroupId = value; 3866 this.SendPropertyChanged("ResourceGroupId"); 3867 this.OnResourceGroupIdChanged(); 3868 } 3869 } 3870 } 3871 3872 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceGroup2Id", DbType="UniqueIdentifier")] 3873 public System.Nullable<System.Guid> ResourceGroup2Id 3874 { 3875 get 3876 { 3877 return this._ResourceGroup2Id; 3878 } 3879 set 3880 { 3881 if ((this._ResourceGroup2Id != value)) 3882 { 3883 this.OnResourceGroup2IdChanging(value); 3884 this.SendPropertyChanging(); 3885 this._ResourceGroup2Id = value; 3886 this.SendPropertyChanged("ResourceGroup2Id"); 3887 this.OnResourceGroup2IdChanged(); 3888 } 3889 } 3890 } 3891 3892 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_GroupName")] 3893 public string GroupName 3894 { 3895 get 3896 { 3897 return this._GroupName; 3898 } 3899 set 3900 { 3901 if ((this._GroupName != value)) 3902 { 3903 this.OnGroupNameChanging(value); 3904 this.SendPropertyChanging(); 3905 this._GroupName = value; 3906 this.SendPropertyChanged("GroupName"); 3907 this.OnGroupNameChanged(); 3908 } 3909 } 3910 } 3911 3912 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_GroupName2")] 3913 public string GroupName2 3914 { 3915 get 3916 { 3917 return this._GroupName2; 3918 } 3919 set 3920 { 3921 if ((this._GroupName2 != value)) 3922 { 3923 this.OnGroupName2Changing(value); 3924 this.SendPropertyChanging(); 3925 this._GroupName2 = value; 3926 this.SendPropertyChanged("GroupName2"); 3927 this.OnGroupName2Changed(); 3828 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ParentResourceId", DbType="UniqueIdentifier")] 3829 public System.Nullable<System.Guid> ParentResourceId 3830 { 3831 get 3832 { 3833 return this._ParentResourceId; 3834 } 3835 set 3836 { 3837 if ((this._ParentResourceId != value)) 3838 { 3839 this.OnParentResourceIdChanging(value); 3840 this.SendPropertyChanging(); 3841 this._ParentResourceId = value; 3842 this.SendPropertyChanged("ParentResourceId"); 3843 this.OnParentResourceIdChanged(); 3844 } 3845 } 3846 } 3847 3848 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceType", CanBeNull=false)] 3849 public string ResourceType 3850 { 3851 get 3852 { 3853 return this._ResourceType; 3854 } 3855 set 3856 { 3857 if ((this._ResourceType != value)) 3858 { 3859 this.OnResourceTypeChanging(value); 3860 this.SendPropertyChanging(); 3861 this._ResourceType = value; 3862 this.SendPropertyChanged("ResourceType"); 3863 this.OnResourceTypeChanged(); 3864 } 3865 } 3866 } 3867 3868 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateCreated", DbType="DateTime NOT NULL")] 3869 public System.DateTime DateCreated 3870 { 3871 get 3872 { 3873 return this._DateCreated; 3874 } 3875 set 3876 { 3877 if ((this._DateCreated != value)) 3878 { 3879 this.OnDateCreatedChanging(value); 3880 this.SendPropertyChanging(); 3881 this._DateCreated = value; 3882 this.SendPropertyChanged("DateCreated"); 3883 this.OnDateCreatedChanged(); 3884 } 3885 } 3886 } 3887 3888 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateExpired", DbType="DateTime")] 3889 public System.Nullable<System.DateTime> DateExpired 3890 { 3891 get 3892 { 3893 return this._DateExpired; 3894 } 3895 set 3896 { 3897 if ((this._DateExpired != value)) 3898 { 3899 this.OnDateExpiredChanging(value); 3900 this.SendPropertyChanging(); 3901 this._DateExpired = value; 3902 this.SendPropertyChanged("DateExpired"); 3903 this.OnDateExpiredChanged(); 3928 3904 } 3929 3905 } … … 6722 6698 } 6723 6699 6724 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ParentId", DbType="UniqueIdentifier NOT NULL")]6700 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ParentId", DbType="UniqueIdentifier")] 6725 6701 public System.Nullable<System.Guid> ParentProjectId 6726 6702 { -
branches/HiveProjectManagement/HeuristicLab.Services.WebApp.Statistics/3.3/WebApi/ClientController.cs
r14185 r15671 74 74 on client.Id equals info.ClientId into clientInfoJoin 75 75 from clientInfo in clientInfoJoin.OrderByDescending(x => x.Time).Take(1) 76 let offline = (client.ExpirationTime != null || clientInfo.SlaveState == SlaveState.Offline) 76 let offline = (client.DateExpired != null || clientInfo.SlaveState == SlaveState.Offline) 77 let parent = client.ParentResourceId.HasValue ? dimClientDao.GetById(client.ParentResourceId.Value) : null 77 78 select new DT.ClientDetails { 78 79 Id = client.Id, … … 85 86 State = offline ? SlaveState.Offline.ToString() : clientInfo.SlaveState.ToString(), 86 87 LastUpdate = clientInfo.Time, 87 GroupId = client. ResourceGroupId,88 GroupName = client.GroupName,88 GroupId = client.ParentResourceId, 89 GroupName = parent != null ? parent.Name : null, 89 90 UpTime = offline ? 0 : upTime, 90 91 TotalUnavailableTime = timeData != null ? timeData.TotalUnavailableTime : 0, … … 117 118 var factClientInfoDao = pm.FactClientInfoDao; 118 119 return pm.UseTransaction(() => { 119 var clients = expired ? dimClientDao.Get ExpiredClients() : dimClientDao.GetActiveClients();120 var clients = expired ? dimClientDao.GetAllExpiredSlaves() : dimClientDao.GetAllOnlineSlaves(); 120 121 var query = (from client in clients 121 122 join info in factClientInfoDao.GetAll() … … 123 124 from clientInfo in clientInfoJoin.OrderByDescending(x => x.Time).Take(1) 124 125 let offline = (expired || clientInfo.SlaveState == SlaveState.Offline) 126 let parent = client.ParentResourceId.HasValue ? dimClientDao.GetById(client.ParentResourceId.Value) : null 125 127 select new DT.Client { 126 128 Id = client.Id, … … 132 134 CpuUtilization = offline ? 0 : clientInfo.CpuUtilization, 133 135 State = offline ? SlaveState.Offline.ToString() : clientInfo.SlaveState.ToString(), 134 GroupId = client. ResourceGroupId,135 GroupName = client.GroupName,136 GroupId = client.ParentResourceId, 137 GroupName = parent != null ? parent.Name : null, 136 138 IsAllowedToCalculate = clientInfo.IsAllowedToCalculate 137 139 }); … … 200 202 var factClientInfoDao = pm.FactClientInfoDao; 201 203 return pm.UseTransaction(() => { 202 var clients = expired ? dimClientDao.Get ExpiredClients() : dimClientDao.GetActiveClients();203 clients = clients.Where(x => x. ResourceGroupId == id);204 var clients = expired ? dimClientDao.GetAllExpiredClients() : dimClientDao.GetAllOnlineClients(); 205 clients = clients.Where(x => x.ParentResourceId == id); 204 206 var query = (from client in clients 205 207 join info in factClientInfoDao.GetAll() … … 207 209 from clientInfo in clientInfoJoin.OrderByDescending(x => x.Time).Take(1) 208 210 let offline = (expired || clientInfo.SlaveState == SlaveState.Offline) 211 let parent = client.ParentResourceId.HasValue ? dimClientDao.GetById(client.ParentResourceId.Value) : null 209 212 select new DT.Client { 210 213 Id = client.Id, … … 216 219 CpuUtilization = offline ? 0 : clientInfo.CpuUtilization, 217 220 State = offline ? SlaveState.Offline.ToString() : clientInfo.SlaveState.ToString(), 218 GroupId = client. ResourceGroupId,219 GroupName = client.GroupName,221 GroupId = client.ParentResourceId, 222 GroupName = parent != null ? parent.Name : null, 220 223 IsAllowedToCalculate = clientInfo.IsAllowedToCalculate 221 224 }); … … 247 250 client => client.Id, 248 251 (fact, client) => new { 249 client. ResourceGroupId,252 client.ParentResourceId, 250 253 fact.Time, 251 254 fact.CpuUtilization, … … 255 258 fact.UsedMemory 256 259 }) 257 .Where(x => x. ResourceGroupId == id)260 .Where(x => x.ParentResourceId == id) 258 261 .ToList(); 259 262 var clientStatus = new DT.ClientStatus { -
branches/HiveProjectManagement/HeuristicLab.Services.WebApp.Statistics/3.3/WebApi/GroupController.cs
r14185 r15671 42 42 var clientTimeData = factClientInfoDao.GetAll() 43 43 .Join(dimClientDao.GetAll(), x => x.ClientId, y => y.Id, (x, y) => new { 44 y. ResourceGroupId,44 y.ParentResourceId, 45 45 x.IdleTime, 46 46 x.OfflineTime, 47 47 x.UnavailableTime 48 48 }) 49 .Where(x => x. ResourceGroupId == id)50 .GroupBy(x => x. ResourceGroupId)49 .Where(x => x.ParentResourceId == id) 50 .GroupBy(x => x.ParentResourceId) 51 51 .Select(x => new { 52 52 TotalIdleTime = x.Sum(y => y.IdleTime), … … 68 68 }) 69 69 .FirstOrDefault(); 70 return (from client in dimClientDao.GetA ctiveClients().Where(x => x.ResourceGroupId == id)70 return (from client in dimClientDao.GetAllOnlineSlaves().Where(x => x.ParentResourceId == id) 71 71 join info in factClientInfoDao.GetAll() 72 72 on client.Id equals info.ClientId into clientInfoJoin 73 73 from clientInfo in clientInfoJoin.OrderByDescending(x => x.Time).Take(1) 74 74 let offline = (clientInfo.SlaveState == DA.SlaveState.Offline) 75 let parent = client.ParentResourceId.HasValue ? dimClientDao.GetById(client.ParentResourceId.Value) : null 75 76 select new { 76 ResourceGroupId = client. ResourceGroupId,77 GroupName = client.GroupName,77 ResourceGroupId = client.ParentResourceId, 78 GroupName = parent != null ? parent.Name : null, 78 79 TotalCores = clientInfo.NumTotalCores, 79 80 UsedCores = offline ? 0 : clientInfo.NumUsedCores, … … 114 115 var dimClientDao = pm.DimClientDao; 115 116 var factClientInfoDao = pm.FactClientInfoDao; 116 var data = (from client in dimClientDao.GetA ctiveClients()117 var data = (from client in dimClientDao.GetAllOnlineSlaves() 117 118 join info in factClientInfoDao.GetAll() 118 119 on client.Id equals info.ClientId into clientInfoJoin … … 120 121 let offline = (clientInfo.SlaveState == DA.SlaveState.Offline) 121 122 select new { 122 ResourceGroupId = client. ResourceGroupId,123 ResourceGroupId = client.ParentResourceId, 123 124 TotalCores = clientInfo.NumTotalCores, 124 125 UsedCores = offline ? 0 : clientInfo.NumUsedCores, … … 137 138 CpuUtilization = x.Where(y => y.SlaveState != DA.SlaveState.Offline).Average(y => (double?)y.CpuUtilization) ?? 0.0 138 139 }); 139 var query = dimClientDao.GetAll() 140 .GroupBy(x => new { x.ResourceGroupId, x.GroupName }) 141 .Select(x => new { 142 Id = x.Key.ResourceGroupId ?? default(Guid), 143 Name = x.Key.GroupName 144 }); 140 141 var query = dimClientDao.GetAllOnlineSlaveGroups().Select(x => new { 142 Id = x.ResourceId, 143 Name = x.Name 144 }); 145 145 return pm.UseTransaction(() => new DT.GroupPage { 146 146 TotalGroups = query.Count(),
Note: See TracChangeset
for help on using the changeset viewer.