Changeset 6267 for branches/HeuristicLab.Hive-3.4/sources
- Timestamp:
- 05/24/11 16:55:48 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveJobView.cs
r6200 r6267 150 150 } 151 151 152 protected virtual void OptimizerJob_ComputeInParallelChanged(object sender, EventArgs e) { 153 if (InvokeRequired) { 154 Invoke(new EventHandler(OptimizerJob_ComputeInParallelChanged), sender, e); 155 } else { 156 computeInParallelCheckBox.Checked = Content.ItemJob.ComputeInParallel; 157 } 158 } 159 #endregion 160 161 #region Child Control Events 162 protected virtual void computeInParallelCheckBox_CheckedChanged(object sender, EventArgs e) { 163 if (Content != null && Content.ItemJob != null) { 164 this.Content.ItemJob.ComputeInParallel = this.computeInParallelCheckBox.Checked; 165 } 166 } 167 168 protected virtual void exceptionTextBox_DoubleClick(object sender, EventArgs e) { 169 using (TextDialog dialog = new TextDialog("Exception", exceptionTextBox.Text, ReadOnly || !Content.CanChangeDescription)) { 170 if (dialog.ShowDialog(this) == DialogResult.OK) 171 Content.Description = dialog.Content; 172 } 173 } 174 175 protected virtual void modifyItemButton_Click(object sender, EventArgs e) { 176 MainFormManager.MainForm.ShowContent(Content.ItemJob.Item); 177 } 178 #endregion 179 152 180 protected override void SetEnabledStateOfControls() { 153 181 base.SetEnabledStateOfControls(); … … 171 199 optimizerItemView.ReadOnly = true; 172 200 } 173 174 protected virtual void OptimizerJob_ComputeInParallelChanged(object sender, EventArgs e) {175 if (InvokeRequired) {176 Invoke(new EventHandler(OptimizerJob_ComputeInParallelChanged), sender, e);177 } else {178 computeInParallelCheckBox.Checked = Content.ItemJob.ComputeInParallel;179 }180 }181 #endregion182 183 #region Child Control Events184 protected virtual void computeInParallelCheckBox_CheckedChanged(object sender, EventArgs e) {185 if (Content != null && Content.ItemJob != null) {186 this.Content.ItemJob.ComputeInParallel = this.computeInParallelCheckBox.Checked;187 }188 }189 190 protected virtual void exceptionTextBox_DoubleClick(object sender, EventArgs e) {191 using (TextDialog dialog = new TextDialog("Exception", exceptionTextBox.Text, ReadOnly || !Content.CanChangeDescription)) {192 if (dialog.ShowDialog(this) == DialogResult.OK)193 Content.Description = dialog.Content;194 }195 }196 197 protected virtual void modifyItemButton_Click(object sender, EventArgs e) {198 MainFormManager.MainForm.ShowContent(Content.ItemJob.Item);199 }200 #endregion201 201 } 202 202 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/OptimizerHiveJobView.cs
r6178 r6267 50 50 } 51 51 #region Content Events 52 53 protected override void SetEnabledStateOfControls() {54 base.SetEnabledStateOfControls();55 56 this.restartButton.Enabled = Content != null && !Content.Job.Command.HasValue && Content.Job.State == JobState.Paused;57 this.pauseButton.Enabled = Content != null && !Content.Job.Command.HasValue && Content.Job.State == JobState.Calculating;58 this.stopButton.Enabled = Content != null && !Content.Job.Command.HasValue && (Content.Job.State == JobState.Calculating || Content.Job.State == JobState.Waiting || Content.Job.State == JobState.Paused);59 }60 52 #endregion 61 53 … … 73 65 } 74 66 #endregion 67 68 protected override void SetEnabledStateOfControls() { 69 base.SetEnabledStateOfControls(); 70 71 this.restartButton.Enabled = Content != null && !Content.Job.Command.HasValue && (Content.Job.State == JobState.Paused || Content.Job.State == JobState.Failed || Content.Job.State == JobState.Aborted); 72 this.pauseButton.Enabled = Content != null && !Content.Job.Command.HasValue && Content.Job.State == JobState.Calculating; 73 this.stopButton.Enabled = Content != null && !Content.Job.Command.HasValue && (Content.Job.State == JobState.Calculating || Content.Job.State == JobState.Waiting || Content.Job.State == JobState.Paused); 74 } 75 75 } 76 76 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/RefreshableHiveExperiment.cs
r6229 r6267 276 276 } 277 277 public void UpdateTotalExecutionTime() { 278 hiveExperiment.ExecutionTime = TimeSpan.FromMilliseconds(hiveExperiment.GetAllHiveJobs().Sum(x => x.Job.ExecutionTime. HasValue ? x.Job.ExecutionTime.Value.TotalMilliseconds : 0));278 hiveExperiment.ExecutionTime = TimeSpan.FromMilliseconds(hiveExperiment.GetAllHiveJobs().Sum(x => x.Job.ExecutionTime.TotalMilliseconds)); 279 279 } 280 280 #endregion -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveServiceClient.cs
r6006 r6267 2 2 // <auto-generated> 3 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319.2 084 // Runtime Version:4.0.30319.225 5 5 // 6 6 // Changes to this file may cause incorrect behavior and will be lost if … … 91 91 92 92 [System.Runtime.Serialization.OptionalFieldAttribute()] 93 private System. Nullable<System.TimeSpan>ExecutionTimeField;93 private System.TimeSpan ExecutionTimeField; 94 94 95 95 [System.Runtime.Serialization.OptionalFieldAttribute()] … … 123 123 124 124 [System.Runtime.Serialization.DataMemberAttribute()] 125 public System. Nullable<System.TimeSpan>ExecutionTime125 public System.TimeSpan ExecutionTime 126 126 { 127 127 get … … 358 358 359 359 [System.Runtime.Serialization.OptionalFieldAttribute()] 360 private bool IsPrivilegedField; 361 362 [System.Runtime.Serialization.OptionalFieldAttribute()] 360 363 private System.Nullable<System.DateTime> LastHeartbeatField; 361 364 … … 433 436 this.IsParentJobField = value; 434 437 this.RaisePropertyChanged("IsParentJob"); 438 } 439 } 440 } 441 442 [System.Runtime.Serialization.DataMemberAttribute()] 443 public bool IsPrivileged 444 { 445 get 446 { 447 return this.IsPrivilegedField; 448 } 449 set 450 { 451 if ((this.IsPrivilegedField.Equals(value) != true)) 452 { 453 this.IsPrivilegedField = value; 454 this.RaisePropertyChanged("IsPrivileged"); 435 455 } 436 456 } … … 758 778 759 779 [System.Runtime.Serialization.OptionalFieldAttribute()] 780 private double CpuUtilizationField; 781 782 [System.Runtime.Serialization.OptionalFieldAttribute()] 760 783 private System.Nullable<int> FreeCoresField; 761 784 … … 825 848 this.CpuSpeedField = value; 826 849 this.RaisePropertyChanged("CpuSpeed"); 850 } 851 } 852 } 853 854 [System.Runtime.Serialization.DataMemberAttribute()] 855 public double CpuUtilization 856 { 857 get 858 { 859 return this.CpuUtilizationField; 860 } 861 set 862 { 863 if ((this.CpuUtilizationField.Equals(value) != true)) 864 { 865 this.CpuUtilizationField = value; 866 this.RaisePropertyChanged("CpuUtilization"); 827 867 } 828 868 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/Job.cs
r6200 r6267 38 38 this.FinishWhenChildJobsFinished = original.FinishWhenChildJobsFinished; 39 39 this.HiveExperimentId = original.HiveExperimentId; 40 this.IsPrivileged = original.IsPrivileged; 40 41 } 41 42 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/Slave.cs
r5955 r6267 42 42 this.CpuArchitecture = original.CpuArchitecture; 43 43 this.LastHeartbeat = original.LastHeartbeat; 44 this.CpuUtilization = original.CpuUtilization; 44 45 } 45 46 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ApplicationConstants.cs
r5786 r6267 28 28 public static System.Data.IsolationLevel IsolationLevel = IsolationLevel.ReadUncommitted; 29 29 30 /// <summary>31 /// ReadUncommitted to minimize deadlocks.32 /// </summary>33 public static System.Transactions.IsolationLevel IsolationLevelScope = System.Transactions.IsolationLevel.ReadUncommitted;34 35 30 public static TimeSpan SlaveHeartbeatTimeout = TimeSpan.FromMinutes(1); 36 31 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/Job.cs
r6006 r6267 44 44 [DataMember] 45 45 public Guid HiveExperimentId { get; set; } 46 [DataMember] 47 public bool IsPrivileged { get; set; } 46 48 47 49 public Job() { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/LightweightJob.cs
r5786 r6267 30 30 public class LightweightJob : HiveItem { 31 31 [DataMember] 32 public TimeSpan ?ExecutionTime { get; set; }32 public TimeSpan ExecutionTime { get; set; } 33 33 [DataMember] 34 34 public Guid? ParentJobId { get; set; } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs
r6006 r6267 155 155 156 156 [OperationContract] 157 IEnumerable<Job> GetJobsByResourceId(Guid resourceId); 158 159 [OperationContract] 157 160 void TriggerLifecycle(bool force); 158 161 #endregion -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs
r6229 r6267 34 34 Id = source.JobId, 35 35 CoresNeeded = source.CoresNeeded, 36 ExecutionTime = string.IsNullOrEmpty(source.ExecutionTime) ? TimeSpan.Zero : TimeSpan.Parse(source.ExecutionTime),36 ExecutionTime = TimeSpan.FromMilliseconds(source.ExecutionTimeMs), 37 37 MemoryNeeded = source.MemoryNeeded, 38 38 ParentJobId = source.ParentJobId, … … 46 46 Command = source.Command, 47 47 LastJobDataUpdate = (source.JobData == null ? DateTime.MinValue : source.JobData.LastUpdate), 48 HiveExperimentId = source.HiveExperimentId 48 HiveExperimentId = source.HiveExperimentId, 49 IsPrivileged = source.IsPrivileged 49 50 }; 50 51 } … … 58 59 target.JobId = source.Id; 59 60 target.CoresNeeded = source.CoresNeeded; 60 target.ExecutionTime = source.ExecutionTime.ToString();61 target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds; 61 62 target.MemoryNeeded = source.MemoryNeeded; 62 63 target.ParentJobId = source.ParentJobId; … … 68 69 target.StateLogs.Add(Convert.ToEntity(sl)); 69 70 } 70 //target.StateLogs.AddRange(source.StateLog.Select(x => Convert.ToEntity(x)).OrderBy(x => x.DateTime));71 71 target.IsParentJob = source.IsParentJob; 72 72 target.FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished; … … 74 74 // RequiredPlugins are added by Dao 75 75 target.HiveExperimentId = source.HiveExperimentId; 76 target.IsPrivileged = source.IsPrivileged; 76 77 } 77 78 } … … 338 339 UserId = source.UserId, 339 340 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)341 ExecutionTime = TimeSpan.FromMilliseconds(source.ExecutionTimeMs), 342 ExecutionTimeFinishedJobs = TimeSpan.FromMilliseconds(source.ExecutionTimeMsFinishedJobs), 343 StartToEndTime = TimeSpan.FromMilliseconds(source.StartToEndTimeMs) 343 344 }; 344 345 } … … 353 354 target.UserId = source.UserId; 354 355 target.UsedCores = source.UsedCores; 355 target.ExecutionTime = source.ExecutionTime.ToString();356 target.ExecutionTime FinishedJobs = source.ExecutionTimeFinishedJobs.ToString();357 target.StartToEndTime = source.StartToEndTime.ToString();356 target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds; 357 target.ExecutionTimeMsFinishedJobs = source.ExecutionTimeFinishedJobs.TotalMilliseconds; 358 target.StartToEndTimeMs = source.StartToEndTime.TotalMilliseconds; 358 359 } 359 360 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs
r6229 r6267 559 559 CollectParentResources(resources, resource.ParentResource); 560 560 } 561 562 /// <summary> 563 /// Returns all child resources of a resource (without the given resource) 564 /// </summary> 565 public IEnumerable<DT.Resource> GetChildResources(Guid resourceId) { 566 using (var db = CreateContext()) { 567 var childs = new List<DT.Resource>(); 568 foreach (var child in db.Resources.Where(x => x.ParentResourceId == resourceId)) { 569 childs.Add(Convert.ToDto(child)); 570 childs.AddRange(GetChildResources(child.ResourceId)); 571 } 572 return childs; 573 } 574 } 575 576 public IEnumerable<DT.Job> GetJobsByResourceId(Guid resourceId) { 577 using (var db = CreateContext()) { 578 var resources = GetChildResources(resourceId).Select(x => x.Id).ToList(); 579 resources.Add(resourceId); 580 581 var jobs = db.Jobs.Where(j => 582 j.State == JobState.Calculating && 583 j.StateLogs.OrderByDescending(x => x.DateTime).First().SlaveId.HasValue && 584 resources.Contains(j.StateLogs.OrderByDescending(x => x.DateTime).First().SlaveId.Value)); 585 return jobs.Select(j => Convert.ToDto(j)).ToArray(); 586 } 587 } 561 588 #endregion 562 589 … … 689 716 public List<DT.UserStatistics> GetUserStatistics() { 690 717 using (var db = CreateContext()) { 718 var userStats = new Dictionary<Guid, DT.UserStatistics>(); 719 720 var usedCoresByUser = from job in db.Jobs 721 where job.State == JobState.Calculating 722 group job by job.HiveExperiment.OwnerUserId into g 723 select new { UserId = g.Key, UsedCores = g.Count() }; 724 725 foreach (var item in usedCoresByUser) { 726 if (!userStats.ContainsKey(item.UserId)) { 727 userStats.Add(item.UserId, new DT.UserStatistics() { UserId = item.UserId }); 728 } 729 userStats[item.UserId].UsedCores += item.UsedCores; 730 } 731 691 732 var executionTimesByUser = from job in db.Jobs 692 733 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>(); 734 select new { UserId = g.Key, ExecutionTime = TimeSpan.FromMilliseconds(g.Select(x => x.ExecutionTimeMs).Sum()) }; 696 735 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; 736 if (!userStats.ContainsKey(item.UserId)) { 737 userStats.Add(item.UserId, new DT.UserStatistics() { UserId = item.UserId }); 738 } 739 userStats[item.UserId].ExecutionTime += item.ExecutionTime; 740 } 741 742 // execution times only of finished jobs - necessary to compute efficieny 743 var executionTimesFinishedJobs = from job in db.Jobs 744 where job.State == JobState.Finished 745 group job by job.HiveExperiment.OwnerUserId into g 746 select new { UserId = g.Key, ExecutionTimeFinishedJobs = TimeSpan.FromMilliseconds(g.Select(x => x.ExecutionTimeMs).Sum()) }; 747 748 foreach (var item in executionTimesFinishedJobs) { 749 if (!userStats.ContainsKey(item.UserId)) { 750 userStats.Add(item.UserId, new DT.UserStatistics() { UserId = item.UserId }); 751 } 752 userStats[item.UserId].ExecutionTimeFinishedJobs += item.ExecutionTimeFinishedJobs; 753 } 754 755 // start to end times only of finished jobs - necessary to compute efficiency 756 var startToEndTimesFinishedJobs = from job in db.Jobs 757 where job.State == JobState.Finished 758 group job by job.HiveExperiment.OwnerUserId into g 759 select new { 760 UserId = g.Key, 761 StartToEndTime = g.Select(x => x.StateLogs.OrderByDescending(sl => sl.DateTime).First().DateTime - x.StateLogs.OrderBy(sl => sl.DateTime).First().DateTime).Sum() 762 }; 763 foreach (var item in startToEndTimesFinishedJobs) { 764 if (!userStats.ContainsKey(item.UserId)) { 765 userStats.Add(item.UserId, new DT.UserStatistics() { UserId = item.UserId }); 766 } 767 userStats[item.UserId].StartToEndTime += item.StartToEndTime; 768 } 769 770 // also consider executiontimes of DeletedJobStats 771 var deletedJobsExecutionTimesByUsers = from del in db.DeletedJobStatistics 772 group del by del.UserId into g 773 select new { 774 UserId = g.Key, 775 ExecutionTime = TimeSpan.FromMilliseconds(g.Select(x => x.ExecutionTimeMs).Sum()), 776 ExecutionTimeFinishedJobs = TimeSpan.FromMilliseconds(g.Select(x => x.ExecutionTimeMsFinishedJobs).Sum()), 777 StartToEndTime = TimeSpan.FromMilliseconds(g.Select(x => x.StartToEndTimeMs).Sum()) 778 }; 779 foreach (var item in deletedJobsExecutionTimesByUsers) { 780 if (!userStats.ContainsKey(item.UserId)) { 781 userStats.Add(item.UserId, new DT.UserStatistics() { UserId = item.UserId }); 782 } 783 userStats[item.UserId].ExecutionTime += item.ExecutionTime; 784 userStats[item.UserId].ExecutionTimeFinishedJobs += item.ExecutionTimeFinishedJobs; 785 userStats[item.UserId].StartToEndTime += item.StartToEndTime; 786 } 787 788 return userStats.Values.ToList(); 707 789 } 708 790 } … … 719 801 } 720 802 #endregion 721 722 723 803 } 804 805 public static class TimeSpanExtensions { 806 public static TimeSpan Sum(this IEnumerable<TimeSpan> ts) { 807 return new TimeSpan(ts.Sum(r => r.Ticks)); 808 } 724 809 } 725 810 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml
r6229 r6267 62 62 <Column Name="JobId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> 63 63 <Column Name="JobState" Member="State" Type="global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState" DbType="VarChar(30)" CanBeNull="false" /> 64 <Column Name="ExecutionTime " Type="System.String" DbType="VarChar(30)" CanBeNull="true" />64 <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float" CanBeNull="false" /> 65 65 <Column Name="LastHeartbeat" Type="System.DateTime" DbType="DateTime" CanBeNull="true" /> 66 66 <Column Name="ParentJobId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" /> … … 72 72 <Column Name="Command" Type="global::HeuristicLab.Services.Hive.Common.DataTransfer.Command?" DbType="VarChar(30)" CanBeNull="true" /> 73 73 <Column Name="HiveExperimentId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" /> 74 <Column Name="IsPrivileged" Type="System.Boolean" DbType="Bit" CanBeNull="false" /> 74 75 <Association Name="Job_AssignedResource" Member="AssignedResources" ThisKey="JobId" OtherKey="JobId" Type="AssignedResource" /> 75 76 <Association Name="Job_RequiredPlugin" Member="RequiredPlugins" ThisKey="JobId" OtherKey="JobId" Type="RequiredPlugin" /> … … 154 155 <Table Name="" Member="DeletedJobStatistics"> 155 156 <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" /> 157 <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" /> 158 <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float" CanBeNull="false" /> 159 <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float" CanBeNull="false" /> 160 <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float" CanBeNull="false" /> 161 <Column Name="DeletedJobStatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> 160 162 </Type> 161 163 </Table> … … 164 166 <Column Name="StatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" /> 165 167 <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" />168 <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float" CanBeNull="false" /> 167 169 <Column Name="UsedCores" Storage="_CoresUsed" Type="System.Int32" DbType="Int" CanBeNull="false" /> 168 <Column Name="ExecutionTime FinishedJobs" Type="System.String" DbType="VarChar(30)" CanBeNull="false" />169 <Column Name="StartToEndTime " Type="System.String" DbType="VarChar(30)" CanBeNull="false" />170 <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float" CanBeNull="false" /> 171 <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float" CanBeNull="false" /> 170 172 <Association Name="Statistics_UserStatistics" Member="Statistics" ThisKey="StatisticsId" OtherKey="StatisticsId" Type="Statistics" IsForeignKey="true" /> 171 173 </Type> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout
r6229 r6267 27 27 </nestedChildShapes> 28 28 </classShape> 29 <classShape Id="695bfc39-59f3-4e60-8644-f847964bf62c" absoluteBounds="6.5, 1, 2, 3. 1170068359374996">29 <classShape Id="695bfc39-59f3-4e60-8644-f847964bf62c" absoluteBounds="6.5, 1, 2, 3.3093082682291666"> 30 30 <DataClassMoniker Name="/HiveDataContext/Job" /> 31 31 <nestedChildShapes> 32 <elementListCompartment Id="a6a30e11-03d1-4869-82e6-b733f4ef9974" absoluteBounds="6.5150000000000006, 1.46, 1.9700000000000002, 2. 5570068359375" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />32 <elementListCompartment Id="a6a30e11-03d1-4869-82e6-b733f4ef9974" absoluteBounds="6.5150000000000006, 1.46, 1.9700000000000002, 2.7493082682291665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> 33 33 </nestedChildShapes> 34 34 </classShape> … … 69 69 </nodes> 70 70 </inheritanceConnector> 71 <associationConnector edgePoints="[(11.9843735 : 2.57859537760417); (11.9843735 : 4.69314697265625); (10.875 : 4.69314697265625)]" fixedFrom=" Algorithm" fixedTo="Algorithm">71 <associationConnector edgePoints="[(11.9843735 : 2.57859537760417); (11.9843735 : 4.69314697265625); (10.875 : 4.69314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 72 72 <AssociationMoniker Name="/HiveDataContext/Resource/Resource_AssignedResource" /> 73 73 <nodes> … … 76 76 </nodes> 77 77 </associationConnector> 78 <associationConnector edgePoints="[(7. 5 : 4.1170068359375); (7.5 : 4.751650890625); (8.875 : 4.751650890625)]" fixedFrom="Algorithm" fixedTo="Algorithm">78 <associationConnector edgePoints="[(7.803710203125 : 4.30930826822917); (7.803710203125 : 4.84780160677083); (8.875 : 4.84780160677083)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 79 79 <AssociationMoniker Name="/HiveDataContext/Job/Job_AssignedResource" /> 80 80 <nodes> … … 83 83 </nodes> 84 84 </associationConnector> 85 <associationConnector edgePoints="[(7. 10742140625 : 4.1170068359375); (7.10742140625 : 5.5)]" fixedFrom="NotFixed" fixedTo="NotFixed">85 <associationConnector edgePoints="[(7.0893551015625 : 4.30930826822917); (7.0893551015625 : 5.5)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 86 86 <AssociationMoniker Name="/HiveDataContext/Job/Job_RequiredPlugin" /> 87 87 <nodes> … … 123 123 </nodes> 124 124 </associationConnector> 125 <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom=" NotFixed" fixedTo="NotFixed">125 <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 126 126 <AssociationMoniker Name="/HiveDataContext/Job/Job_JobData" /> 127 127 <nodes> … … 156 156 </nestedChildShapes> 157 157 </classShape> 158 <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom=" NotFixed" fixedTo="NotFixed">158 <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 159 159 <AssociationMoniker Name="/HiveDataContext/Job/Job_StateLog" /> 160 160 <nodes> … … 163 163 </nodes> 164 164 </associationConnector> 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">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"> 166 166 <AssociationMoniker Name="/HiveDataContext/Resource/Resource_StateLog" /> 167 167 <nodes> … … 183 183 </nestedChildShapes> 184 184 </classShape> 185 <associationConnector edgePoints="[(6.125 : 3. 37100341796875); (6.5 : 3.37100341796875)]" fixedFrom="NotFixed" fixedTo="NotFixed">185 <associationConnector edgePoints="[(6.125 : 3.46715413411458); (6.5 : 3.46715413411458)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 186 186 <AssociationMoniker Name="/HiveDataContext/HiveExperiment/HiveExperiment_Job" /> 187 187 <nodes> … … 190 190 </nodes> 191 191 </associationConnector> 192 <classShape Id="cdddf4da-eaef-46a1-9cfd-987bb6b3d03e" absoluteBounds="17, 3.125, 2 , 1.5785953776041666">192 <classShape Id="cdddf4da-eaef-46a1-9cfd-987bb6b3d03e" absoluteBounds="17, 3.125, 2.5, 1.7708968098958327"> 193 193 <DataClassMoniker Name="/HiveDataContext/DeletedJobStatistics" /> 194 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" />195 <elementListCompartment Id="b8738381-f696-4dba-a517-47e9cd96a9a6" absoluteBounds="17.015, 3.585, 2.4699999999999998, 1.2108968098958333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> 196 196 </nestedChildShapes> 197 197 </classShape> … … 214 214 </nestedChildShapes> 215 215 </classShape> 216 <associationConnector edgePoints="[(21.4375 : 4.19399251302083); (21.4375 : 4.5)]" fixedFrom=" Algorithm" fixedTo="Algorithm">216 <associationConnector edgePoints="[(21.4375 : 4.19399251302083); (21.4375 : 4.5)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 217 217 <AssociationMoniker Name="/HiveDataContext/Statistics/Statistics_SlaveStatistics" /> 218 218 <nodes> … … 221 221 </nodes> 222 222 </associationConnector> 223 <associationConnector edgePoints="[(22.5 : 4.19399251302083); (22.5 : 4.5)]" fixedFrom=" Algorithm" fixedTo="Algorithm">223 <associationConnector edgePoints="[(22.5 : 4.19399251302083); (22.5 : 4.5)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 224 224 <AssociationMoniker Name="/HiveDataContext/Statistics/Statistics_UserStatistics" /> 225 225 <nodes> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs
r6229 r6267 1474 1474 private global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState _State; 1475 1475 1476 private string_ExecutionTime;1476 private double _ExecutionTime; 1477 1477 1478 1478 private System.Nullable<System.DateTime> _LastHeartbeat; … … 1493 1493 1494 1494 private System.Guid _HiveExperimentId; 1495 1496 private bool _IsPrivileged; 1495 1497 1496 1498 private EntitySet<AssignedResource> _AssignedResources; … … 1516 1518 partial void OnStateChanging(global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState value); 1517 1519 partial void OnStateChanged(); 1518 partial void OnExecutionTime Changing(stringvalue);1519 partial void OnExecutionTime Changed();1520 partial void OnExecutionTimeMsChanging(double value); 1521 partial void OnExecutionTimeMsChanged(); 1520 1522 partial void OnLastHeartbeatChanging(System.Nullable<System.DateTime> value); 1521 1523 partial void OnLastHeartbeatChanged(); … … 1536 1538 partial void OnHiveExperimentIdChanging(System.Guid value); 1537 1539 partial void OnHiveExperimentIdChanged(); 1540 partial void OnIsPrivilegedChanging(bool value); 1541 partial void OnIsPrivilegedChanged(); 1538 1542 #endregion 1539 1543 … … 1590 1594 } 1591 1595 1592 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType=" VarChar(30)")]1593 public string ExecutionTime1596 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float")] 1597 public double ExecutionTimeMs 1594 1598 { 1595 1599 get … … 1601 1605 if ((this._ExecutionTime != value)) 1602 1606 { 1603 this.OnExecutionTime Changing(value);1607 this.OnExecutionTimeMsChanging(value); 1604 1608 this.SendPropertyChanging(); 1605 1609 this._ExecutionTime = value; 1606 this.SendPropertyChanged("ExecutionTime ");1607 this.OnExecutionTime Changed();1610 this.SendPropertyChanged("ExecutionTimeMs"); 1611 this.OnExecutionTimeMsChanged(); 1608 1612 } 1609 1613 } … … 1794 1798 this.SendPropertyChanged("HiveExperimentId"); 1795 1799 this.OnHiveExperimentIdChanged(); 1800 } 1801 } 1802 } 1803 1804 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsPrivileged", DbType="Bit")] 1805 public bool IsPrivileged 1806 { 1807 get 1808 { 1809 return this._IsPrivileged; 1810 } 1811 set 1812 { 1813 if ((this._IsPrivileged != value)) 1814 { 1815 this.OnIsPrivilegedChanging(value); 1816 this.SendPropertyChanging(); 1817 this._IsPrivileged = value; 1818 this.SendPropertyChanged("IsPrivileged"); 1819 this.OnIsPrivilegedChanged(); 1796 1820 } 1797 1821 } … … 3430 3454 private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); 3431 3455 3432 private string _UserId; 3433 3434 private string _ExecutionTime; 3435 3436 private string _ExecutionTimeFinishedJobs; 3437 3438 private string _StartToEndTime; 3456 private System.Guid _UserId; 3457 3458 private double _ExecutionTime; 3459 3460 private double _ExecutionTimeFinishedJobs; 3461 3462 private double _StartToEndTime; 3463 3464 private System.Guid _DeletedJobStatisticsId; 3439 3465 3440 3466 #region Extensibility Method Definitions … … 3442 3468 partial void OnValidate(System.Data.Linq.ChangeAction action); 3443 3469 partial void OnCreated(); 3444 partial void OnUserIdChanging( stringvalue);3470 partial void OnUserIdChanging(System.Guid value); 3445 3471 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(); 3472 partial void OnExecutionTimeMsChanging(double value); 3473 partial void OnExecutionTimeMsChanged(); 3474 partial void OnExecutionTimeMsFinishedJobsChanging(double value); 3475 partial void OnExecutionTimeMsFinishedJobsChanged(); 3476 partial void OnStartToEndTimeMsChanging(double value); 3477 partial void OnStartToEndTimeMsChanged(); 3478 partial void OnDeletedJobStatisticsIdChanging(System.Guid value); 3479 partial void OnDeletedJobStatisticsIdChanged(); 3452 3480 #endregion 3453 3481 … … 3457 3485 } 3458 3486 3459 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", CanBeNull=false, IsPrimaryKey=true)]3460 public stringUserId3487 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier NOT NULL")] 3488 public System.Guid UserId 3461 3489 { 3462 3490 get … … 3477 3505 } 3478 3506 3479 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType=" VarChar(30)", CanBeNull=false)]3480 public string ExecutionTime3507 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float")] 3508 public double ExecutionTimeMs 3481 3509 { 3482 3510 get … … 3488 3516 if ((this._ExecutionTime != value)) 3489 3517 { 3490 this.OnExecutionTime Changing(value);3518 this.OnExecutionTimeMsChanging(value); 3491 3519 this.SendPropertyChanging(); 3492 3520 this._ExecutionTime = value; 3493 this.SendPropertyChanged("ExecutionTime ");3494 this.OnExecutionTime Changed();3495 } 3496 } 3497 } 3498 3499 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType=" VarChar(30)", CanBeNull=false)]3500 public string ExecutionTimeFinishedJobs3521 this.SendPropertyChanged("ExecutionTimeMs"); 3522 this.OnExecutionTimeMsChanged(); 3523 } 3524 } 3525 } 3526 3527 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float")] 3528 public double ExecutionTimeMsFinishedJobs 3501 3529 { 3502 3530 get … … 3508 3536 if ((this._ExecutionTimeFinishedJobs != value)) 3509 3537 { 3510 this.OnExecutionTime FinishedJobsChanging(value);3538 this.OnExecutionTimeMsFinishedJobsChanging(value); 3511 3539 this.SendPropertyChanging(); 3512 3540 this._ExecutionTimeFinishedJobs = value; 3513 this.SendPropertyChanged("ExecutionTime FinishedJobs");3514 this.OnExecutionTime FinishedJobsChanged();3515 } 3516 } 3517 } 3518 3519 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType=" VarChar(30)", CanBeNull=false)]3520 public string StartToEndTime3541 this.SendPropertyChanged("ExecutionTimeMsFinishedJobs"); 3542 this.OnExecutionTimeMsFinishedJobsChanged(); 3543 } 3544 } 3545 } 3546 3547 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float")] 3548 public double StartToEndTimeMs 3521 3549 { 3522 3550 get … … 3528 3556 if ((this._StartToEndTime != value)) 3529 3557 { 3530 this.OnStartToEndTime Changing(value);3558 this.OnStartToEndTimeMsChanging(value); 3531 3559 this.SendPropertyChanging(); 3532 3560 this._StartToEndTime = value; 3533 this.SendPropertyChanged("StartToEndTime"); 3534 this.OnStartToEndTimeChanged(); 3561 this.SendPropertyChanged("StartToEndTimeMs"); 3562 this.OnStartToEndTimeMsChanged(); 3563 } 3564 } 3565 } 3566 3567 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DeletedJobStatisticsId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)] 3568 public System.Guid DeletedJobStatisticsId 3569 { 3570 get 3571 { 3572 return this._DeletedJobStatisticsId; 3573 } 3574 set 3575 { 3576 if ((this._DeletedJobStatisticsId != value)) 3577 { 3578 this.OnDeletedJobStatisticsIdChanging(value); 3579 this.SendPropertyChanging(); 3580 this._DeletedJobStatisticsId = value; 3581 this.SendPropertyChanged("DeletedJobStatisticsId"); 3582 this.OnDeletedJobStatisticsIdChanged(); 3535 3583 } 3536 3584 } … … 3568 3616 private System.Guid _UserId; 3569 3617 3570 private string_ExecutionTime;3618 private double _ExecutionTime; 3571 3619 3572 3620 private int _CoresUsed; 3573 3621 3574 private string_ExecutionTimeFinishedJobs;3575 3576 private string_StartToEndTime;3622 private double _ExecutionTimeFinishedJobs; 3623 3624 private double _StartToEndTime; 3577 3625 3578 3626 private EntityRef<Statistics> _Statistics; … … 3586 3634 partial void OnUserIdChanging(System.Guid value); 3587 3635 partial void OnUserIdChanged(); 3588 partial void OnExecutionTime Changing(stringvalue);3589 partial void OnExecutionTime Changed();3636 partial void OnExecutionTimeMsChanging(double value); 3637 partial void OnExecutionTimeMsChanged(); 3590 3638 partial void OnUsedCoresChanging(int value); 3591 3639 partial void OnUsedCoresChanged(); 3592 partial void OnExecutionTime FinishedJobsChanging(stringvalue);3593 partial void OnExecutionTime FinishedJobsChanged();3594 partial void OnStartToEndTime Changing(stringvalue);3595 partial void OnStartToEndTime Changed();3640 partial void OnExecutionTimeMsFinishedJobsChanging(double value); 3641 partial void OnExecutionTimeMsFinishedJobsChanged(); 3642 partial void OnStartToEndTimeMsChanging(double value); 3643 partial void OnStartToEndTimeMsChanged(); 3596 3644 #endregion 3597 3645 … … 3646 3694 } 3647 3695 3648 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType=" VarChar(30)", CanBeNull=false)]3649 public string ExecutionTime3696 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float")] 3697 public double ExecutionTimeMs 3650 3698 { 3651 3699 get … … 3657 3705 if ((this._ExecutionTime != value)) 3658 3706 { 3659 this.OnExecutionTime Changing(value);3707 this.OnExecutionTimeMsChanging(value); 3660 3708 this.SendPropertyChanging(); 3661 3709 this._ExecutionTime = value; 3662 this.SendPropertyChanged("ExecutionTime ");3663 this.OnExecutionTime Changed();3710 this.SendPropertyChanged("ExecutionTimeMs"); 3711 this.OnExecutionTimeMsChanged(); 3664 3712 } 3665 3713 } … … 3686 3734 } 3687 3735 3688 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType=" VarChar(30)", CanBeNull=false)]3689 public string ExecutionTimeFinishedJobs3736 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float")] 3737 public double ExecutionTimeMsFinishedJobs 3690 3738 { 3691 3739 get … … 3697 3745 if ((this._ExecutionTimeFinishedJobs != value)) 3698 3746 { 3699 this.OnExecutionTime FinishedJobsChanging(value);3747 this.OnExecutionTimeMsFinishedJobsChanging(value); 3700 3748 this.SendPropertyChanging(); 3701 3749 this._ExecutionTimeFinishedJobs = value; 3702 this.SendPropertyChanged("ExecutionTime FinishedJobs");3703 this.OnExecutionTime FinishedJobsChanged();3704 } 3705 } 3706 } 3707 3708 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType=" VarChar(30)", CanBeNull=false)]3709 public string StartToEndTime3750 this.SendPropertyChanged("ExecutionTimeMsFinishedJobs"); 3751 this.OnExecutionTimeMsFinishedJobsChanged(); 3752 } 3753 } 3754 } 3755 3756 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float")] 3757 public double StartToEndTimeMs 3710 3758 { 3711 3759 get … … 3717 3765 if ((this._StartToEndTime != value)) 3718 3766 { 3719 this.OnStartToEndTime Changing(value);3767 this.OnStartToEndTimeMsChanging(value); 3720 3768 this.SendPropertyChanging(); 3721 3769 this._StartToEndTime = value; 3722 this.SendPropertyChanged("StartToEndTime ");3723 this.OnStartToEndTime Changed();3770 this.SendPropertyChanged("StartToEndTimeMs"); 3771 this.OnStartToEndTimeMsChanged(); 3724 3772 } 3725 3773 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs
r6229 r6267 95 95 IEnumerable<DT.Resource> GetAssignedResources(Guid jobId); 96 96 IEnumerable<DT.Resource> GetParentResources(Guid resourceId); 97 IEnumerable<DT.Job> GetJobsByResourceId(Guid resourceId); 97 98 #endregion 98 99 … … 123 124 List<DT.UserStatistics> GetUserStatistics(); 124 125 #endregion 125 126 127 128 126 } 129 127 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/prepareHiveDatabase.sql
r6229 r6267 1 USE [HeuristicLab.Hive-3.4] 1 2 /* this script is supposed to be executed after the plain DB is generated by the linq-to-sql schema */ 2 3 … … 108 109 GO 109 110 111 ALTER TABLE [dbo].[DeletedJobStatistics] ALTER COLUMN DeletedJobStatisticsId ADD ROWGUIDCOL; 112 ALTER TABLE [dbo].[DeletedJobStatistics] WITH NOCHECK ADD CONSTRAINT [DF_DeletedJobStatistics_DeletedJobStatisticsId] DEFAULT (newid()) FOR DeletedJobStatisticsId; 113 GO 114 110 115 ALTER TABLE [dbo].[SlaveStatistics] DROP CONSTRAINT [Statistics_SlaveStatistics] 111 116 ALTER TABLE [dbo].[SlaveStatistics] WITH CHECK ADD CONSTRAINT [Statistics_SlaveStatistics] FOREIGN KEY([StatisticsId]) … … 124 129 /* create indices */ 125 130 CREATE INDEX Index_RequiredPlugins_JobId ON RequiredPlugins(JobId); 131 GO 132 133 /* views */ 134 -- ============================================= 135 -- Author: cneumuel 136 -- Description: Returns the first StateLog entry for each job 137 -- ============================================= 138 CREATE VIEW [dbo].[view_FirstState] 139 AS 140 SELECT sl.JobId, sl.DateTime, sl.State 141 FROM dbo.StateLog AS sl INNER JOIN 142 (SELECT JobId, MIN(DateTime) AS DateTime 143 FROM dbo.StateLog 144 GROUP BY JobId) AS minDate ON sl.DateTime = minDate.DateTime AND sl.JobId = minDate.JobId 145 146 GO 147 148 -- ============================================= 149 -- Author: cneumuel 150 -- Description: Returns the last StateLog entry for each job 151 -- ============================================= 152 CREATE VIEW [dbo].[view_LastState] 153 AS 154 SELECT sl.JobId, sl.DateTime, sl.State 155 FROM dbo.StateLog AS sl INNER JOIN 156 (SELECT JobId, MAX(DateTime) AS DateTime 157 FROM dbo.StateLog 158 GROUP BY JobId) AS minDate ON sl.DateTime = minDate.DateTime AND sl.JobId = minDate.JobId 159 160 GO 126 161 127 162 /* triggers */ 128 USE [HeuristicLab.Hive-3.4]129 163 GO 130 164 /****** Object: Trigger [dbo].[tr_HiveExperimentDeleteCascade] Script Date: 04/19/2011 16:31:53 ******/ … … 136 170 -- Author: cneumuel 137 171 -- Create date: 19.04.2011 138 -- Description: Deletes all associated jobs. This cannot be done with cascading delete, 172 -- Description: (1) Writes the execution times of deleted jobs into DeletedJobStats to ensure correct statistics 173 -- (2) Deletes all associated jobs. This cannot be done with cascading delete, 139 174 -- because the job table defines a INSTEAD OF DELETE trigger itself, which 140 175 -- is not compatible with cascading deletes. … … 154 189 CREATE TRIGGER [dbo].[tr_JobDeleteCascade] ON [dbo].[Job] INSTEAD OF DELETE AS 155 190 BEGIN 191 -- add statistics 192 INSERT INTO dbo.DeletedJobStatistics (UserId, ExecutionTimeMs, ExecutionTimeMsFinishedJobs, StartToEndTimeMs) 193 SELECT 194 he.OwnerUserId AS UserId, 195 SUM(j.ExecutionTimeMs) AS ExecutionTimeMs, 196 SUM(CASE ls.State WHEN 'Finished' THEN j.ExecutionTimeMs END) AS ExecutionTimeMsFinishedJobs, 197 SUM(CASE ls.State WHEN 'Finished' THEN DATEDIFF(MS,fs.DateTime,ls.DateTime) ELSE 0 END) AS StartToEndMs 198 FROM 199 deleted j, 200 HiveExperiment he, 201 view_FirstState fs, 202 view_LastState ls 203 WHERE 204 he.HiveExperimentId = j.HiveExperimentId AND 205 fs.JobId = j.JobId AND 206 ls.JobId = j.JobId 207 GROUP BY he.OwnerUserId 208 209 -- recursively delete jobs 156 210 CREATE TABLE #Table( 157 211 JobId uniqueidentifier … … 186 240 --CREATE TRIGGER [dbo].[tr_DeletedJobStats] ON [dbo].[Job] AFTER DELETE AS 187 241 --BEGIN 188 -- INSERT INTO DeletedJobStats SELECT JobId, ExecutionTime FROM deleted 242 243 189 244 --END 245 --GO -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/TransactionManager.cs
r5708 r6267 1 1 using System; 2 2 using System.Transactions; 3 using HeuristicLab.Services.Hive.Common;4 3 5 4 namespace HeuristicLab.Services.Hive.DataAccess { 6 5 public class TransactionManager { 7 public void UseTransaction(Action call ) {8 TransactionScope transaction = CreateTransaction();6 public void UseTransaction(Action call, bool serializable = false) { 7 TransactionScope transaction = serializable ? CreateSerializableTransaction() : CreateTransaction(); 9 8 try { 10 9 call(); … … 16 15 } 17 16 18 public T UseTransaction<T>(Func<T> call ) {19 TransactionScope transaction = CreateTransaction();17 public T UseTransaction<T>(Func<T> call, bool serializable = false) { 18 TransactionScope transaction = serializable ? CreateSerializableTransaction() : CreateTransaction(); 20 19 try { 21 20 T result = call(); … … 29 28 30 29 private static TransactionScope CreateTransaction() { 31 return new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.IsolationLevelScope }); 30 return new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted }); 31 } 32 private static TransactionScope CreateSerializableTransaction() { 33 return new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.Serializable }); 32 34 } 33 35 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs
r6229 r6267 39 39 job1.Command = Command.Pause; 40 40 job1.HiveExperimentId = he.Id; 41 job1.IsPrivileged = true; 41 42 42 43 DT.JobData jobData1 = new DT.JobData(); … … 75 76 Assert.AreEqual(job1.Command, job1loaded.Command); 76 77 Assert.AreEqual(job1.HiveExperimentId, job1loaded.HiveExperimentId); 78 Assert.AreEqual(job1.IsPrivileged, job1loaded.IsPrivileged); 77 79 Assert.IsTrue(Math.Abs((job1loaded.LastJobDataUpdate - jobData1.LastUpdate).TotalSeconds) < 1); 78 80 for (int i = 0; i < job1.StateLog.Count; i++) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs
r6006 r6267 147 147 jobLoaded = service.GetJob(job.Id); 148 148 Assert.AreEqual(JobState.Calculating, jobLoaded.State); 149 Assert.AreEqual(new TimeSpan(1, 5, 10, 20, 30), jobLoaded.ExecutionTime.Value); 149 Assert.AreEqual(new TimeSpan(1, 5, 10, 20, 30), jobLoaded.ExecutionTime); 150 151 // test if the job is returned for the resource 152 var jobsBySlave = service.GetJobsByResourceId(slave.Id); 153 Assert.AreEqual(1, jobsBySlave.Count()); 154 Assert.AreEqual(job.Id, jobsBySlave.Single().Id); 155 156 // set it to finished 157 service.UpdateJobState(jobLoaded.Id, JobState.Finished, slave.Id, null, null); 158 159 // test if the job is returned for the resource 160 var jobsBySlave2 = service.GetJobsByResourceId(slave.Id); 161 Assert.AreEqual(0, jobsBySlave2.Count()); 150 162 151 163 // delete -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
r6168 r6267 147 147 return trans.UseTransaction(() => { 148 148 Job job = dao.UpdateJobState(jobId, jobState, slaveId, userId, exception); 149 149 150 150 if (job.Command.HasValue && job.Command.Value == Command.Pause && job.State == JobState.Paused) { 151 151 job.Command = null; … … 280 280 dbSlave.Memory = slaveInfo.Memory; 281 281 dbSlave.OperatingSystem = slaveInfo.OperatingSystem; 282 283 dbSlave.LastHeartbeat = DateTime.Now; 282 283 dbSlave.LastHeartbeat = DateTime.Now; 284 284 dbSlave.SlaveState = SlaveState.Idle; 285 285 … … 472 472 473 473 public void TriggerLifecycle(bool force) { 474 // use a serializable transaction here to ensure not two threads execute this simultaniously (locking would not work since IIS may use multiple AppDomains) 474 475 trans.UseTransaction(() => { 475 476 DateTime lastCleanup = dao.GetLastCleanup(); … … 478 479 lifecycleManager.Cleanup(); 479 480 } 480 } );481 }, true); 481 482 } 482 483 #endregion … … 526 527 return trans.UseTransaction(() => dao.GetAppointments(x => x.ResourceId == resourceId)); 527 528 } 529 530 public IEnumerable<Job> GetJobsByResourceId(Guid resourceId) { 531 return trans.UseTransaction(() => dao.GetJobsByResourceId(resourceId)); 532 } 528 533 #endregion 529 534 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/LifecycleManager.cs
r6229 r6267 52 52 53 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 update65 66 //{ // per user67 // int activeJobs = 0; // calculating, transferring68 // int waitingJobs = 0; // waiting69 // int stoppedJobs = 0; // finished, failed, aborted, paused70 //}71 72 //{ // per slave73 // int activeJobs = 0; // calculating, transferring74 // double cpuUtilization = 0.0;75 //}76 77 54 } 78 55
Note: See TracChangeset
for help on using the changeset viewer.