Changeset 5137 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs
- Timestamp:
- 12/20/10 19:58:01 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources
- Property svn:ignore
-
old new 1 *.suo 1 2 HeuristicLab.Hive-3.4.suo 2 3 TestResults 3 HeuristicLab.Hive 3.4.suo
-
- Property svn:ignore
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs
r5106 r5137 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Linq; 25 using HeuristicLab.Clients.Hive.Slave; 24 26 using HeuristicLab.Common; 25 27 using HeuristicLab.Core; 26 using HeuristicLab.Services.Hive.Common;27 28 using HeuristicLab.Hive; 29 using HeuristicLab.PluginInfrastructure; 28 30 using HeuristicLab.Services.Hive.Common.DataTransfer; 29 using System.Collections.Generic; 30 using HeuristicLab.Clients.Hive.Slave; 31 using HeuristicLab.PluginInfrastructure; 32 33 31 32 34 33 namespace HeuristicLab.Clients.Hive.Salve { 35 34 public class Executor : MarshalByRefObject, IDisposable { 36 35 public Guid JobId { get; set; } 37 36 public IJob Job { get; set; } 38 p ublic MessageContainer.MessageType CurrentMessage { get; set; }39 public Core core { get; set; } 40 37 private bool wasJobAborted = false; 38 public Core core { get; set; } 39 41 40 private Exception currentException; 42 41 public String CurrentException { … … 49 48 } 50 49 } 51 50 52 51 public ExecutionState ExecutionState { 53 52 get { … … 73 72 RegisterJobEvents(); 74 73 75 if (Job.CollectChildJobs) { 74 if (Job.CollectChildJobs) { 76 75 IEnumerable<JobData> childjobs = WcfService.Instance.GetChildJobs(JobId); 77 76 Job.Resume(childjobs.Select(j => PersistenceUtil.Deserialize<IJob>(j.Data))); … … 82 81 } 83 82 catch (Exception e) { 84 this.currentException = e; 83 this.currentException = e; 85 84 } 86 85 } … … 91 90 } 92 91 catch (Exception e) { 93 this.currentException = e; 92 this.currentException = e; 94 93 } 95 94 } 96 95 97 96 public void Abort() { 98 CurrentMessage = MessageContainer.MessageType.AbortJob;97 wasJobAborted = true; 99 98 if ((ExecutionState == ExecutionState.Started) || (ExecutionState == ExecutionState.Paused)) { 100 99 Job.Stop(); … … 105 104 106 105 private void RegisterJobEvents() { 107 //TODO: warum gibt es jobStopped und jobfailed nicht mehr?108 106 Job.JobStopped += new EventHandler(Job_JobStopped); 109 107 Job.JobFailed += new EventHandler(Job_JobFailed); … … 123 121 private List<Guid> FindPluginsNeeded(IJob obj) { 124 122 List<Guid> guids = new List<Guid>(); 125 foreach (IPluginDescription desc in PluginUtil.GetDeclaringPlugins(obj)) {123 foreach (IPluginDescription desc in PluginUtil.GetDeclaringPlugins(obj)) { 126 124 } 127 125 throw new NotImplementedException("FindPluginsNeeded for Job_NewChildJob"); … … 147 145 // Pause the job and send it back to the hive. The server will awake it when all child-jobs are finished 148 146 this.Job.CollectChildJobs = true; 149 147 150 148 JobData jdata = new JobData(); 151 149 jdata.Data = PersistenceUtil.Serialize(Job); 152 150 jdata.JobId = this.JobId; 153 151 154 152 core.PauseJob(jdata); 155 153 } … … 167 165 168 166 private void Job_JobStopped(object sender, EventArgs e) { 169 if (CurrentMessage == MessageContainer.MessageType.AbortJob) {170 core.KillAppDomain(JobId);167 if (wasJobAborted) { 168 core.KillAppDomain(JobId); 171 169 } else { 172 170 core.SendFinishedJob(JobId); … … 176 174 public JobData GetFinishedJob() { 177 175 if (Job == null) { 178 throw new InvalidStateException("Job is null"); 179 } 176 throw new InvalidStateException("Job is null"); 177 } 180 178 181 179 if (Job.ExecutionState == HeuristicLab.Core.ExecutionState.Started) { … … 185 183 186 184 if (Job.ExecutionState == HeuristicLab.Core.ExecutionState.Started) { 187 throw new InvalidStateException("Job is still running"); 185 throw new InvalidStateException("Job is still running"); 188 186 } else { 189 187 JobData jdata = new JobData(); … … 192 190 return jdata; 193 191 } 194 } 195 192 } 193 196 194 public Executor() { 197 // CurrentMessage = MessageContainer.MessageType.NoMessage; [chn] check usage of 'CurrentMessage'198 195 } 199 196 … … 201 198 if (Job != null) 202 199 DeregisterJobEvents(); 203 //Queue = null;204 200 Job = null; 205 201 }
Note: See TracChangeset
for help on using the changeset viewer.