Changeset 6112
- Timestamp:
- 05/03/11 18:08:42 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs
r6110 r6112 100 100 //try to log with clientCom. if this works the user sees at least a message, 101 101 //else an exception will be thrown anyways. 102 clientCom.LogMessage(" Error on startup: " + ex.ToString() +102 clientCom.LogMessage("Uncaught exception: " + ex.ToString() + 103 103 Environment.NewLine + "Core is going to shutdown."); 104 104 } 105 ShutdownCore(); 105 106 } 106 107 finally { … … 177 178 // handle exception of task 178 179 clientCom.LogMessage(t.Exception.ToString()); 180 wcfService.UpdateJobState(container.JobId, JobState.Failed, t.Exception.ToString()); 181 SlaveStatusInfo.JobsAborted++; 179 182 }, TaskContinuationOptions.OnlyOnFaulted); 180 183 break; … … 474 477 catch (Exception exception) { 475 478 clientCom.LogMessage(string.Format("Copying plugins for job {0} failed: {1}", myJob.Id, exception)); 479 wcfService.UpdateJobState(myJob.Id, JobState.Failed, exception.ToString()); 480 SlaveStatusInfo.JobsAborted++; 476 481 lock (executors) { 477 482 if (jobs.ContainsKey(myJob.Id)) { … … 493 498 executor.Core = this; 494 499 clientCom.LogMessage("Starting Executor for job " + myJob.Id); 495 496 500 executor.Start(jobData.Data); 497 501 498 502 lock (executors) { 499 503 executors.Add(myJob.Id, executor); … … 503 507 clientCom.LogMessage("Creating the Appdomain and loading the job failed for job " + myJob.Id); 504 508 clientCom.LogMessage("Error thrown is: " + exception.ToString()); 509 510 if (executors.ContainsKey(myJob.Id) && executors[myJob.Id].CurrentException != string.Empty) { 511 wcfService.UpdateJobState(myJob.Id, JobState.Failed, executors[myJob.Id].CurrentException); 512 } else { 513 wcfService.UpdateJobState(myJob.Id, JobState.Failed, exception.ToString()); 514 } 515 SlaveStatusInfo.JobsAborted++; 516 505 517 KillAppDomain(myJob.Id); 506 518 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs
r6110 r6112 37 37 public Core Core { get; set; } 38 38 private Semaphore pauseStopSem = new Semaphore(0, 1); 39 private Semaphore startJobSem = new Semaphore(0, 1); 39 40 40 41 public bool SendHeartbeatForExecutor { get; set; } … … 86 87 } else { 87 88 Job.Start(); 88 89 startJobSem.WaitOne(); 89 90 } 90 91 } … … 140 141 Job.DeleteChildJobs += new EventHandler(Job_DeleteChildJobs); 141 142 Job.JobPaused += new EventHandler(Job_JobPaused); 143 Job.JobStarted += new EventHandler(Job_JobStarted); 142 144 } 143 145 … … 149 151 Job.DeleteChildJobs -= new EventHandler(Job_DeleteChildJobs); 150 152 Job.JobPaused -= new EventHandler(Job_JobPaused); 153 Job.JobStarted -= new EventHandler(Job_JobStarted); 151 154 } 152 155 … … 237 240 private void Job_JobPaused(object sender, EventArgs e) { 238 241 pauseStopSem.Release(); 242 } 243 244 void Job_JobStarted(object sender, EventArgs e) { 245 startJobSem.Release(); 239 246 } 240 247 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/HeartbeatManager.cs
r5826 r6112 36 36 private WcfService wcfService; 37 37 private bool threadStopped; 38 ReaderWriterLockSlim heartBeatThreadIsSleepingLock = new ReaderWriterLockSlim();39 38 40 39 public HeartbeatManager() { … … 75 74 76 75 private void RunHeartBeatThread() { 77 bool sleepForever;78 76 while (!threadStopped) { 79 sleepForever = false;80 77 SlaveClientCom.Instance.ClientCom.StatusChanged(ConfigManager.Instance.GetStatusForClientConsole()); 81 78 … … 108 105 msgs.ForEach(mc => SlaveClientCom.Instance.ClientCom.LogMessage(mc.Message.ToString())); 109 106 msgs.ForEach(mc => MessageQueue.GetInstance().AddMessage(mc)); 110 //after fetching a job, we sleep until the core wakes us up!!111 msgs.ForEach(s => { if (s.Message == MessageContainer.MessageType.CalculateJob) sleepForever = true; });112 107 } 113 108 } … … 118 113 OnExceptionOccured(e); 119 114 } 120 if (sleepForever) 121 waitHandle.WaitOne(); 122 else 123 waitHandle.WaitOne(this.Interval); 115 waitHandle.WaitOne(this.Interval); 124 116 } 125 117 waitHandle.Close();
Note: See TracChangeset
for help on using the changeset viewer.