Changeset 5593 for branches/HeuristicLab.Hive-3.4/sources
- Timestamp:
- 03/02/11 15:23:59 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 9 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/Mocks/MockHiveService.cs
r5511 r5593 335 335 #endregion 336 336 337 #region Lifecycle Methods 338 public void TriggerLifecycle() { 339 throw new NotImplementedException(); 340 } 341 #endregion 337 342 } 338 343 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/HeuristicLab.Clients.Hive.Slave-3.4.csproj
r5591 r5593 124 124 <Compile Include="StatusCommons.cs" /> 125 125 <Compile Include="WcfService.cs" /> 126 <None Include="app.config" /> 126 127 <None Include="app_ascheibe.config" /> 127 128 <None Include="app_f005pc.config" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Hive 3.4.sln
r5538 r5593 72 72 EndProject 73 73 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.DayView-1.0", "HeuristicLab.ExtLibs\HeuristicLab.DayView\1.0\HeuristicLab.DayView-1.0.csproj", "{02766ECC-D0F5-4115-9ECA-47409167B638}" 74 EndProject 75 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreateEventLogSources", "CreateEventLogSources\CreateEventLogSources.csproj", "{A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}" 76 EndProject 77 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Clients.Hive.LifecycleClient", "HeuristicLab.Clients.Hive.LifecycleClient\HeuristicLab.Clients.Hive.LifecycleClient.csproj", "{54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}" 74 78 EndProject 75 79 Global … … 311 315 {02766ECC-D0F5-4115-9ECA-47409167B638}.Release|x86.ActiveCfg = Release|x86 312 316 {02766ECC-D0F5-4115-9ECA-47409167B638}.Release|x86.Build.0 = Release|x86 317 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 318 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}.Debug|Any CPU.Build.0 = Debug|Any CPU 319 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 320 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}.Debug|Mixed Platforms.Build.0 = Debug|x86 321 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}.Debug|x64.ActiveCfg = Debug|x86 322 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}.Debug|x86.ActiveCfg = Debug|x86 323 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}.Debug|x86.Build.0 = Debug|x86 324 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}.Release|Any CPU.ActiveCfg = Release|x86 325 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}.Release|Mixed Platforms.ActiveCfg = Release|x86 326 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}.Release|Mixed Platforms.Build.0 = Release|x86 327 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}.Release|x64.ActiveCfg = Release|x86 328 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}.Release|x86.ActiveCfg = Release|x86 329 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB}.Release|x86.Build.0 = Release|x86 330 {54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 331 {54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}.Debug|Any CPU.Build.0 = Debug|Any CPU 332 {54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 333 {54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}.Debug|Mixed Platforms.Build.0 = Debug|x86 334 {54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}.Debug|x64.ActiveCfg = Debug|x86 335 {54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}.Debug|x86.ActiveCfg = Debug|x86 336 {54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}.Debug|x86.Build.0 = Debug|x86 337 {54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}.Release|Any CPU.ActiveCfg = Release|x86 338 {54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}.Release|Mixed Platforms.ActiveCfg = Release|x86 339 {54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}.Release|Mixed Platforms.Build.0 = Release|x86 340 {54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}.Release|x64.ActiveCfg = Release|x86 341 {54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}.Release|x86.ActiveCfg = Release|x86 342 {54491B6A-1EDD-4C76-90A7-338BA9C1FBF8}.Release|x86.Build.0 = Release|x86 313 343 EndGlobalSection 314 344 GlobalSection(SolutionProperties) = preSolution -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/Logger.cs
r5511 r5593 1 1 using System; 2 2 using System.Diagnostics; 3 using System.Security; 4 using System.Threading; 3 5 4 6 namespace HeuristicLab.Services.Hive.Common { … … 17 19 private EventLog log; 18 20 21 /// <summary> 22 /// Creating an EventSource requires certain permissions, which by default a IIS AppPool user does not have. 23 /// In this case just ignore security exceptions. 24 /// In order to make this work, the eventsource needs to be created manually 25 /// </summary> 19 26 public Logger(string name, string source) { 20 //if (!EventLog.SourceExists(name)) { 21 // EventLog.CreateEventSource(source, name); 22 //} 23 //log = new EventLog(name); 24 //log.Source = source; 27 try { 28 if (!EventLog.SourceExists(source)) { 29 EventLog.CreateEventSource(source, name); 30 } 31 log = new EventLog(name); 32 log.Source = source; 33 } 34 catch (SecurityException) { } 25 35 } 26 36 27 37 public void Log(string message) { 28 //log.WriteEntry(string.Format("{0} (AppDomain: {1}, Thread: {2})", message, AppDomain.CurrentDomain.Id, Thread.CurrentThread.ManagedThreadId), EventLogEntryType.Information); 38 try { 39 log.WriteEntry(string.Format("{0} (AppDomain: {1}, Thread: {2})", message, AppDomain.CurrentDomain.Id, Thread.CurrentThread.ManagedThreadId), EventLogEntryType.Information); 40 } 41 catch (SecurityException) { } 29 42 } 30 43 31 44 public void Error(Exception e) { 32 //log.WriteEntry(string.Format("{0} (AppDomain: {1}, Thread: {2})", e.Message, AppDomain.CurrentDomain.Id, Thread.CurrentThread.ManagedThreadId), EventLogEntryType.Error); 45 try { 46 log.WriteEntry(string.Format("{0} (AppDomain: {1}, Thread: {2})", e.Message, AppDomain.CurrentDomain.Id, Thread.CurrentThread.ManagedThreadId), EventLogEntryType.Error); 47 } 48 catch (SecurityException) { } 33 49 } 34 50 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs
r5526 r5593 135 135 Guid GetResourceId(string resourceName); 136 136 137 [OperationContract] 138 void TriggerLifecycle(); 137 139 #endregion 138 140 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs
r5526 r5593 558 558 #endregion 559 559 560 #region Lifecycle Methods 561 public DateTime GetLastCleanup() { 562 using (var db = CreateContext()) { 563 var entity = db.Lifecycles.SingleOrDefault(); 564 return entity != null ? entity.LastCleanup : DateTime.MinValue; 565 } 566 } 567 568 public void SetLastCleanup(DateTime datetime) { 569 using (var db = CreateContext()) { 570 var entity = db.Lifecycles.SingleOrDefault(); 571 if (entity != null) { 572 entity.LastCleanup = datetime; 573 } else { 574 entity = new Lifecycle(); 575 entity.LifecycleId = 0; // always only one entry with ID:0 576 entity.LastCleanup = datetime; 577 db.Lifecycles.InsertOnSubmit(entity); 578 } 579 db.SubmitChanges(); 580 } 581 } 582 #endregion 560 583 } 561 584 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml
r5526 r5593 143 143 </Type> 144 144 </Table> 145 <Table Name="" Member="Lifecycles"> 146 <Type Name="Lifecycle"> 147 <Column Name="LifecycleId" Type="System.Int32" DbType="Int" IsPrimaryKey="true" CanBeNull="false" /> 148 <Column Name="LastCleanup" Type="System.DateTime" DbType="DateTime" CanBeNull="false" /> 149 </Type> 150 </Table> 145 151 </Database> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout
r5526 r5593 83 83 </nodes> 84 84 </associationConnector> 85 <associationConnector edgePoints="[(7.4687475 : 3.73240397135417); (7.4687475 : 5.5)]" fixedFrom=" Algorithm" fixedTo="Algorithm">85 <associationConnector edgePoints="[(7.4687475 : 3.73240397135417); (7.4687475 : 5.5)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 86 86 <AssociationMoniker Name="/HiveDataContext/Job/Job_RequiredPlugin" /> 87 87 <nodes> … … 104 104 </nodes> 105 105 </associationConnector> 106 <associationConnector edgePoints="[(6.5 : 3.17870198567708); (6.125 : 3.17870198567708)]" fixedFrom=" Algorithm" fixedTo="Algorithm">106 <associationConnector edgePoints="[(6.5 : 3.17870198567708); (6.125 : 3.17870198567708)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 107 107 <AssociationMoniker Name="/HiveDataContext/Job/Job_HiveExperiment" /> 108 108 <nodes> … … 130 130 </nodes> 131 131 </associationConnector> 132 <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom=" Algorithm" fixedTo="Algorithm">132 <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 133 133 <AssociationMoniker Name="/HiveDataContext/Job/Job_JobData" /> 134 134 <nodes> … … 163 163 </nestedChildShapes> 164 164 </classShape> 165 <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom=" Algorithm" fixedTo="Algorithm">165 <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 166 166 <AssociationMoniker Name="/HiveDataContext/Job/Job_StateLog" /> 167 167 <nodes> … … 170 170 </nodes> 171 171 </associationConnector> 172 <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">172 <associationConnector edgePoints="[(11.25 : 1.78929768880208); (10.9375 : 1.78929768880208); (10.9375 : 0.6875); (2.75 : 0.6875); (2.75 : 1)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 173 173 <AssociationMoniker Name="/HiveDataContext/Resource/Resource_StateLog" /> 174 174 <nodes> … … 184 184 </nodes> 185 185 </associationConnector> 186 <classShape Id="b4e7aaa8-a382-4560-a1fd-498de77e9340" absoluteBounds="1.75, 5.5, 2, 1.1939925130208327"> 187 <DataClassMoniker Name="/HiveDataContext/Lifecycle" /> 188 <nestedChildShapes> 189 <elementListCompartment Id="03597a2c-5c5d-4c2c-b741-c49ab5aa34d5" absoluteBounds="1.7650000000000001, 5.96, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> 190 </nestedChildShapes> 191 </classShape> 186 192 </nestedChildShapes> 187 193 </ordesignerObjectsDiagram> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs
r5526 r5593 64 64 partial void UpdateHiveExperimentPermission(HiveExperimentPermission instance); 65 65 partial void DeleteHiveExperimentPermission(HiveExperimentPermission instance); 66 partial void InsertLifecycle(Lifecycle instance); 67 partial void UpdateLifecycle(Lifecycle instance); 68 partial void DeleteLifecycle(Lifecycle instance); 66 69 #endregion 67 70 … … 175 178 { 176 179 return this.GetTable<HiveExperimentPermission>(); 180 } 181 } 182 183 public System.Data.Linq.Table<Lifecycle> Lifecycles 184 { 185 get 186 { 187 return this.GetTable<Lifecycle>(); 177 188 } 178 189 } … … 3190 3201 } 3191 3202 } 3203 3204 [global::System.Data.Linq.Mapping.TableAttribute(Name="")] 3205 public partial class Lifecycle : INotifyPropertyChanging, INotifyPropertyChanged 3206 { 3207 3208 private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); 3209 3210 private int _LifecycleId; 3211 3212 private System.DateTime _LastCleanup; 3213 3214 #region Extensibility Method Definitions 3215 partial void OnLoaded(); 3216 partial void OnValidate(System.Data.Linq.ChangeAction action); 3217 partial void OnCreated(); 3218 partial void OnLifecycleIdChanging(int value); 3219 partial void OnLifecycleIdChanged(); 3220 partial void OnLastCleanupChanging(System.DateTime value); 3221 partial void OnLastCleanupChanged(); 3222 #endregion 3223 3224 public Lifecycle() 3225 { 3226 OnCreated(); 3227 } 3228 3229 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LifecycleId", DbType="Int", IsPrimaryKey=true)] 3230 public int LifecycleId 3231 { 3232 get 3233 { 3234 return this._LifecycleId; 3235 } 3236 set 3237 { 3238 if ((this._LifecycleId != value)) 3239 { 3240 this.OnLifecycleIdChanging(value); 3241 this.SendPropertyChanging(); 3242 this._LifecycleId = value; 3243 this.SendPropertyChanged("LifecycleId"); 3244 this.OnLifecycleIdChanged(); 3245 } 3246 } 3247 } 3248 3249 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LastCleanup", DbType="DateTime")] 3250 public System.DateTime LastCleanup 3251 { 3252 get 3253 { 3254 return this._LastCleanup; 3255 } 3256 set 3257 { 3258 if ((this._LastCleanup != value)) 3259 { 3260 this.OnLastCleanupChanging(value); 3261 this.SendPropertyChanging(); 3262 this._LastCleanup = value; 3263 this.SendPropertyChanged("LastCleanup"); 3264 this.OnLastCleanupChanged(); 3265 } 3266 } 3267 } 3268 3269 public event PropertyChangingEventHandler PropertyChanging; 3270 3271 public event PropertyChangedEventHandler PropertyChanged; 3272 3273 protected virtual void SendPropertyChanging() 3274 { 3275 if ((this.PropertyChanging != null)) 3276 { 3277 this.PropertyChanging(this, emptyChangingEventArgs); 3278 } 3279 } 3280 3281 protected virtual void SendPropertyChanged(String propertyName) 3282 { 3283 if ((this.PropertyChanged != null)) 3284 { 3285 this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 3286 } 3287 } 3288 } 3192 3289 } 3193 3290 #pragma warning restore 1591 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs
r5526 r5593 100 100 Guid GetExperimentForJob(Guid jobId); 101 101 #endregion 102 103 #region Lifecycle Methods 104 DateTime GetLastCleanup(); 105 void SetLastCleanup(DateTime datetime); 106 #endregion 102 107 } 103 108 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Mocks/MockLifecycleManager.cs
r5405 r5593 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using HeuristicLab.Services.Hive.Common;25 using HeuristicLab.Services.Hive.Common.DataTransfer;26 22 27 23 namespace HeuristicLab.Services.Hive.Tests.Mocks { 28 24 public class MockLifecycleManager : ILifecycleManager { 29 30 public void Start() { } 31 32 public void Stop() { } 25 public void Cleanup() { } 33 26 } 34 27 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs
r5526 r5593 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Threading;26 25 using HeuristicLab.Services.Hive.Common; 27 26 using HeuristicLab.Services.Hive.Common.DataTransfer; … … 242 241 243 242 // lifecycle - let it process one server-heartbeat; the parent job must NOT be set to finished 244 var lifecycleManager = new LifecycleManager(); 245 lifecycleManager.Start(); 246 Thread.Sleep(1000); 247 lifecycleManager.Stop(); 243 service.TriggerLifecycle(); 248 244 249 245 parentJobLoaded = service.GetJob(parentJob.Id); … … 255 251 256 252 // lifecycle - let it process one server-heartbeat; this should set the parent job to finished 257 lifecycleManager.Start(); 258 Thread.Sleep(1000); 259 lifecycleManager.Stop(); 253 service.TriggerLifecycle(); 260 254 261 255 // test if parent job is finished -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Web/Hive-3.4/Web.config
r5591 r5593 70 70 71 71 <system.webServer> 72 < modules runAllManagedModulesForAllRequests="true">72 <!--<modules runAllManagedModulesForAllRequests="true"> 73 73 <add name="HiveServerModule" type="HeuristicLab.Services.Hive.IISModules.HiveServerModule"/> 74 </modules> 74 </modules>--> 75 75 <directoryBrowse enabled="true"/> 76 76 </system.webServer> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLab.Services.Hive-3.4.csproj
r5405 r5593 115 115 <Compile Include="Interfaces\ILifecycleManager.cs" /> 116 116 <Compile Include="Interfaces\IServiceLocator.cs" /> 117 <Compile Include="Standalone\HeuristicLabServicesHiveApplication.cs" />118 <Compile Include="Standalone\MainForm.cs">119 <SubType>Form</SubType>120 </Compile>121 <Compile Include="Standalone\MainForm.Designer.cs">122 <DependentUpon>MainForm.cs</DependentUpon>123 </Compile>124 117 <Compile Include="AuthorizationManager.cs" /> 125 118 <Compile Include="HeuristicLabServicesHivePlugin.cs" /> … … 148 141 </ItemGroup> 149 142 <ItemGroup> 150 <EmbeddedResource Include="Standalone\MainForm.resx"> 151 <DependentUpon>MainForm.cs</DependentUpon> 152 </EmbeddedResource> 143 <Folder Include="Standalone\" /> 153 144 </ItemGroup> 154 145 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
r5535 r5593 229 229 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 230 230 public List<MessageContainer> Heartbeat(Heartbeat heartbeat) { 231 TriggerLifecycle(); 232 231 233 using (trans.OpenTransaction()) { 232 234 return heartbeatManager.ProcessHeartbeat(heartbeat); … … 255 257 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 256 258 public IEnumerable<Plugin> GetPlugins() { 257 return dao.GetPlugins(x => true);259 return dao.GetPlugins(x => x.IsLocal == false); 258 260 } 259 261 … … 382 384 } 383 385 } 386 387 public void TriggerLifecycle() { 388 using (trans.OpenTransaction()) { 389 DateTime lastCleanup = dao.GetLastCleanup(); 390 if (DateTime.Now - lastCleanup > TimeSpan.FromSeconds(59)) { 391 dao.SetLastCleanup(DateTime.Now); 392 lifecycleManager.Cleanup(); 393 } 394 } 395 } 384 396 #endregion 385 397 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/ILifecycleManager.cs
r5405 r5593 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using HeuristicLab.Services.Hive.Common; 6 using HeuristicLab.Services.Hive.Common.DataTransfer; 7 1 8 2 namespace HeuristicLab.Services.Hive { 9 3 /// <summary> … … 11 5 /// </summary> 12 6 public interface ILifecycleManager { 13 void Start(); 14 15 void Stop(); 7 void Cleanup(); 16 8 } 17 9 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/LifecycleManager.cs
r5526 r5593 1 1 using System; 2 2 using System.Linq; 3 using HeuristicLab.Core;4 3 using HeuristicLab.Services.Hive.Common; 5 4 using HeuristicLab.Services.Hive.Common.DataTransfer; … … 7 6 namespace HeuristicLab.Services.Hive { 8 7 /// <summary> 9 /// This class holds the state of all recent heartbeats and decides to reschedule jobs and set slaves offline8 /// This class offers methods for cleaning up offline slaves and jobs 10 9 /// </summary> 11 10 public class LifecycleManager : ILifecycleManager { … … 19 18 get { return ServiceLocator.Instance.AuthorizationManager; } 20 19 } 21 22 private static object locker = new object(); 23 24 // Windows-Forms timer is single threaded, so callbacks will be synchron 25 private System.Windows.Forms.Timer timer; 26 27 public ExecutionState ExecutionState { 28 get { return timer.Enabled ? ExecutionState.Started : Core.ExecutionState.Stopped; } 20 private ILogger log { 21 get { return LogFactory.GetLogger(this.GetType().Namespace); } 29 22 } 30 23 31 public LifecycleManager() { 32 this.timer = new System.Windows.Forms.Timer(); 33 this.timer.Tick += new EventHandler(timer_Tick); 34 } 35 36 public void Start() { 37 if (ExecutionState == Core.ExecutionState.Stopped) { 38 // kick off the event immediately 39 timer_Tick(this, EventArgs.Empty); 40 41 // start the timer 42 this.timer.Interval = (int)new TimeSpan(0, 0, 30).TotalMilliseconds; 43 this.timer.Start(); 44 } 45 } 46 47 public void Stop() { 48 if (ExecutionState == Core.ExecutionState.Started) { 49 timer.Stop(); 50 } 51 } 52 53 /// <summary> 54 /// This method is supposed to check if slaves are online 55 /// if not -> set them offline and check if they where calculating a job 56 /// </summary> 57 private void timer_Tick(object sender, EventArgs e) { 58 lock (locker) { 59 using (trans.OpenTransaction()) { 60 SetTimeoutSlavesOffline(); 61 FinishParentJobs(); 62 } 63 } 24 public void Cleanup() { 25 log.Log("LifecycleManager.Cleanup()"); 26 SetTimeoutSlavesOffline(); 27 FinishParentJobs(); 64 28 } 65 29 … … 101 65 } 102 66 } 67 103 68 } 104 69 }
Note: See TracChangeset
for help on using the changeset viewer.