Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/22/09 15:10:03 (15 years ago)
Author:
gkronber
Message:

Snapshot results should be ignored in the HiveGridServerWrapper. Using Canceled property of the engine to discriminate between snapshots and final results. #642 (Hive backend for CEDMA)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Grid.HiveBridge/3.2/HiveGridServerWrapper.cs

    r2073 r2078  
    7070        response.Success && response.Obj != null) {
    7171        HeuristicLab.Hive.Engine.Job restoredJob = (HeuristicLab.Hive.Engine.Job)PersistenceManager.RestoreFromGZip(response.Obj.Result);
    72         // Serialize the engine
    73         MemoryStream memStream = new MemoryStream();
    74         GZipStream stream = new GZipStream(memStream, CompressionMode.Compress, true);
    75         XmlDocument document = PersistenceManager.CreateXmlDocument();
    76         Dictionary<Guid, IStorable> dictionary = new Dictionary<Guid, IStorable>();
    77         XmlNode rootNode = document.CreateElement("Root");
    78         document.AppendChild(rootNode);
    79         rootNode.AppendChild(PersistenceManager.Persist(restoredJob.Engine, document, dictionary));
    80         document.Save(stream);
    81         stream.Close();
    82         return memStream.ToArray();
    83       } else return null;
     72        // only return the engine when it wasn't canceled (result is only a snapshot)
     73        if (!restoredJob.Engine.Canceled) {
     74          // Serialize the engine
     75          MemoryStream memStream = new MemoryStream();
     76          GZipStream stream = new GZipStream(memStream, CompressionMode.Compress, true);
     77          XmlDocument document = PersistenceManager.CreateXmlDocument();
     78          Dictionary<Guid, IStorable> dictionary = new Dictionary<Guid, IStorable>();
     79          XmlNode rootNode = document.CreateElement("Root");
     80          document.AppendChild(rootNode);
     81          rootNode.AppendChild(PersistenceManager.Persist(restoredJob.Engine, document, dictionary));
     82          document.Save(stream);
     83          stream.Close();
     84          return memStream.ToArray();
     85        }
     86      }
     87
     88      return null;
    8489    }
    8590
Note: See TracChangeset for help on using the changeset viewer.