Changeset 5778
- Timestamp:
- 03/21/11 14:16:01 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs
r5721 r5778 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Diagnostics; 24 25 using System.IO; 25 26 using System.Runtime.CompilerServices; … … 42 43 public static Core TheCore; 43 44 45 public EventLog ServiceEventLog { get; set; } 46 44 47 public static bool abortRequested { get; set; } 45 48 private Semaphore waitShutdownSem = new Semaphore(0, 1); … … 76 79 abortRequested = false; 77 80 78 //start the client communication service (pipe between slave and slave gui) 79 slaveComm = new ServiceHost(typeof(SlaveCommunicationService)); 80 slaveComm.Open(); 81 82 ClientCom = SlaveClientCom.Instance.ClientCom; 83 ClientCom.LogMessage("Hive Slave started"); 84 85 ConfigManager manager = ConfigManager.Instance; 86 manager.Core = this; 87 88 wcfService = WcfService.Instance; 89 RegisterServiceEvents(); 90 91 StartHeartbeats(); // Start heartbeats thread 92 DispatchMessageQueue(); // dispatch messages until abortRequested 93 94 DeRegisterServiceEvents(); 95 waitShutdownSem.Release(); 81 try { 82 //start the client communication service (pipe between slave and slave gui) 83 slaveComm = new ServiceHost(typeof(SlaveCommunicationService)); 84 slaveComm.Open(); 85 86 ClientCom = SlaveClientCom.Instance.ClientCom; 87 ClientCom.LogMessage("Hive Slave started"); 88 89 ConfigManager manager = ConfigManager.Instance; 90 manager.Core = this; 91 92 wcfService = WcfService.Instance; 93 RegisterServiceEvents(); 94 95 StartHeartbeats(); // Start heartbeats thread 96 DispatchMessageQueue(); // dispatch messages until abortRequested 97 } 98 catch (Exception ex) { 99 if (ServiceEventLog != null) { 100 try { 101 ServiceEventLog.WriteEntry("Hive Slave threw exception: " + ex.ToString() + " with stack trace: " + ex.StackTrace); 102 } 103 catch (Exception) { } 104 } else { 105 throw ex; 106 } 107 } 108 finally { 109 DeRegisterServiceEvents(); 110 waitShutdownSem.Release(); 111 } 96 112 } 97 113 98 114 private void StartHeartbeats() { 99 //Initialize the heartbeat 100 heartbeatManager = new HeartbeatManager { Interval = new TimeSpan(0, 0, 10) }; 101 heartbeatManager.StartHeartbeat(); 115 //Initialize the heartbeat 116 if (heartbeatManager != null) { 117 heartbeatManager = new HeartbeatManager { Interval = new TimeSpan(0, 0, 10) }; 118 heartbeatManager.StartHeartbeat(); 119 } 102 120 } 103 121 … … 194 212 if (job != null) { 195 213 engines[job.Id].Pause(); 196 JobData sJob = engines[job.Id].Get FinishedJob();214 JobData sJob = engines[job.Id].GetPausedJob(); 197 215 // job.Exception = engines[job.Id].CurrentException; // can there be an exception if a job is paused 198 216 job.ExecutionTime = engines[job.Id].ExecutionTime; … … 339 357 ClientCom.LogMessage("Sleep received"); 340 358 heartbeatManager.StopHeartBeat(); 359 heartbeatManager = null; 341 360 DoStopAll(); 342 361 WcfService.Instance.Disconnect(); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs
r5718 r5778 175 175 } 176 176 177 return GetJob(); 178 } 179 180 public JobData GetPausedJob() { 181 if (Job == null) { 182 throw new InvalidStateException("Job is null"); 183 } 184 185 if (Job.ExecutionState == HeuristicLab.Core.ExecutionState.Started) { 186 try { Job.Pause(); } 187 catch { } 188 } 189 190 return GetJob(); 191 } 192 193 private JobData GetJob() { 177 194 if (Job.ExecutionState == HeuristicLab.Core.ExecutionState.Started) { 178 195 throw new InvalidStateException("Job is still running");
Note: See TracChangeset
for help on using the changeset viewer.