Changeset 816 for trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine
- Timestamp:
- 11/25/08 23:24:36 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/Executor.cs
r793 r816 29 29 using System.IO; 30 30 using HeuristicLab.Hive.Contracts; 31 using HeuristicLab.Core; 31 32 32 33 namespace HeuristicLab.Hive.Client.ExecutionEngine { … … 56 57 } 57 58 58 public StringGetSnapshot() {59 public byte[] GetSnapshot() { 59 60 //if the job is still running, something went VERY bad. 60 61 if (Job.Running) { … … 64 65 CurrentMessage = MessageContainer.MessageType.NoMessage; 65 66 // Pack the whole job inside an xml document 66 Stringjob = SerializeJobObject();67 byte[] job = SerializeJobObject(); 67 68 // Restart the job 68 69 Job.Start(); … … 72 73 } 73 74 74 public StringGetFinishedJob() {75 public byte[] GetFinishedJob() { 75 76 //Job isn't finished! 76 77 if (Job.Running) { … … 87 88 } 88 89 89 private String SerializeJobObject() { 90 XmlSerializer serializer = new XmlSerializer(typeof(TestJob)); 91 MemoryStream ms = new MemoryStream(); 92 serializer.Serialize(ms, Job); 93 StreamReader reader = new StreamReader(ms); 94 return reader.ReadToEnd(); 90 private byte[] SerializeJobObject() { 91 return PersistenceManager.SaveToGZip(Job); 95 92 } 96 93 97 private void RestoreJobObject(String serializedJob) { 98 System.Text.ASCIIEncoding encoding=new System.Text.ASCIIEncoding(); 99 XmlSerializer serializer = new XmlSerializer(typeof(TestJob)); 100 MemoryStream ms = new MemoryStream(); 101 ms.Write(encoding.GetBytes(serializedJob), 0, serializedJob.Length); 102 Job = (TestJob) serializer.Deserialize(ms); 94 private void RestoreJobObject(byte[] sjob) { 95 Job = (IJob)PersistenceManager.RestoreFromGZip(sjob); 103 96 } 104 97 105 98 public Executor() { 106 99 CurrentMessage = MessageContainer.MessageType.NoMessage; 100 Job = new TestJob(); 107 101 } 108 102 } -
trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/HeuristicLab.Hive.Client.ExecutionEngine.csproj
r793 r816 57 57 </ItemGroup> 58 58 <ItemGroup> 59 <ProjectReference Include="..\HeuristicLab.Core\HeuristicLab.Core.csproj"> 60 <Project>{F43B59AB-2B8C-4570-BC1E-15592086517C}</Project> 61 <Name>HeuristicLab.Core</Name> 62 </ProjectReference> 59 63 <ProjectReference Include="..\HeuristicLab.Hive.Client.Common\HeuristicLab.Hive.Client.Common.csproj"> 60 64 <Project>{89F4BC52-C174-481E-9BD2-3814171020E8}</Project>
Note: See TracChangeset
for help on using the changeset viewer.