Changeset 4810 for branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.ExecutionEngine/3.3/Executor.cs
- Timestamp:
- 11/16/10 14:31:52 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.ExecutionEngine/3.3/Executor.cs
r4772 r4810 28 28 using HeuristicLab.Hive.JobBase; 29 29 using HeuristicLab.Hive.Slave.Common; 30 using HeuristicLab.Persistence.Core; 30 31 31 32 namespace HeuristicLab.Hive.Slave.ExecutionEngine { … … 49 50 public ExecutionState ExecutionState { 50 51 get { 51 return Job .ExecutionState;52 return Job != null ? Job.ExecutionState : Core.ExecutionState.Stopped; 52 53 } 53 54 } … … 55 56 public TimeSpan ExecutionTime { 56 57 get { 57 return Job .ExecutionTime;58 return Job != null ? Job.ExecutionTime : new TimeSpan(0, 0, 0); 58 59 } 59 60 } … … 84 85 } 85 86 } 86 catch ( OutOfMemoryException e) {87 catch (Exception e) { 87 88 this.currentException = e; 88 89 Queue.AddMessage(new MessageContainer(MessageContainer.MessageType.JobFailed, JobId)); … … 94 95 Job.Start(); 95 96 } 96 catch ( OutOfMemoryException e) {97 catch (Exception e) { 97 98 this.currentException = e; 98 99 Queue.AddMessage(new MessageContainer(MessageContainer.MessageType.JobFailed, JobId)); … … 133 134 CoresNeeded = 1, 134 135 MemoryNeeded = 0, 135 PluginsNeeded = HivePluginInfoDto.FindPluginsNeeded(e.Value .GetType()),136 PluginsNeeded = HivePluginInfoDto.FindPluginsNeeded(e.Value), 136 137 }, 137 138 SerializedJobData = jobByteArray … … 164 165 HeuristicLab.Common.EventArgs<Exception> ex = (HeuristicLab.Common.EventArgs<Exception>)e; 165 166 currentException = ex.Value; 166 Queue.AddMessage(new MessageContainer(MessageContainer.MessageType. FinishedJob, JobId));167 Queue.AddMessage(new MessageContainer(MessageContainer.MessageType.JobFailed, JobId)); 167 168 } 168 169 … … 193 194 194 195 public byte[] GetFinishedJob() { 195 //Job isn't finished! 196 if (Job == null) 197 return new byte[0]; 198 196 199 if (Job.ExecutionState == Core.ExecutionState.Started) { 197 throw new InvalidStateException("Job is still running"); 198 } else { 199 byte[] jobArr = SerializedJob.Serialize(Job); 200 return jobArr; 200 throw new InvalidStateException("Job is still running"); //Job isn't finished! 201 } else { 202 return SerializedJob.Serialize(Job); 201 203 } 202 204 } … … 208 210 209 211 private void RestoreJobObject(byte[] sjob) { 210 Job = SerializedJob.Deserialize<IJob>(sjob); 212 try { 213 Job = SerializedJob.Deserialize<IJob>(sjob); 214 } 215 catch { 216 Job = null; 217 } 211 218 } 212 219 … … 216 223 217 224 public void Dispose() { 218 DeregisterJobEvents(); 225 if(Job != null) 226 DeregisterJobEvents(); 219 227 Queue = null; 220 228 Job = null;
Note: See TracChangeset
for help on using the changeset viewer.