Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/25/08 23:24:36 (16 years ago)
Author:
kgrading
Message:

implemented the persistance management (#390)

Location:
trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/Executor.cs

    r793 r816  
    2929using System.IO;
    3030using HeuristicLab.Hive.Contracts;
     31using HeuristicLab.Core;
    3132
    3233namespace HeuristicLab.Hive.Client.ExecutionEngine {
     
    5657    }
    5758
    58     public String GetSnapshot() {
     59    public byte[] GetSnapshot() {
    5960      //if the job is still running, something went VERY bad.
    6061      if (Job.Running) {
     
    6465        CurrentMessage = MessageContainer.MessageType.NoMessage;
    6566        // Pack the whole job inside an xml document
    66         String job = SerializeJobObject();       
     67        byte[] job = SerializeJobObject();       
    6768        // Restart the job
    6869        Job.Start();
     
    7273    }
    7374
    74     public String GetFinishedJob() {
     75    public byte[] GetFinishedJob() {
    7576      //Job isn't finished!
    7677      if (Job.Running) {
     
    8788    }
    8889
    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);
    9592    }
    9693
    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);
    10396    }
    10497
    10598    public Executor() {
    10699      CurrentMessage = MessageContainer.MessageType.NoMessage;
     100      Job = new TestJob();
    107101    }   
    108102  }
  • trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/HeuristicLab.Hive.Client.ExecutionEngine.csproj

    r793 r816  
    5757  </ItemGroup>
    5858  <ItemGroup>
     59    <ProjectReference Include="..\HeuristicLab.Core\HeuristicLab.Core.csproj">
     60      <Project>{F43B59AB-2B8C-4570-BC1E-15592086517C}</Project>
     61      <Name>HeuristicLab.Core</Name>
     62    </ProjectReference>
    5963    <ProjectReference Include="..\HeuristicLab.Hive.Client.Common\HeuristicLab.Hive.Client.Common.csproj">
    6064      <Project>{89F4BC52-C174-481E-9BD2-3814171020E8}</Project>
Note: See TracChangeset for help on using the changeset viewer.