Changeset 419
- Timestamp:
- 08/01/08 17:59:19 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Core/OperatorLink.cs
r418 r419 11 11 public long Id { 12 12 get { return id; } 13 } 13 } 14 14 15 15 private IOperator myOperator; … … 21 21 public OperatorLink() : base() { } // for cloning and persistence 22 22 23 public OperatorLink(long id, IOperator op): base() { 23 public OperatorLink(long id, IOperator op) 24 : base() { 24 25 this.id = id; 25 26 this.myOperator = op; … … 30 31 throw new NotSupportedException(); 31 32 } 32 33 //public override void AddConstraint(IConstraint constraint) {34 // throw new NotSupportedException();35 //}36 37 //public override void AddVariable(IVariable variable) {38 // throw new NotSupportedException();39 //}40 41 //public override void AddVariableInfo(IVariableInfo variableInfo) {42 // throw new NotSupportedException();43 //}44 33 45 34 public override IOperation Apply(IScope scope) { … … 74 63 base.Populate(node, restoredObjects); 75 64 } 76 77 //public override void RemoveConstraint(IConstraint constraint) {78 // throw new NotSupportedException();79 //}80 81 //public override void RemoveVariable(string name) {82 // throw new NotSupportedException();83 //}84 85 //public override void RemoveVariableInfo(string formalName) {86 // throw new NotSupportedException();87 //}88 65 } 89 66 } -
trunk/sources/HeuristicLab.CEDMA.DB/Database.cs
r417 r419 55 55 } 56 56 using(DbCommand cmd = cnn.CreateCommand()) { 57 cmd.CommandText = "CREATE TABLE Agent (ID integer primary key autoincrement, ProjectId integer, ParentAgentId integer, Name text, Status text default " +ProcessStatus.Unknown+", CreationTime DateTime, RawData Blob)";57 cmd.CommandText = "CREATE TABLE Agent (ID integer primary key autoincrement, ProjectId integer, ParentAgentId integer, Name text, Status text default " + ProcessStatus.Unknown + ", CreationTime DateTime, RawData Blob)"; 58 58 cmd.Transaction = t; 59 59 cmd.ExecuteNonQuery(); … … 365 365 agent.Status = status; 366 366 agent.Id = r.GetInt32(0); 367 agent.Name = r.IsDBNull(1) ?"":r.GetString(1);367 agent.Name = r.IsDBNull(1) ? "" : r.GetString(1); 368 368 agent.RawData = (byte[])r.GetValue(2); 369 369 agents.Add(agent); … … 389 389 agent.ParentAgentId = null; 390 390 agent.Id = r.GetInt32(0); 391 agent.Name = r.IsDBNull(1) ?"-":r.GetString(1);391 agent.Name = r.IsDBNull(1) ? "-" : r.GetString(1); 392 392 agent.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(2)); 393 393 agent.RawData = (byte[])r.GetValue(3); … … 421 421 agent.ParentAgentId = parentAgentId; 422 422 agent.Id = r.GetInt32(0); 423 agent.Name = r.IsDBNull(1) ?"-":r.GetString(1);423 agent.Name = r.IsDBNull(1) ? "-" : r.GetString(1); 424 424 agent.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(2)); 425 425 agent.RawData = (byte[])r.GetValue(3); … … 523 523 return operators; 524 524 } 525 public OperatorEntry GetOperator(long id) { 526 rwLock.EnterReadLock(); 527 try { 528 using(DbConnection cnn = new SQLiteConnection(connectionString)) { 529 cnn.Open(); 530 using(DbCommand c = cnn.CreateCommand()) { 531 c.CommandText = "Select id, name, rawdata from Operator where id=@Id"; 532 DbParameter idParam = c.CreateParameter(); 533 idParam.ParameterName = "@Id"; 534 idParam.Value = id; 535 c.Parameters.Add(idParam); 536 using(DbDataReader r = c.ExecuteReader()) { 537 r.Read(); 538 OperatorEntry op = new OperatorEntry(); 539 op.Id = r.GetInt32(0); 540 op.Name = r.IsDBNull(1) ? "-" : r.GetString(1); 541 op.RawData = (byte[])r.GetValue(2); 542 return op; 543 } 544 } 545 } 546 } finally { 547 rwLock.ExitReadLock(); 548 } 549 } 525 550 #endregion 526 551 -
trunk/sources/HeuristicLab.CEDMA.Server/HeuristicLab.CEDMA.Server.csproj
r403 r419 71 71 </ItemGroup> 72 72 <ItemGroup> 73 <ProjectReference Include="..\HeuristicLab.CEDMA.Core\HeuristicLab.CEDMA.Core.csproj"> 74 <Project>{C27DDF6C-84DF-45EF-B82F-57A28DD51166}</Project> 75 <Name>HeuristicLab.CEDMA.Core</Name> 76 </ProjectReference> 73 77 <ProjectReference Include="..\HeuristicLab.CEDMA.DB.Interfaces\HeuristicLab.CEDMA.DB.Interfaces.csproj"> 74 78 <Project>{4F9BB789-D561-436B-B226-2BF44B7D0804}</Project> … … 90 94 <Project>{545CE756-98D8-423B-AC2E-6E7D70926E5C}</Project> 91 95 <Name>HeuristicLab.Grid</Name> 96 </ProjectReference> 97 <ProjectReference Include="..\HeuristicLab.Operators\HeuristicLab.Operators.csproj"> 98 <Project>{A9983BA2-B3B2-475E-8E2C-62050B71D1C5}</Project> 99 <Name>HeuristicLab.Operators</Name> 92 100 </ProjectReference> 93 101 <ProjectReference Include="..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj"> -
trunk/sources/HeuristicLab.CEDMA.Server/RunScheduler.cs
r403 r419 31 31 using System.Diagnostics; 32 32 using HeuristicLab.Data; 33 using HeuristicLab.CEDMA.Core; 34 using HeuristicLab.Operators; 33 35 34 36 namespace HeuristicLab.CEDMA.Server { … … 73 75 scope.AddVariable(new Variable("CedmaServerUri", new StringData(serverUri))); 74 76 IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(entry.RawData); 75 AtomicOperation op = new AtomicOperation(opGraph.InitialOperator, scope); 77 78 foreach(IOperator op in opGraph.Operators) { 79 PatchLinks(op); 80 } 81 82 AtomicOperation operation = new AtomicOperation(opGraph.InitialOperator, scope); 76 83 WaitHandle wHandle; 77 84 lock(remoteCommLock) { 78 wHandle = jobManager.BeginExecuteOperation(op .Scope, op);85 wHandle = jobManager.BeginExecuteOperation(operation.Scope, operation); 79 86 database.UpdateAgent(entry.Id, ProcessStatus.Active); 80 87 } … … 82 89 Job job = new Job(); 83 90 job.AgentId = entry.Id; 84 job.Operation = op ;91 job.Operation = operation; 85 92 job.WaitHandle = wHandle; 86 93 … … 90 97 } 91 98 } 99 } 100 101 private void PatchLinks(IOperator op) { 102 if(op is OperatorLink) { 103 OperatorLink link = op as OperatorLink; 104 OperatorEntry targetEntry = database.GetOperator(link.Id); 105 IOperator target = (IOperator)PersistenceManager.RestoreFromGZip(targetEntry.RawData); 106 ReplaceOperatorInGraph(link, target); 107 } else if(op is CombinedOperator) { 108 CombinedOperator combinedOp = op as CombinedOperator; 109 foreach(IOperator internalOp in combinedOp.OperatorGraph.Operators) { 110 PatchLinks(internalOp); 111 } 112 } 113 } 114 115 private void ReplaceOperatorInGraph(OperatorLink link, IOperator target) { 116 throw new NotImplementedException(); 92 117 } 93 118
Note: See TracChangeset
for help on using the changeset viewer.