Changeset 403 for trunk/sources
- Timestamp:
- 07/29/08 18:05:18 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Core/Agent.cs
r394 r403 29 29 30 30 namespace HeuristicLab.CEDMA.Core { 31 public class Agent : I temBase, IAgent {31 public class Agent : IAgent { 32 32 public IDatabase Database { get; set; } 33 33 public long Id { get; set; } … … 55 55 Database.UpdateAgent(Id, Name); 56 56 Database.UpdateAgent(Id, Status); 57 Database.UpdateAgent(Id, DbPersistenceManager.Save(this));57 Database.UpdateAgent(Id, PersistenceManager.SaveToGZip(OperatorGraph)); 58 58 } 59 59 … … 67 67 List<IAgent> agents = new List<IAgent>(); 68 68 foreach(AgentEntry entry in Database.GetSubAgents(Id)) { 69 Agent newAgent = (Agent)DbPersistenceManager.Restore(entry.RawData); 70 newAgent.Database = Database; 71 newAgent.Id = entry.Id; 69 Agent newAgent = new Agent(Database, entry.Id); 72 70 newAgent.Name = entry.Name; 73 71 newAgent.Status = entry.Status; 72 IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(entry.RawData); 73 OperatorGraph.Clear(); 74 foreach(IOperator op in opGraph.Operators) OperatorGraph.AddOperator(op); 75 OperatorGraph.InitialOperator = opGraph.InitialOperator; 74 76 agents.Add(newAgent); 75 77 } … … 82 84 List<IResult> results = new List<IResult>(); 83 85 foreach(ResultEntry entry in Database.GetResults(Id)) { 84 Result result = (Result)DbPersistenceManager.Restore(entry.RawData); 85 result.Database = Database; 86 result.Id = entry.Id; 86 Result result = new Result(Database, entry.Id); 87 87 result.Summary = entry.Summary; 88 88 result.Description = entry.Description; 89 result.Item = (IItem)PersistenceManager.RestoreFromGZip(entry.RawData); 89 90 results.Add(result); 90 91 } … … 93 94 } 94 95 95 #region persistence 96 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 97 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 98 node.AppendChild(PersistenceManager.Persist("OperatorGraph", operatorGraph, document, persistedObjects)); 99 return node; 100 } 101 102 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 103 base.Populate(node, restoredObjects); 104 operatorGraph = (OperatorGraph)PersistenceManager.Restore(node.SelectSingleNode("OperatorGraph"), restoredObjects); 105 } 106 #endregion 107 108 public override IView CreateView() { 96 public IView CreateView() { 109 97 return new AgentView(this); 110 98 } -
trunk/sources/HeuristicLab.CEDMA.Core/AgentList.cs
r398 r403 46 46 agentList.Clear(); 47 47 foreach(AgentEntry a in database.GetAgents()) { 48 Agent newAgent = (Agent)DbPersistenceManager.Restore(a.RawData); 49 newAgent.Database = database; 50 newAgent.Id = a.Id; 48 Agent newAgent = new Agent(Database, a.Id); 51 49 newAgent.Name = a.Name; 52 50 newAgent.Status = a.Status; 51 IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(a.RawData); 52 foreach(IOperator op in opGraph.Operators) newAgent.OperatorGraph.AddOperator(op); 53 newAgent.OperatorGraph.InitialOperator = opGraph.InitialOperator; 53 54 agentList.Add(newAgent); 54 55 } … … 66 67 agent.Status = ProcessStatus.Unknown; 67 68 agent.Database = database; 68 long id = database.InsertAgent(null, agent.Name, DbPersistenceManager.Save(agent));69 long id = database.InsertAgent(null, agent.Name, PersistenceManager.SaveToGZip(agent.OperatorGraph)); 69 70 agent.Id = id; 70 71 agentList.Add(agent); -
trunk/sources/HeuristicLab.CEDMA.Core/AgentView.cs
r390 r403 32 32 namespace HeuristicLab.CEDMA.Core { 33 33 public partial class AgentView : ViewBase { 34 private IAgent agent; 34 35 public IAgent Agent { 35 get { return (IAgent)Item; }36 set { base.Item= value; }36 get { return agent; } 37 set { agent = value; } 37 38 } 38 39 -
trunk/sources/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj
r393 r403 64 64 <Compile Include="Result.cs" /> 65 65 <Compile Include="IResult.cs" /> 66 <Compile Include="DbPersistenceManager.cs" />67 66 <Compile Include="HeuristicLabCedmaCorePlugin.cs" /> 68 67 <Compile Include="IAgent.cs" /> -
trunk/sources/HeuristicLab.CEDMA.Core/HeuristicLabCedmaCorePlugin.cs
r377 r403 30 30 [Dependency(Dependency = "HeuristicLab.Core")] 31 31 [Dependency(Dependency = "HeuristicLab.CEDMA.DB.Interfaces")] 32 [Dependency(Dependency = "HeuristicLab.CEDMA.Server")]33 32 public class HeuristicLabCedmaCorePlugin : PluginBase { 34 33 } -
trunk/sources/HeuristicLab.CEDMA.Core/IDatabaseItem.cs
r393 r403 28 28 29 29 namespace HeuristicLab.CEDMA.Core { 30 public interface IDatabaseItem : IItem{30 public interface IDatabaseItem { 31 31 IDatabase Database { get; set; } 32 32 long Id { get; set; } -
trunk/sources/HeuristicLab.CEDMA.Core/Result.cs
r394 r403 29 29 30 30 namespace HeuristicLab.CEDMA.Core { 31 public class Result : I temBase, IResult {31 public class Result : IResult { 32 32 public IDatabase Database { get; set; } 33 33 public long Id { get; set; } … … 50 50 List<IResult> results = new List<IResult>(); 51 51 foreach(ResultEntry entry in Database.GetSubResults(Id)) { 52 Result result = (Result)DbPersistenceManager.Restore(entry.RawData); 53 result.Database = Database; 54 result.Id = entry.Id; 52 Result result = new Result(Database, entry.Id); 55 53 result.Summary = entry.Summary; 56 54 result.Description = entry.Description; 55 result.Item = (IItem)PersistenceManager.RestoreFromGZip(entry.RawData); 57 56 results.Add(result); 58 57 } … … 61 60 } 62 61 63 #region persistence 64 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 65 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 66 node.AppendChild(PersistenceManager.Persist("Item", Item, document, persistedObjects)); 67 return node; 68 } 69 70 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 71 base.Populate(node, restoredObjects); 72 Item = (IItem)PersistenceManager.Restore(node.SelectSingleNode("Item"), restoredObjects); 73 } 74 #endregion 75 76 public override IView CreateView() { 62 public IView CreateView() { 77 63 return Item.CreateView(); 78 64 } -
trunk/sources/HeuristicLab.CEDMA.Operators/HeuristicLab.CEDMA.Operators.csproj
r394 r403 63 63 </ItemGroup> 64 64 <ItemGroup> 65 <ProjectReference Include="..\HeuristicLab.CEDMA.Core\HeuristicLab.CEDMA.Core.csproj">66 <Project>{C27DDF6C-84DF-45EF-B82F-57A28DD51166}</Project>67 <Name>HeuristicLab.CEDMA.Core</Name>68 </ProjectReference>69 65 <ProjectReference Include="..\HeuristicLab.CEDMA.DB.Interfaces\HeuristicLab.CEDMA.DB.Interfaces.csproj"> 70 66 <Project>{4F9BB789-D561-436B-B226-2BF44B7D0804}</Project> -
trunk/sources/HeuristicLab.CEDMA.Operators/HeuristicLabCedmaOperatorsPlugin.cs
r352 r403 29 29 [PluginFile(Filename = "HeuristicLab.CEDMA.Operators.dll", Filetype = PluginFileType.Assembly)] 30 30 [Dependency(Dependency = "HeuristicLab.CEDMA.DB.Interfaces")] 31 [Dependency(Dependency = "HeuristicLab.Core")] 32 [Dependency(Dependency = "HeuristicLab.Data")] 31 33 public class HeuristicLabCedmaOperatorsPlugin : PluginBase { 32 34 } -
trunk/sources/HeuristicLab.CEDMA.Operators/OnGridProcessor.cs
r398 r403 28 28 using HeuristicLab.CEDMA.DB.Interfaces; 29 29 using System.ServiceModel; 30 using HeuristicLab.CEDMA.Core;31 30 32 31 namespace HeuristicLab.CEDMA.Operators { … … 48 47 long agentId = scope.GetVariableValue<IntData>("AgentId", true).Data; 49 48 50 Agent agent = new Agent();51 foreach(IOperator op in operatorGraph.Operators) {52 agent.OperatorGraph.AddOperator(op);53 }54 agent.OperatorGraph.InitialOperator = operatorGraph.InitialOperator;55 56 49 NetTcpBinding binding = new NetTcpBinding(); 57 50 binding.MaxReceivedMessageSize = 10000000; // 10Mbytes … … 61 54 using(ChannelFactory<IDatabase> factory = new ChannelFactory<IDatabase>(binding)) { 62 55 IDatabase database = factory.CreateChannel(new EndpointAddress(serverUrl)); 63 long id = database.InsertAgent(agentId, null, DbPersistenceManager.Save(agent));56 long id = database.InsertAgent(agentId, null, PersistenceManager.SaveToGZip(operatorGraph)); 64 57 database.UpdateAgent(id, ProcessStatus.Waiting); 65 58 } -
trunk/sources/HeuristicLab.CEDMA.Operators/ScopeResultWriter.cs
r394 r403 28 28 using HeuristicLab.CEDMA.DB.Interfaces; 29 29 using System.ServiceModel; 30 using HeuristicLab.CEDMA.Core;31 30 32 31 namespace HeuristicLab.CEDMA.Operators { … … 45 44 string serverUrl = scope.GetVariableValue<StringData>("CedmaServerUri", true).Data; 46 45 long agentId = scope.GetVariableValue<IntData>("AgentId", true).Data; 47 Result result = new Result();48 result.Item = scope;49 46 50 47 NetTcpBinding binding = new NetTcpBinding(); … … 55 52 using(ChannelFactory<IDatabase> factory = new ChannelFactory<IDatabase>(binding)) { 56 53 IDatabase database = factory.CreateChannel(new EndpointAddress(serverUrl)); 57 database.InsertResult(agentId, scope.Name, "Scope", DbPersistenceManager.Save(result));54 database.InsertResult(agentId, scope.Name, "Scope", PersistenceManager.SaveToGZip(scope)); 58 55 } 59 56 return null; -
trunk/sources/HeuristicLab.CEDMA.Server/HeuristicLab.CEDMA.Server.csproj
r398 r403 60 60 <ItemGroup> 61 61 <Compile Include="RunScheduler.cs" /> 62 <Compile Include="DbPersistenceManager.cs" />63 62 <Compile Include="ServerApplication.cs" /> 64 63 <Compile Include="HeuristicLabCedmaServerPlugin.cs" /> … … 72 71 </ItemGroup> 73 72 <ItemGroup> 74 <ProjectReference Include="..\HeuristicLab.CEDMA.Core\HeuristicLab.CEDMA.Core.csproj">75 <Project>{C27DDF6C-84DF-45EF-B82F-57A28DD51166}</Project>76 <Name>HeuristicLab.CEDMA.Core</Name>77 </ProjectReference>78 73 <ProjectReference Include="..\HeuristicLab.CEDMA.DB.Interfaces\HeuristicLab.CEDMA.DB.Interfaces.csproj"> 79 74 <Project>{4F9BB789-D561-436B-B226-2BF44B7D0804}</Project> … … 100 95 <Name>HeuristicLab.PluginInfrastructure</Name> 101 96 </ProjectReference> 102 <ProjectReference Include="..\HeuristicLab.SequentialEngine\HeuristicLab.SequentialEngine.csproj">103 <Project>{B4BE8E53-BA06-4237-9A01-24255F880201}</Project>104 <Name>HeuristicLab.SequentialEngine</Name>105 </ProjectReference>106 97 </ItemGroup> 107 98 <ItemGroup> -
trunk/sources/HeuristicLab.CEDMA.Server/HeuristicLabCedmaServerPlugin.cs
r352 r403 29 29 [PluginFile(Filename = "HeuristicLab.CEDMA.Server.dll", Filetype = PluginFileType.Assembly)] 30 30 [Dependency(Dependency = "HeuristicLab.CEDMA.DB.Interfaces")] 31 [Dependency(Dependency = "HeuristicLab.CEDMA.DB")] 32 [Dependency(Dependency = "HeuristicLab.Grid")] 33 [Dependency(Dependency = "HeuristicLab.Core")] 34 [Dependency(Dependency = "HeuristicLab.Data")] 31 35 public class HeuristicLabCedmaServerPlugin : PluginBase { 32 36 } -
trunk/sources/HeuristicLab.CEDMA.Server/RunScheduler.cs
r398 r403 28 28 using HeuristicLab.Core; 29 29 using System.Threading; 30 using HeuristicLab.CEDMA.Core;31 30 using HeuristicLab.Grid; 32 31 using System.Diagnostics; … … 69 68 } 70 69 foreach(AgentEntry entry in agents) { 71 Agent agent = (Agent)DbPersistenceManager.Restore(entry.RawData);72 IOperatorGraph opGraph = agent.OperatorGraph;73 70 Scope scope = new Scope(); 74 71 // initialize CEDMA variables for the execution of the agent 75 72 scope.AddVariable(new Variable("AgentId", new IntData((int)entry.Id))); 76 73 scope.AddVariable(new Variable("CedmaServerUri", new StringData(serverUri))); 74 IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(entry.RawData); 77 75 AtomicOperation op = new AtomicOperation(opGraph.InitialOperator, scope); 78 76 WaitHandle wHandle;
Note: See TracChangeset
for help on using the changeset viewer.