- Timestamp:
- 01/02/12 11:40:31 (13 years ago)
- Location:
- branches/RegressionBenchmarks
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RegressionBenchmarks
-
branches/RegressionBenchmarks/HeuristicLab.Clients.Hive.Slave/3.3/Core.cs
r6998 r7255 47 47 private Semaphore waitShutdownSem = new Semaphore(0, 1); 48 48 private bool abortRequested; 49 private ISlaveCommunication clientCom;50 49 private ServiceHost slaveComm; 51 50 private WcfService wcfService; … … 77 76 slaveComm = new ServiceHost(typeof(SlaveCommunicationService)); 78 77 slaveComm.Open(); 79 clientCom = SlaveClientCom.Instance.ClientCom; 80 78 81 79 // delete all left over task directories 82 80 pluginManager.CleanPluginTemp(); 83 clientCom.LogMessage("Hive Slave started");81 SlaveClientCom.Instance.LogMessage("Hive Slave started"); 84 82 85 83 wcfService = WcfService.Instance; … … 93 91 EventLogManager.LogException(ex); 94 92 } else { 95 //try to log with clientCom. if this works the user sees at least a message,93 //try to log with SlaveClientCom.Instance. if this works the user sees at least a message, 96 94 //else an exception will be thrown anyways. 97 clientCom.LogMessage(string.Format("Uncaught exception: {0} {1} Core is going to shutdown.", ex.ToString(), Environment.NewLine));95 SlaveClientCom.Instance.LogMessage(string.Format("Uncaught exception: {0} {1} Core is going to shutdown.", ex.ToString(), Environment.NewLine)); 98 96 } 99 97 ShutdownCore(); 100 } 101 finally { 98 } finally { 102 99 DeregisterServiceEvents(); 103 100 waitShutdownSem.Release(); … … 119 116 DetermineAction(container); 120 117 if (!abortRequested) { 121 clientCom.StatusChanged(configManager.GetStatusForClientConsole());118 SlaveClientCom.Instance.StatusChanged(configManager.GetStatusForClientConsole()); 122 119 } 123 120 } … … 135 132 136 133 private void WcfService_ExceptionOccured(object sender, EventArgs<Exception> e) { 137 clientCom.LogMessage(string.Format("Connection to server interruped with exception: {0}", e.Value.Message));134 SlaveClientCom.Instance.LogMessage(string.Format("Connection to server interruped with exception: {0}", e.Value.Message)); 138 135 } 139 136 140 137 private void WcfService_Connected(object sender, EventArgs e) { 141 clientCom.LogMessage("Connected successfully to Hive server");138 SlaveClientCom.Instance.LogMessage("Connected successfully to Hive server"); 142 139 } 143 140 … … 147 144 /// <param name="container">The container, containing the message</param> 148 145 private void DetermineAction(MessageContainer container) { 149 clientCom.LogMessage(string.Format("Message: {0} for task: {1} ", container.Message.ToString(), container.TaskId));146 SlaveClientCom.Instance.LogMessage(string.Format("Message: {0} for task: {1} ", container.Message.ToString(), container.TaskId)); 150 147 151 148 switch (container.Message) { … … 196 193 .ContinueWith((t) => { 197 194 SlaveStatusInfo.IncrementExceptionOccured(); 198 clientCom.LogMessage(t.Exception.ToString());195 SlaveClientCom.Instance.LogMessage(t.Exception.ToString()); 199 196 }, TaskContinuationOptions.OnlyOnFaulted); 200 197 } … … 204 201 .ContinueWith((t) => { 205 202 SlaveStatusInfo.IncrementExceptionOccured(); 206 clientCom.LogMessage(t.Exception.ToString());203 SlaveClientCom.Instance.LogMessage(t.Exception.ToString()); 207 204 }, TaskContinuationOptions.OnlyOnFaulted); 208 205 } … … 212 209 .ContinueWith((t) => { 213 210 SlaveStatusInfo.IncrementExceptionOccured(); 214 clientCom.LogMessage(t.Exception.ToString());211 SlaveClientCom.Instance.LogMessage(t.Exception.ToString()); 215 212 }, TaskContinuationOptions.OnlyOnFaulted); 216 213 } … … 220 217 .ContinueWith((t) => { 221 218 SlaveStatusInfo.IncrementExceptionOccured(); 222 clientCom.LogMessage(t.Exception.ToString());219 SlaveClientCom.Instance.LogMessage(t.Exception.ToString()); 223 220 }, TaskContinuationOptions.OnlyOnFaulted); 224 221 } … … 334 331 if (task == null) throw new TaskNotFoundException(e.Value.TaskId); 335 332 task.ExecutionTime = e.Value.ExecutionTime; 336 TaskData taskData = e.Value .GetTaskData();333 TaskData taskData = e.Value2; 337 334 wcfService.UpdateTaskData(task, taskData, configManager.GetClientInfo().Id, TaskState.Paused); 338 335 } 339 336 catch (TaskNotFoundException ex) { 340 clientCom.LogMessage(ex.ToString());337 SlaveClientCom.Instance.LogMessage(ex.ToString()); 341 338 } 342 339 catch (Exception ex) { 343 clientCom.LogMessage(ex.ToString());340 SlaveClientCom.Instance.LogMessage(ex.ToString()); 344 341 } 345 342 } … … 352 349 if (task == null) throw new TaskNotFoundException(e.Value.TaskId); 353 350 task.ExecutionTime = e.Value.ExecutionTime; 354 TaskData taskData = e.Value .GetTaskData();351 TaskData taskData = e.Value2; 355 352 wcfService.UpdateTaskData(task, taskData, configManager.GetClientInfo().Id, TaskState.Finished); 356 353 } 357 354 catch (TaskNotFoundException ex) { 358 clientCom.LogMessage(ex.ToString());355 SlaveClientCom.Instance.LogMessage(ex.ToString()); 359 356 } 360 357 catch (Exception ex) { 361 clientCom.LogMessage(ex.ToString());358 SlaveClientCom.Instance.LogMessage(ex.ToString()); 362 359 } 363 360 } … … 379 376 wcfService.UpdateJobState(task.Id, TaskState.Failed, exception.ToString()); 380 377 } 381 clientCom.LogMessage(exception.Message);378 SlaveClientCom.Instance.LogMessage(exception.Message); 382 379 } 383 380 catch (TaskNotFoundException ex) { 384 381 SlaveStatusInfo.IncrementExceptionOccured(); 385 clientCom.LogMessage(ex.ToString());382 SlaveClientCom.Instance.LogMessage(ex.ToString()); 386 383 } 387 384 catch (Exception ex) { 388 385 SlaveStatusInfo.IncrementExceptionOccured(); 389 clientCom.LogMessage(ex.ToString());386 SlaveClientCom.Instance.LogMessage(ex.ToString()); 390 387 } 391 388 } … … 395 392 SlaveStatusInfo.IncrementExceptionOccured(); 396 393 heartbeatManager.AwakeHeartBeatThread(); 397 clientCom.LogMessage(string.Format("Exception occured for task {0}: {1}", e.Value.TaskId, e.Value2.ToString()));394 SlaveClientCom.Instance.LogMessage(string.Format("Exception occured for task {0}: {1}", e.Value.TaskId, e.Value2.ToString())); 398 395 wcfService.UpdateJobState(e.Value.TaskId, TaskState.Waiting, e.Value2.ToString()); 399 396 } … … 407 404 private void log_MessageAdded(object sender, EventArgs<string> e) { 408 405 try { 409 clientCom.LogMessage(e.Value.Split('\t')[1]);406 SlaveClientCom.Instance.LogMessage(e.Value.Split('\t')[1]); 410 407 } 411 408 catch { } … … 417 414 /// </summary> 418 415 private void DoAbortAll() { 419 clientCom.LogMessage("Aborting all jobs.");416 SlaveClientCom.Instance.LogMessage("Aborting all jobs."); 420 417 foreach (Guid taskId in taskManager.TaskIds) { 421 418 AbortTaskAsync(taskId); … … 427 424 /// </summary> 428 425 private void DoPauseAll() { 429 clientCom.LogMessage("Pausing all jobs.");426 SlaveClientCom.Instance.LogMessage("Pausing all jobs."); 430 427 foreach (Guid taskId in taskManager.TaskIds) { 431 428 PauseTaskAsync(taskId); … … 437 434 /// </summary> 438 435 private void DoStopAll() { 439 clientCom.LogMessage("Stopping all jobs.");436 SlaveClientCom.Instance.LogMessage("Stopping all jobs."); 440 437 foreach (Guid taskId in taskManager.TaskIds) { 441 438 StopTaskAsync(taskId); … … 457 454 /// </summary> 458 455 private void ShutdownCore() { 459 clientCom.LogMessage("Shutdown signal received");460 clientCom.LogMessage("Stopping heartbeat");456 SlaveClientCom.Instance.LogMessage("Shutdown signal received"); 457 SlaveClientCom.Instance.LogMessage("Stopping heartbeat"); 461 458 heartbeatManager.StopHeartBeat(); 462 459 abortRequested = true; … … 464 461 DoAbortAll(); 465 462 466 clientCom.LogMessage("Logging out");463 SlaveClientCom.Instance.LogMessage("Logging out"); 467 464 WcfService.Instance.Disconnect(); 468 clientCom.Shutdown();465 SlaveClientCom.Instance.ClientCom.Shutdown(); 469 466 SlaveClientCom.Close(); 470 467 … … 478 475 /// </summary> 479 476 private void DoStartSlave() { 480 clientCom.LogMessage("Restart received");477 SlaveClientCom.Instance.LogMessage("Restart received"); 481 478 configManager.Asleep = false; 482 479 } … … 487 484 /// </summary> 488 485 private void Sleep() { 489 clientCom.LogMessage("Sleep received - not accepting any new jobs");486 SlaveClientCom.Instance.LogMessage("Sleep received - not accepting any new jobs"); 490 487 configManager.Asleep = true; 491 488 DoPauseAll(); -
branches/RegressionBenchmarks/HeuristicLab.Clients.Hive.Slave/3.3/DummyListener.cs
r6983 r7255 26 26 namespace HeuristicLab.Clients.Hive.SlaveCore { 27 27 28 [CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant )]28 [CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant, UseSynchronizationContext = false)] 29 29 internal class DummyListener : ISlaveCommunicationCallbacks { 30 30 -
branches/RegressionBenchmarks/HeuristicLab.Clients.Hive.Slave/3.3/Executor.cs
r6983 r7255 91 91 catch (Exception e) { 92 92 this.CurrentException = e; 93 taskDataInvalid = true; 93 94 Task_TaskFailed(this, new EventArgs<Exception>(e)); 94 } 95 finally { 95 } finally { 96 96 taskStartedSem.Set(); 97 97 } … … 188 188 if (taskDataInvalid) return null; 189 189 190 if (task .ExecutionState == ExecutionState.Started) {190 if (task != null && task.ExecutionState == ExecutionState.Started) { 191 191 throw new InvalidStateException("Task is still running"); 192 192 } else { -
branches/RegressionBenchmarks/HeuristicLab.Clients.Hive.Slave/3.3/Manager/ConfigManager.cs
r6983 r7255 125 125 } 126 126 catch (Exception ex) { 127 SlaveClientCom.Instance. ClientCom.LogMessage(string.Format("Exception was thrown while trying to get execution times: {0}", ex.Message));127 SlaveClientCom.Instance.LogMessage(string.Format("Exception was thrown while trying to get execution times: {0}", ex.Message)); 128 128 } 129 129 return prog; -
branches/RegressionBenchmarks/HeuristicLab.Clients.Hive.Slave/3.3/Manager/HeartbeatManager.cs
r6983 r7255 82 82 private void RunHeartBeatThread() { 83 83 while (!threadStopped) { 84 SlaveClientCom.Instance.ClientCom.StatusChanged(ConfigManager.Instance.GetStatusForClientConsole()); 84 try { 85 SlaveClientCom.Instance.StatusChanged(ConfigManager.Instance.GetStatusForClientConsole()); 86 } 87 catch (Exception ex) { 88 EventLogManager.LogMessage("Couldn't sent status information to client ui. Exception is: " + Environment.NewLine + ex.ToString()); 89 } 85 90 86 91 try { … … 104 109 }; 105 110 106 SlaveClientCom.Instance. ClientCom.LogMessage("Send HB: " + heartBeatData);111 SlaveClientCom.Instance.LogMessage("Send HB: " + heartBeatData); 107 112 List<MessageContainer> msgs = wcfService.SendHeartbeat(heartBeatData); 108 113 109 114 if (msgs == null) { 110 SlaveClientCom.Instance. ClientCom.LogMessage("Error getting response from HB");115 SlaveClientCom.Instance.LogMessage("Error getting response from HB"); 111 116 OnExceptionOccured(new Exception("Error getting response from HB")); 112 117 } else { 113 SlaveClientCom.Instance. ClientCom.LogMessage("HB Response received (" + msgs.Count + "): ");114 msgs.ForEach(mc => SlaveClientCom.Instance. ClientCom.LogMessage(mc.Message.ToString()));118 SlaveClientCom.Instance.LogMessage("HB Response received (" + msgs.Count + "): "); 119 msgs.ForEach(mc => SlaveClientCom.Instance.LogMessage(mc.Message.ToString())); 115 120 msgs.ForEach(mc => MessageQueue.GetInstance().AddMessage(mc)); 116 121 } … … 119 124 } 120 125 catch (Exception e) { 121 SlaveClientCom.Instance. ClientCom.LogMessage("Heartbeat thread failed: " + e.ToString());126 SlaveClientCom.Instance.LogMessage("Heartbeat thread failed: " + e.ToString()); 122 127 OnExceptionOccured(e); 123 128 } … … 125 130 } 126 131 waitHandle.Close(); 127 SlaveClientCom.Instance. ClientCom.LogMessage("Heartbeat thread stopped");132 SlaveClientCom.Instance.LogMessage("Heartbeat thread stopped"); 128 133 } 129 134 -
branches/RegressionBenchmarks/HeuristicLab.Clients.Hive.Slave/3.3/SlaveClientCom.cs
r6983 r7255 23 23 using HeuristicLab.Clients.Hive.SlaveCore.Properties; 24 24 using HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts; 25 using System; 25 26 26 27 namespace HeuristicLab.Clients.Hive.SlaveCore { … … 44 45 } 45 46 return instance; 47 } 48 } 49 50 public void LogMessage(string message) { 51 try { 52 ClientCom.LogMessage(message); 53 } 54 catch (Exception ex) { 55 EventLogManager.LogMessage("Exception on LogMessage: " + ex.ToString() + Environment.NewLine + "Orginal message was: " + message); 56 } 57 } 58 59 public void StatusChanged(StatusCommons status) { 60 try { 61 ClientCom.StatusChanged(status); 62 } 63 catch (Exception ex) { 64 EventLogManager.LogMessage("Exception on StatusChanged: " + ex.ToString()); 46 65 } 47 66 } -
branches/RegressionBenchmarks/HeuristicLab.Clients.Hive.Slave/3.3/SlaveCommunicationService.cs
r6983 r7255 26 26 27 27 namespace HeuristicLab.Clients.Hive.SlaveCore { 28 [ServiceBehavior(UseSynchronizationContext = false)] 28 29 public class SlaveCommunicationService : ISlaveCommunication { 29 30 private static List<ISlaveCommunicationCallbacks> subscribers = new List<ISlaveCommunicationCallbacks>(); -
branches/RegressionBenchmarks/HeuristicLab.Clients.Hive.Slave/3.3/WcfService.cs
r6983 r7255 42 42 if (instance == null) { 43 43 instance = new WcfService(); 44 ServiceLocator.Instance.Username = HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings.Default.SlaveUser;45 ServiceLocator.Instance.Password = HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings.Default.SlavePwd;44 HiveServiceLocator.Instance.Username = HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings.Default.SlaveUser; 45 HiveServiceLocator.Instance.Password = HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings.Default.SlavePwd; 46 46 } 47 47 return instance; … … 161 161 public void CallHiveService(Action<IHiveService> call) { 162 162 try { 163 ServiceLocator.Instance.CallHiveService(call);163 HiveServiceLocator.Instance.CallHiveService(call); 164 164 } 165 165 catch (Exception ex) { … … 170 170 private T CallHiveService<T>(Func<IHiveService, T> call) { 171 171 try { 172 return ServiceLocator.Instance.CallHiveService(call);172 return HiveServiceLocator.Instance.CallHiveService(call); 173 173 } 174 174 catch (Exception ex) {
Note: See TracChangeset
for help on using the changeset viewer.