Changeset 2064
- Timestamp:
- 06/18/09 17:43:23 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Server/3.3/GridExecuter.cs
r2058 r2064 71 71 if (algorithm != null) { 72 72 AtomicOperation op = new AtomicOperation(algorithm.Engine.OperatorGraph.InitialOperator, algorithm.Engine.GlobalScope); 73 AsyncGridResult asyncResult = jobManager.BeginExecuteEngine(new ProcessingEngine(algorithm.Engine.GlobalScope, op)); 73 ProcessingEngine procEngine = new ProcessingEngine(algorithm.Engine.GlobalScope, op); 74 procEngine.OperatorGraph.AddOperator(algorithm.Engine.OperatorGraph.InitialOperator); 75 procEngine.OperatorGraph.InitialOperator = algorithm.Engine.OperatorGraph.InitialOperator; 76 AsyncGridResult asyncResult = jobManager.BeginExecuteEngine(procEngine); 74 77 asyncResults.Add(asyncResult.WaitHandle, asyncResult); 75 78 lock (activeAlgorithms) { -
trunk/sources/HeuristicLab.Grid.HiveBridge/3.2/HeuristicLab.Grid.HiveBridge-3.2.csproj
r2059 r2064 69 69 <Compile Include="HiveGridServerWrapper.cs" /> 70 70 <Compile Include="HeuristicLabGridHiveBridgePlugin.cs" /> 71 <Compile Include="Properties\AssemblyInfo.cs" /> 71 72 <Compile Include="ServiceLocator.cs" /> 72 73 </ItemGroup> … … 87 88 <Project>{134F93D7-E7C8-4ECD-9923-7F63259A60D8}</Project> 88 89 <Name>HeuristicLab.Hive.Contracts-3.2</Name> 90 </ProjectReference> 91 <ProjectReference Include="..\..\HeuristicLab.Hive.Engine\3.2\HeuristicLab.Hive.Engine-3.2.csproj"> 92 <Project>{C8FEDAC1-0326-4293-B585-F0FEDDEDFC11}</Project> 93 <Name>HeuristicLab.Hive.Engine-3.2</Name> 89 94 </ProjectReference> 90 95 <ProjectReference Include="..\..\HeuristicLab.Hive.JobBase\3.2\HeuristicLab.Hive.JobBase-3.2.csproj"> -
trunk/sources/HeuristicLab.Grid.HiveBridge/3.2/HeuristicLabGridHiveBridgePlugin.cs
r2058 r2064 32 32 [Dependency(Dependency = "HeuristicLab.Hive.Contracts-3.2")] 33 33 [Dependency(Dependency = "HeuristicLab.Hive.JobBase-3.2")] 34 [Dependency(Dependency = "HeuristicLab.Hive.Engine-3.2")] 34 35 public class HeuristicLabGridPlugin : PluginBase { 35 36 } -
trunk/sources/HeuristicLab.Grid.HiveBridge/3.2/HiveGridServerWrapper.cs
r2058 r2064 65 65 ResponseObject<JobResult> response = executionEngineFacade.GetLastResult(guid, false); 66 66 if (response.Success && response.Obj != null) { 67 Job restoredJob = (Job)PersistenceManager.RestoreFromGZip(response.Obj.Result); 68 return restoredJob.SerializedJob; 67 HeuristicLab.Hive.Engine.Job restoredJob = (HeuristicLab.Hive.Engine.Job)PersistenceManager.RestoreFromGZip(response.Obj.Result); 68 // Serialize the engine 69 MemoryStream memStream = new MemoryStream(); 70 GZipStream stream = new GZipStream(memStream, CompressionMode.Compress, true); 71 XmlDocument document = PersistenceManager.CreateXmlDocument(); 72 Dictionary<Guid, IStorable> dictionary = new Dictionary<Guid, IStorable>(); 73 XmlNode rootNode = document.CreateElement("Root"); 74 document.AppendChild(rootNode); 75 rootNode.AppendChild(PersistenceManager.Persist(restoredJob.Engine, document, dictionary)); 76 document.Save(stream); 77 stream.Close(); 78 return memStream.ToArray(); 69 79 } else return null; 70 80 } … … 73 83 HeuristicLab.Hive.Contracts.BusinessObjects.Job jobObj = new HeuristicLab.Hive.Contracts.BusinessObjects.Job(); 74 84 85 List<HivePluginInfo> requiredPlugins = new List<HivePluginInfo>(); 86 IEngine engine = RestoreEngine(serializedEngine, requiredPlugins); 87 88 HeuristicLab.Hive.Engine.Job job = new HeuristicLab.Hive.Engine.Job(); 89 job.Engine.OperatorGraph.AddOperator(engine.OperatorGraph.InitialOperator); 90 job.Engine.OperatorGraph.InitialOperator = engine.OperatorGraph.InitialOperator; 91 92 // Serialize the job 93 MemoryStream memStream = new MemoryStream(); 94 GZipStream stream = new GZipStream(memStream, CompressionMode.Compress, true); 95 XmlDocument document = PersistenceManager.CreateXmlDocument(); 96 Dictionary<Guid, IStorable> dictionary = new Dictionary<Guid, IStorable>(); 97 XmlNode rootNode = document.CreateElement("Root"); 98 document.AppendChild(rootNode); 99 rootNode.AppendChild(PersistenceManager.Persist(job, document, dictionary)); 100 document.Save(stream); 101 stream.Close(); 102 103 jobObj.SerializedJob = memStream.ToArray(); 104 jobObj.CoresNeeded = 1; 105 jobObj.PluginsNeeded = requiredPlugins; 106 jobObj.State = HeuristicLab.Hive.Contracts.BusinessObjects.State.offline; 107 return jobObj; 108 } 109 110 private IEngine RestoreEngine(byte[] serializedEngine, List<HivePluginInfo> requiredPlugins) { 75 111 // unzip and restore to determine the list of required plugins (NB: inefficient!) 76 MemoryStream memStream = new MemoryStream( );112 MemoryStream memStream = new MemoryStream(serializedEngine); 77 113 GZipStream stream = new GZipStream(memStream, CompressionMode.Decompress, true); 78 114 XmlDocument document = new XmlDocument(); … … 80 116 81 117 Dictionary<Guid, IStorable> dictionary = new Dictionary<Guid, IStorable>(); 82 XmlNode rootNode = document.ChildNodes[ 0].ChildNodes[0];83 PersistenceManager.Restore(rootNode, dictionary);118 XmlNode rootNode = document.ChildNodes[1].ChildNodes[0]; 119 IEngine engine = (IEngine)PersistenceManager.Restore(rootNode, dictionary); 84 120 stream.Close(); 85 121 … … 97 133 } 98 134 99 List<HivePluginInfo> pluginsNeeded =100 new List<HivePluginInfo>();101 135 foreach (PluginInfo uniquePlugin in plugins) { 102 136 HivePluginInfo pluginInfo = … … 105 139 pluginInfo.Version = uniquePlugin.Version.ToString(); 106 140 pluginInfo.BuildDate = uniquePlugin.BuildDate; 107 pluginsNeeded.Add(pluginInfo);141 requiredPlugins.Add(pluginInfo); 108 142 } 109 110 jobObj.SerializedJob = serializedEngine; 111 jobObj.CoresNeeded = 1; 112 jobObj.PluginsNeeded = pluginsNeeded; 113 jobObj.State = HeuristicLab.Hive.Contracts.BusinessObjects.State.offline; 114 return jobObj; 143 return engine; 115 144 } 116 145 }
Note: See TracChangeset
for help on using the changeset viewer.