Changeset 6431
- Timestamp:
- 06/16/11 14:20:48 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 2 added
- 1 deleted
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ConsoleTests/Program.cs
r6367 r6431 22 22 //TestThreadSafeLog(); return; 23 23 //TestThreadSafePersistence(); return; 24 TestCappedLog(); return; 24 25 string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 25 26 … … 31 32 var app = pm.Applications.Where(x => x.Name == "HeuristicLab.Clients.Hive.Slave.Tests").Single(); 32 33 pm.Run(app); 34 } 35 36 private static void TestCappedLog() { 37 ILog log = new Log(); // maxMessageCount = -1 38 Console.WriteLine("0=={0}", log.Messages.Count()); 39 log.LogMessage("asdf"); 40 Console.WriteLine("1=={0}", log.Messages.Count()); 41 log.LogMessage("asdf"); 42 log.LogMessage("asdf"); 43 Console.WriteLine("3=={0}", log.Messages.Count()); 44 45 ILog log0 = new Log(0); 46 Console.WriteLine("0=={0}", log0.Messages.Count()); 47 log0.LogMessage("asdf"); 48 Console.WriteLine("0=={0}", log0.Messages.Count()); 49 log0.LogMessage("asdf"); 50 log0.LogMessage("asdf"); 51 log0.LogMessage("asdf"); 52 Console.WriteLine("0=={0}", log0.Messages.Count()); 53 54 ILog log1 = new Log(1); 55 log1.LogMessage("asdf 1"); 56 Console.WriteLine("1=={0}", log1.Messages.Count()); 57 log1.LogMessage("asdf 2"); 58 log1.LogMessage("asdf 3"); 59 Console.WriteLine("1=={0}", log1.Messages.Count()); 60 Console.WriteLine("asdf 3=={0}", log1.Messages.First()); 33 61 } 34 62 … … 271 299 PluginUtil.CollectDeclaringPlugins(plugins, types); 272 300 foreach (var plugin in plugins) { 273 var p = PluginUtil.CreatePlugin(plugin , false);301 var p = PluginUtil.CreatePlugin(plugin); 274 302 p.Id = Guid.NewGuid(); 275 303 lock (locker) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj
r6419 r6431 117 117 <Compile Include="StateLogList.cs" /> 118 118 <Compile Include="StateLogListList.cs" /> 119 <Compile Include="ThreadSafeLog.cs" />120 119 <None Include="app_f005pc.config" /> 121 120 <None Include="app_services.config" /> 122 121 <None Include="app.config" /> 122 <None Include="ClassDiagram2.cd" /> 123 123 <None Include="HeuristicLabClientsHivePlugin.cs.frame" /> 124 124 <Compile Include="Exceptions\AddJobToHiveException.cs" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/RefreshableHiveExperiment.cs
r6419 r6431 82 82 } 83 83 84 private ILog log;84 private ThreadSafeLog log; 85 85 public ILog Log { 86 86 get { return log; } 87 set { log = value; } 88 } 89 private static object logLocker = new object(); 87 } 90 88 91 89 #region Constructors and Cloning … … 93 91 this.refreshAutomatically = true; 94 92 this.HiveExperiment = new HiveExperiment(); 95 this.log = new Log();93 this.log = new ThreadSafeLog(new Log()); 96 94 this.jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2); 97 95 this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured); … … 100 98 this.refreshAutomatically = true; 101 99 this.HiveExperiment = hiveExperiment; 102 this.log = new Log();100 this.log = new ThreadSafeLog(new Log()); 103 101 this.jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2); 104 102 this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured); … … 108 106 this.HiveExperiment = original.HiveExperiment; 109 107 this.IsControllable = original.IsControllable; 110 this. Log = cloner.Clone(original.Log);108 this.log = cloner.Clone(original.log); 111 109 this.RefreshAutomatically = false; // do not start results polling automatically 112 110 this.jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2); … … 180 178 181 179 if (!hiveJob.IsFinishedJobDownloaded && !hiveJob.IsDownloading && hiveJob.Job.LastJobDataUpdate < lightweightJob.LastJobDataUpdate) { 182 LogMessage(string.Format("Downloading job {0}", lightweightJob.Id));180 log.LogMessage(string.Format("Downloading job {0}", lightweightJob.Id)); 183 181 hiveJob.IsDownloading = true; 184 182 jobDownloader.DownloadJob(hiveJob.Job, (localJob, itemJob) => { 185 LogMessage(string.Format("Finished downloading job {0}", localJob.Id));183 log.LogMessage(string.Format("Finished downloading job {0}", localJob.Id)); 186 184 HiveJob localHiveJob = GetHiveJobById(localJob.Id); 187 185 … … 222 220 } 223 221 224 // synchronized logging225 private void LogException(Exception exception) {226 lock (logLocker) {227 this.log.LogException(exception);228 }229 }230 // synchronized logging231 private void LogMessage(string message) {232 lock (logLocker) {233 this.log.LogMessage(message);234 }235 }236 237 222 public HiveJob GetHiveJobById(Guid jobId) { 238 223 foreach (HiveJob job in hiveExperiment.HiveJobs) { … … 356 341 public event EventHandler<EventArgs<Exception>> ExceptionOccured; 357 342 private void OnExceptionOccured(Exception exception) { 358 LogException(exception);343 log.LogException(exception); 359 344 var handler = ExceptionOccured; 360 345 if (handler != null) handler(this, new EventArgs<Exception>(exception)); … … 390 375 get { return hiveExperiment.ItemVersion; } 391 376 } 392 393 377 394 378 #region IProgressReporter Members 395 379 public IProgress Progress { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/JobState.cs
r6372 r6431 34 34 /// </summary> 35 35 Waiting, 36 37 ///// <summary>38 ///// The job is set to Finished when all child jobs are Finished.39 ///// </summary>40 //FinishOnChildJobsFinished,41 42 ///// <summary>43 ///// The job is paused and waits on the server to be sent back to a Slave when all of its child jobs are Finished.44 ///// </summary>45 //ResumeOnChildJobsFinished,46 36 47 37 /// <summary> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/HeuristicLabServicesHiveCommonPlugin.cs.frame
r5043 r6431 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Linq; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/Logger.cs
r5711 r6431 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Diagnostics; 3 24 using System.Security; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/Properties/AssemblyInfo.cs.frame
r6372 r6431 7 7 // associated with an assembly. 8 8 [assembly: AssemblyTitle("HeuristicLab.Services.Hive.Common")] 9 [assembly: AssemblyDescription(" ")]9 [assembly: AssemblyDescription("Common classes for HeuristicLab.Hive services")] 10 10 [assembly: AssemblyConfiguration("")] 11 11 [assembly: AssemblyCompany("")] -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs
r6267 r6431 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Net.Security; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLab.Services.Hive.DataAccess-3.4.csproj
r6407 r6431 96 96 <Compile Include="Convert.cs" /> 97 97 <None Include="HeuristicLabServicesHiveDataAccessPlugin.cs.frame" /> 98 <Compile Include="Exceptions\DaoException.cs" />99 98 <Compile Include="HeuristicLabServicesHiveDataAccessPlugin.cs" /> 100 99 <Compile Include="HiveDao.cs" /> … … 148 147 </ItemGroup> 149 148 <ItemGroup> 150 <Content Include="Tools\prepareHiveDatabase.sql" /> 149 <Content Include="Tools\Initialize Hive Database.sql" /> 150 <Content Include="Tools\Prepare Hive Database.sql" /> 151 151 </ItemGroup> 152 152 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLabServicesHiveDataAccessPlugin.cs.frame
r6369 r6431 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Linq; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs
r6419 r6431 481 481 if (entity != null) { 482 482 if (db.Resources.Where(r => r.ParentResourceId == id).Count() > 0) { 483 throw new DaoException("Cannot delete SlaveGroup as long as there are Slaves in the group");483 throw new InvalidOperationException("Cannot delete SlaveGroup as long as there are Slaves in the group"); 484 484 } 485 485 db.Resources.DeleteOnSubmit(entity); … … 758 758 select new { 759 759 UserId = g.Key, 760 StartToEndTime = g.Select(x => x.StateLogs.OrderByDescending(sl => sl.DateTime).First().DateTime - x.StateLogs.OrderBy(sl => sl.DateTime).First().DateTime).Sum()760 StartToEndTime = new TimeSpan(g.Select(x => x.StateLogs.OrderByDescending(sl => sl.DateTime).First().DateTime - x.StateLogs.OrderBy(sl => sl.DateTime).First().DateTime).Sum(ts => ts.Ticks)) 761 761 }; 762 762 foreach (var item in startToEndTimesFinishedJobs) { … … 801 801 #endregion 802 802 } 803 804 public static class TimeSpanExtensions {805 public static TimeSpan Sum(this IEnumerable<TimeSpan> ts) {806 return new TimeSpan(ts.Sum(r => r.Ticks));807 }808 }809 803 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml
r6426 r6431 16 16 <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" /> 17 17 <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime" CanBeNull="false" /> 18 <Column Name="Hash" Type="System.Byte[]" DbType="VarBinary(20) " CanBeNull="true" />18 <Column Name="Hash" Type="System.Byte[]" DbType="VarBinary(20) NOT NULL" CanBeNull="false" /> 19 19 <Association Name="Plugin_RequiredPlugin" Member="RequiredPlugins" ThisKey="PluginId" OtherKey="PluginId" Type="RequiredPlugin" /> 20 20 <Association Name="Plugin_PluginData" Member="PluginData" ThisKey="PluginId" OtherKey="PluginId" Type="PluginData" /> … … 156 156 <Type Name="DeletedJobStatistics"> 157 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" />158 <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" /> 159 <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" /> 160 <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" /> 161 161 <Column Name="DeletedJobStatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> 162 162 </Type> … … 166 166 <Column Name="StatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" /> 167 167 <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" /> 168 <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float " CanBeNull="false" />169 <Column Name="UsedCores" Storage="_CoresUsed" Type="System.Int32" DbType="Int " 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" />168 <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" /> 169 <Column Name="UsedCores" Storage="_CoresUsed" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" /> 170 <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" /> 171 <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" /> 172 172 <Association Name="Statistics_UserStatistics" Member="Statistics" ThisKey="StatisticsId" OtherKey="StatisticsId" Type="Statistics" IsForeignKey="true" /> 173 173 </Type> … … 177 177 <Column Name="StatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" /> 178 178 <Column Name="SlaveId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" /> 179 <Column Name="Cores" Type="System.Int32" DbType="Int " CanBeNull="false" />180 <Column Name="FreeCores" Type="System.Int32" DbType="Int " CanBeNull="false" />181 <Column Name="CpuUtilization" Type="System.Double" DbType="float " CanBeNull="false" />182 <Column Name="Memory" Type="System.Int32" DbType="Int " CanBeNull="false" />183 <Column Name="FreeMemory" Type="System.Int32" DbType="Int " CanBeNull="false" />179 <Column Name="Cores" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" /> 180 <Column Name="FreeCores" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" /> 181 <Column Name="CpuUtilization" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" /> 182 <Column Name="Memory" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" /> 183 <Column Name="FreeMemory" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" /> 184 184 <Association Name="Statistics_SlaveStatistics" Member="Statistics" ThisKey="StatisticsId" OtherKey="StatisticsId" Type="Statistics" IsForeignKey="true" /> 185 185 </Type> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout
r6426 r6431 76 76 </nodes> 77 77 </associationConnector> 78 <associationConnector edgePoints="[(7.5 : 4.30930826822917); (7.5 : 4.84780160677083); (8.875 : 4.84780160677083)]" fixedFrom=" Algorithm" fixedTo="Algorithm">78 <associationConnector edgePoints="[(7.5 : 4.30930826822917); (7.5 : 4.84780160677083); (8.875 : 4.84780160677083)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 79 79 <AssociationMoniker Name="/HiveDataContext/Job/Job_AssignedResource" /> 80 80 <nodes> … … 116 116 </nestedChildShapes> 117 117 </classShape> 118 <associationConnector edgePoints="[(10.875 : 6.28929768880208); (11.25 : 6.28929768880208)]" fixedFrom=" Algorithm" fixedTo="Algorithm">118 <associationConnector edgePoints="[(10.875 : 6.28929768880208); (11.25 : 6.28929768880208)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 119 119 <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_PluginData" /> 120 120 <nodes> … … 130 130 </nodes> 131 131 </associationConnector> 132 <associationConnector edgePoints="[(8.875 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom=" Algorithm" fixedTo="Algorithm">132 <associationConnector edgePoints="[(8.875 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 133 133 <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_RequiredPlugin" /> 134 134 <nodes> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs
r6426 r6431 573 573 } 574 574 575 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Hash", DbType="VarBinary(20) ")]575 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Hash", DbType="VarBinary(20) NOT NULL", CanBeNull=false)] 576 576 public byte[] Hash 577 577 { … … 3505 3505 } 3506 3506 3507 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float ")]3507 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float NOT NULL")] 3508 3508 public double ExecutionTimeMs 3509 3509 { … … 3525 3525 } 3526 3526 3527 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float ")]3527 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float NOT NULL")] 3528 3528 public double ExecutionTimeMsFinishedJobs 3529 3529 { … … 3545 3545 } 3546 3546 3547 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float ")]3547 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float NOT NULL")] 3548 3548 public double StartToEndTimeMs 3549 3549 { … … 3694 3694 } 3695 3695 3696 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float ")]3696 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float NOT NULL")] 3697 3697 public double ExecutionTimeMs 3698 3698 { … … 3714 3714 } 3715 3715 3716 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CoresUsed", DbType="Int ")]3716 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CoresUsed", DbType="Int NOT NULL")] 3717 3717 public int UsedCores 3718 3718 { … … 3734 3734 } 3735 3735 3736 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float ")]3736 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float NOT NULL")] 3737 3737 public double ExecutionTimeMsFinishedJobs 3738 3738 { … … 3754 3754 } 3755 3755 3756 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float ")]3756 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float NOT NULL")] 3757 3757 public double StartToEndTimeMs 3758 3758 { … … 3921 3921 } 3922 3922 3923 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Cores", DbType="Int ")]3923 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Cores", DbType="Int NOT NULL")] 3924 3924 public int Cores 3925 3925 { … … 3941 3941 } 3942 3942 3943 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeCores", DbType="Int ")]3943 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeCores", DbType="Int NOT NULL")] 3944 3944 public int FreeCores 3945 3945 { … … 3961 3961 } 3962 3962 3963 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CpuUtilization", DbType="float ")]3963 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CpuUtilization", DbType="float NOT NULL")] 3964 3964 public double CpuUtilization 3965 3965 { … … 3981 3981 } 3982 3982 3983 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Memory", DbType="Int ")]3983 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Memory", DbType="Int NOT NULL")] 3984 3984 public int Memory 3985 3985 { … … 4001 4001 } 4002 4002 4003 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeMemory", DbType="Int ")]4003 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeMemory", DbType="Int NOT NULL")] 4004 4004 public int FreeMemory 4005 4005 { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs
r6267 r6431 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Linq.Expressions; 25 using HeuristicLab.Services.Hive.Common.DataTransfer; 26 using DT = HeuristicLab.Services.Hive.Common.DataTransfer; 4 27 5 28 namespace HeuristicLab.Services.Hive.DataAccess { 6 using HeuristicLab.Services.Hive.Common.DataTransfer;7 using DT = HeuristicLab.Services.Hive.Common.DataTransfer;8 9 29 public interface IHiveDao { 10 30 #region Job Methods -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Properties/AssemblyInfo.cs.frame
r6372 r6431 7 7 // associated with an assembly. 8 8 [assembly: AssemblyTitle("HeuristicLab.Services.Hive.Server.DataAccess")] 9 [assembly: AssemblyDescription(" ")]9 [assembly: AssemblyDescription("Data access layer for HeuristicLab.Hive database")] 10 10 [assembly: AssemblyConfiguration("")] 11 11 [assembly: AssemblyCompany("")] -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/CreateHiveDatabaseApplication.cs
r5511 r6431 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using HeuristicLab.PluginInfrastructure;23 22 using System.IO; 24 23 using System.Windows.Forms; 24 using HeuristicLab.PluginInfrastructure; 25 25 26 26 namespace HeuristicLab.Services.Hive.DataAccess { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/TransactionManager.cs
r6419 r6431 25 25 26 26 namespace HeuristicLab.Services.Hive.DataAccess { 27 public class TransactionManager {28 public void UseTransaction(Action call, bool serializable = false, bool longRunning = false) {27 public static class TransactionManager { 28 public static void UseTransaction(Action call, bool serializable = false, bool longRunning = false) { 29 29 TransactionScope transaction = CreateTransaction(serializable, longRunning); 30 30 try { … … 37 37 } 38 38 39 public T UseTransaction<T>(Func<T> call, bool serializable = false, bool longRunning = false) {39 public static T UseTransaction<T>(Func<T> call, bool serializable = false, bool longRunning = false) { 40 40 TransactionScope transaction = CreateTransaction(serializable, longRunning); 41 41 try { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs
r6267 r6431 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 23 using System.Collections.Generic; 2 24 using System.Linq; 25 using System.Threading; 3 26 using HeuristicLab.Services.Hive.Common.DataTransfer; 4 27 using HeuristicLab.Services.Hive.Common.ServiceContracts; 5 28 using HeuristicLab.Services.Hive.DataAccess; 6 29 using Microsoft.VisualStudio.TestTools.UnitTesting; 30 using DT = HeuristicLab.Services.Hive.Common.DataTransfer; 7 31 8 32 namespace HeuristicLab.Services.Hive.Tests { 9 using System.Collections.Generic;10 using System.Threading;11 using DT = HeuristicLab.Services.Hive.Common.DataTransfer;12 13 33 [TestClass] 14 34 public class DaoTests { … … 49 69 plugin1.Version = new Version("1.0.0.0"); 50 70 plugin1.UserId = Guid.Empty; 51 plugin1.IsLocal = true;52 71 plugin1.DateCreated = DateTime.Now; 53 72 … … 155 174 DT.Plugin plugin1 = new DT.Plugin(); 156 175 plugin1.DateCreated = DateTime.Now; 157 plugin1.IsLocal = false;158 176 plugin1.Name = "Tests.MyPlugin"; 159 177 plugin1.Version = new Version("1.0.0.0"); … … 168 186 Assert.AreEqual(plugin1.UserId, plugin1loaded.UserId); 169 187 Assert.AreEqual(plugin1.DateCreated.ToString(), plugin1loaded.DateCreated.ToString()); 170 Assert.AreEqual(plugin1.IsLocal, plugin1loaded.IsLocal);171 188 172 189 DT.PluginData pluginData1 = new DT.PluginData(); … … 264 281 Assert.IsTrue(Math.Abs((stats.TimeStamp - statsLoaded.TimeStamp).TotalSeconds) < 1); 265 282 266 for (int i = 0; i < slaveStats.Count; i++) {283 for (int i = 0; i < slaveStats.Count; i++) { 267 284 Assert.AreEqual(slaveStats[i].Cores, statsLoaded.SlaveStatistics.Single(x => x.SlaveId == slaveStats[i].SlaveId).Cores); 268 285 Assert.AreEqual(slaveStats[i].FreeCores, statsLoaded.SlaveStatistics.Single(x => x.SlaveId == slaveStats[i].SlaveId).FreeCores); … … 274 291 for (int i = 0; i < userStats.Count; i++) { 275 292 Assert.AreEqual(userStats[i].ExecutionTime, statsLoaded.UserStatistics.Single(x => x.UserId == userStats[i].UserId).ExecutionTime); 276 Assert.AreEqual(userStats[i].UsedCores, statsLoaded.UserStatistics.Single(x => x.UserId == userStats[i].UserId).UsedCores); 293 Assert.AreEqual(userStats[i].UsedCores, statsLoaded.UserStatistics.Single(x => x.UserId == userStats[i].UserId).UsedCores); 277 294 } 278 295 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Mocks/MockServiceLocator.cs
r6372 r6431 49 49 } 50 50 51 public TransactionManager TransactionManager {52 get { return defaultServiceLocator.TransactionManager; }53 }54 55 51 public HeartbeatManager HeartbeatManager { 56 52 get { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Properties/AssemblyInfo.cs
r5078 r6431 1 1 using System.Reflection; 2 using System.Runtime.CompilerServices;3 2 using System.Runtime.InteropServices; 4 3 … … 7 6 // associated with an assembly. 8 7 [assembly: AssemblyTitle("HeuristicLab.Services.Hive.Tests")] 9 [assembly: AssemblyDescription(" ")]8 [assembly: AssemblyDescription("Unit tests for HeuristicLab.Hive services")] 10 9 [assembly: AssemblyConfiguration("")] 11 10 [assembly: AssemblyCompany("Microsoft")] -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs
r6372 r6431 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Services.Hive.Common; 26 using HeuristicLab.Services.Hive.Common.DataTransfer; 27 using HeuristicLab.Services.Hive.Common.ServiceContracts; 25 28 using Microsoft.VisualStudio.TestTools.UnitTesting; 29 using DT = HeuristicLab.Services.Hive.Common.DataTransfer; 26 30 27 31 namespace HeuristicLab.Services.Hive.Tests { 28 29 using HeuristicLab.Services.Hive.Common;30 using HeuristicLab.Services.Hive.Common.DataTransfer;31 using HeuristicLab.Services.Hive.Common.ServiceContracts;32 using DT = HeuristicLab.Services.Hive.Common.DataTransfer;33 34 32 [TestClass] 35 33 public class ServiceTests { … … 73 71 plugin1.Version = new Version("1.0.0.0"); 74 72 plugin1.UserId = Guid.Empty; 75 plugin1.IsLocal = true;76 73 plugin1.DateCreated = DateTime.Now; 77 74 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeartbeatManager.cs
r6369 r6431 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Linq; … … 9 30 private DataAccess.IHiveDao dao { 10 31 get { return ServiceLocator.Instance.HiveDao; } 11 }12 private HeuristicLab.Services.Hive.DataAccess.TransactionManager trans {13 get { return ServiceLocator.Instance.TransactionManager; }14 32 } 15 33 private IAuthorizationManager auth { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLabServicesHivePlugin.cs.frame
r6369 r6431 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Linq; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
r6426 r6431 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Linq; … … 6 27 using HeuristicLab.Services.Hive.Common.DataTransfer; 7 28 using HeuristicLab.Services.Hive.Common.ServiceContracts; 29 using DA = HeuristicLab.Services.Hive.DataAccess; 8 30 9 31 namespace HeuristicLab.Services.Hive { … … 18 40 get { return ServiceLocator.Instance.HiveDao; } 19 41 } 20 private HeuristicLab.Services.Hive.DataAccess.TransactionManager trans {21 get { return ServiceLocator.Instance.TransactionManager; }22 }23 42 private IAuthenticationManager authen { 24 43 get { return ServiceLocator.Instance.AuthenticationManager; } … … 37 56 public Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> resourceIds) { 38 57 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 39 return trans.UseTransaction(() => {58 return DA.TransactionManager.UseTransaction(() => { 40 59 job.Id = dao.AddJob(job); 41 60 jobData.JobId = job.Id; … … 52 71 public Guid AddChildJob(Guid parentJobId, Job job, JobData jobData) { 53 72 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 54 return trans.UseTransaction(() => {73 return DA.TransactionManager.UseTransaction(() => { 55 74 job.ParentJobId = parentJobId; 56 75 return AddJob(job, jobData, dao.GetAssignedResources(parentJobId).Select(x => x.Id)); … … 90 109 public void UpdateJob(Job job) { 91 110 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 92 trans.UseTransaction(() => {111 DA.TransactionManager.UseTransaction(() => { 93 112 dao.UpdateJob(job); 94 113 }); … … 97 116 public void UpdateJobData(Job job, JobData jobData) { 98 117 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 99 // trans.UseTransaction(() => { // cneumuel: try without transaction118 //DA.TransactionManager.UseTransaction(() => { // cneumuel: try without transaction 100 119 jobData.LastUpdate = DateTime.Now; 101 120 dao.UpdateJob(job); … … 106 125 public void DeleteJob(Guid jobId) { 107 126 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 108 trans.UseTransaction(() => {127 DA.TransactionManager.UseTransaction(() => { 109 128 dao.DeleteJob(jobId); 110 129 }); … … 113 132 public void DeleteChildJobs(Guid parentJobId) { 114 133 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 115 trans.UseTransaction(() => {134 DA.TransactionManager.UseTransaction(() => { 116 135 var jobs = GetChildJobs(parentJobId, true, false); 117 136 foreach (var job in jobs) { … … 124 143 public Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception) { 125 144 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 126 return trans.UseTransaction(() => {145 return DA.TransactionManager.UseTransaction(() => { 127 146 Job job = dao.UpdateJobState(jobId, jobState, slaveId, userId, exception); 128 147 … … 147 166 public void StopJob(Guid jobId) { 148 167 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 149 trans.UseTransaction(() => {168 DA.TransactionManager.UseTransaction(() => { 150 169 var job = dao.GetJob(jobId); 151 170 if (job.State == JobState.Calculating || job.State == JobState.Transferring) { … … 162 181 public void PauseJob(Guid jobId) { 163 182 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 164 trans.UseTransaction(() => {183 DA.TransactionManager.UseTransaction(() => { 165 184 var job = dao.GetJob(jobId); 166 185 if (job.State == JobState.Calculating || job.State == JobState.Transferring) { … … 175 194 public void RestartJob(Guid jobId) { 176 195 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 177 trans.UseTransaction(() => {196 DA.TransactionManager.UseTransaction(() => { 178 197 Job job = dao.UpdateJobState(jobId, JobState.Waiting, null, author.UserId, string.Empty); 179 198 job.Command = null; … … 204 223 public Guid AddHiveExperiment(HiveExperiment hiveExperimentDto) { 205 224 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 206 return trans.UseTransaction(() => {225 return DA.TransactionManager.UseTransaction(() => { 207 226 hiveExperimentDto.OwnerUserId = author.UserId; 208 227 hiveExperimentDto.DateCreated = DateTime.Now; … … 213 232 public void UpdateHiveExperiment(HiveExperiment hiveExperimentDto) { 214 233 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 215 trans.UseTransaction(() => {234 DA.TransactionManager.UseTransaction(() => { 216 235 dao.UpdateHiveExperiment(hiveExperimentDto); 217 236 }); … … 220 239 public void DeleteHiveExperiment(Guid hiveExperimentId) { 221 240 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 222 trans.UseTransaction(() => {241 DA.TransactionManager.UseTransaction(() => { 223 242 HiveExperiment he = dao.GetHiveExperiment(hiveExperimentId); 224 243 dao.DeleteHiveExperiment(hiveExperimentId); // child jobs will be deleted by db-trigger … … 230 249 public void Hello(Slave slaveInfo) { 231 250 authen.AuthenticateForAnyRole(HiveRoles.Slave); 232 trans.UseTransaction(() => {251 DA.TransactionManager.UseTransaction(() => { 233 252 var slave = dao.GetSlave(slaveInfo.Id); 234 253 … … 261 280 public void GoodBye(Guid slaveId) { 262 281 authen.AuthenticateForAnyRole(HiveRoles.Slave); 263 trans.UseTransaction(() => {282 DA.TransactionManager.UseTransaction(() => { 264 283 var slave = dao.GetSlave(slaveId); 265 284 if (slave != null) { … … 275 294 authen.AuthenticateForAnyRole(HiveRoles.Slave); 276 295 TriggerLifecycle(false); 277 return trans.UseTransaction(() => heartbeatManager.ProcessHeartbeat(heartbeat));296 return DA.TransactionManager.UseTransaction(() => heartbeatManager.ProcessHeartbeat(heartbeat)); 278 297 } 279 298 #endregion … … 282 301 public Guid AddPlugin(Plugin plugin, List<PluginData> pluginDatas) { 283 302 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 284 return trans.UseTransaction(() => {303 return DA.TransactionManager.UseTransaction(() => { 285 304 plugin.UserId = author.UserId; 286 305 plugin.DateCreated = DateTime.Now; … … 315 334 List<PluginData> pluginDatas = new List<PluginData>(); 316 335 317 return trans.UseTransaction(() => {336 return DA.TransactionManager.UseTransaction(() => { 318 337 foreach (Guid guid in pluginIds) { 319 338 pluginDatas.AddRange(dao.GetPluginDatas(x => x.PluginId == guid).ToList()); … … 328 347 public Guid AddSlave(Slave slave) { 329 348 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 330 return trans.UseTransaction(() => dao.AddSlave(slave));349 return DA.TransactionManager.UseTransaction(() => dao.AddSlave(slave)); 331 350 } 332 351 333 352 public Guid AddSlaveGroup(SlaveGroup slaveGroup) { 334 353 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 335 return trans.UseTransaction(() => dao.AddSlaveGroup(slaveGroup));354 return DA.TransactionManager.UseTransaction(() => dao.AddSlaveGroup(slaveGroup)); 336 355 } 337 356 … … 358 377 public void UpdateSlave(Slave slave) { 359 378 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 360 trans.UseTransaction(() => {379 DA.TransactionManager.UseTransaction(() => { 361 380 dao.UpdateSlave(slave); 362 381 }); … … 365 384 public void UpdateSlaveGroup(SlaveGroup slaveGroup) { 366 385 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 367 trans.UseTransaction(() => {386 DA.TransactionManager.UseTransaction(() => { 368 387 dao.UpdateSlaveGroup(slaveGroup); 369 388 }); … … 372 391 public void DeleteSlave(Guid slaveId) { 373 392 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 374 trans.UseTransaction(() => {393 DA.TransactionManager.UseTransaction(() => { 375 394 dao.DeleteSlave(slaveId); 376 395 }); … … 379 398 public void DeleteSlaveGroup(Guid slaveGroupId) { 380 399 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 381 trans.UseTransaction(() => {400 DA.TransactionManager.UseTransaction(() => { 382 401 dao.DeleteSlaveGroup(slaveGroupId); 383 402 }); … … 386 405 public void AddResourceToGroup(Guid slaveGroupId, Guid resourceId) { 387 406 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 388 trans.UseTransaction(() => {407 DA.TransactionManager.UseTransaction(() => { 389 408 var resource = dao.GetResource(resourceId); 390 409 resource.ParentResourceId = slaveGroupId; … … 395 414 public void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId) { 396 415 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 397 trans.UseTransaction(() => {416 DA.TransactionManager.UseTransaction(() => { 398 417 var resource = dao.GetResource(resourceId); 399 418 resource.ParentResourceId = null; … … 404 423 public Guid GetResourceId(string resourceName) { 405 424 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 406 return trans.UseTransaction(() => {425 return DA.TransactionManager.UseTransaction(() => { 407 426 var resource = dao.GetResources(x => x.Name == resourceName).FirstOrDefault(); 408 427 if (resource != null) { … … 416 435 public void TriggerLifecycle(bool force) { 417 436 // use a serializable transaction here to ensure not two threads execute this simultaniously (mutex-lock would not work since IIS may use multiple AppDomains) 418 trans.UseTransaction(() => {437 DA.TransactionManager.UseTransaction(() => { 419 438 DateTime lastCleanup = dao.GetLastCleanup(); 420 439 if (force || DateTime.Now - lastCleanup > TimeSpan.FromSeconds(59)) { … … 446 465 public Guid AddAppointment(Appointment appointment) { 447 466 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 448 return trans.UseTransaction(() => dao.AddAppointment(appointment));467 return DA.TransactionManager.UseTransaction(() => dao.AddAppointment(appointment)); 449 468 } 450 469 451 470 public void DeleteAppointment(Guid appointmentId) { 452 471 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 453 trans.UseTransaction(() => {472 DA.TransactionManager.UseTransaction(() => { 454 473 dao.DeleteAppointment(appointmentId); 455 474 }); … … 458 477 public void UpdateAppointment(Appointment appointment) { 459 478 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 460 trans.UseTransaction(() => {479 DA.TransactionManager.UseTransaction(() => { 461 480 dao.UpdateAppointment(appointment); 462 481 }); … … 465 484 public IEnumerable<Appointment> GetScheduleForResource(Guid resourceId) { 466 485 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 467 return trans.UseTransaction(() => dao.GetAppointments(x => x.ResourceId == resourceId));486 return DA.TransactionManager.UseTransaction(() => dao.GetAppointments(x => x.ResourceId == resourceId)); 468 487 } 469 488 470 489 public IEnumerable<Job> GetJobsByResourceId(Guid resourceId) { 471 490 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 472 return trans.UseTransaction(() => dao.GetJobsByResourceId(resourceId));491 return DA.TransactionManager.UseTransaction(() => dao.GetJobsByResourceId(resourceId)); 473 492 } 474 493 #endregion -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IServiceLocator.cs
r6369 r6431 28 28 IHiveDao HiveDao { get; } 29 29 ILifecycleManager LifecycleManager { get; } 30 TransactionManager TransactionManager { get; }31 30 HeartbeatManager HeartbeatManager { get; } 32 31 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/LifecycleManager.cs
r6367 r6431 33 33 private DataAccess.IHiveDao dao { 34 34 get { return ServiceLocator.Instance.HiveDao; } 35 }36 private HeuristicLab.Services.Hive.DataAccess.TransactionManager trans {37 get { return ServiceLocator.Instance.TransactionManager; }38 35 } 39 36 private IAuthorizationManager auth { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Properties/AssemblyInfo.cs.frame
r6372 r6431 7 7 // associated with an assembly. 8 8 [assembly: AssemblyTitle("HeuristicLab.Services.Hive")] 9 [assembly: AssemblyDescription(" ")]9 [assembly: AssemblyDescription("Business logic for HeuristicLab.Hive services")] 10 10 [assembly: AssemblyConfiguration("")] 11 11 [assembly: AssemblyCompany("")] -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/ServiceLocator.cs
r6362 r6431 1 using HeuristicLab.Services.Hive.DataAccess; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using HeuristicLab.Services.Hive.DataAccess; 2 23 3 24 namespace HeuristicLab.Services.Hive { … … 18 39 if (hiveDao == null) hiveDao = new HiveDao(); 19 40 return hiveDao; 20 }21 }22 23 private TransactionManager transactionManager;24 public TransactionManager TransactionManager {25 get {26 if (transactionManager == null) transactionManager = new TransactionManager();27 return transactionManager;28 41 } 29 42 }
Note: See TracChangeset
for help on using the changeset viewer.