Changeset 393
- Timestamp:
- 07/22/08 23:29:18 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Core/Agent.cs
r389 r393 65 65 public ICollection<IAgent> SubAgents { 66 66 get { 67 List<IAgent> runs = new List<IAgent>(); 68 // TASK 69 return runs; 67 List<IAgent> agents = new List<IAgent>(); 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; 72 newAgent.Name = entry.Name; 73 newAgent.Status = entry.Status; 74 agents.Add(newAgent); 75 } 76 return agents; 70 77 } 71 78 } … … 74 81 get { 75 82 List<IResult> results = new List<IResult>(); 76 // TASK 83 foreach(ResultEntry entry in Database.GetResults(Id)) { 84 Result result = (Result)DbPersistenceManager.Restore(entry.RawData); 85 } 77 86 return results; 78 87 } … … 92 101 #endregion 93 102 103 public override IView CreateView() { 104 return new AgentView(this); 105 } 94 106 } 95 107 } -
trunk/sources/HeuristicLab.CEDMA.Core/AgentListView.cs
r390 r393 64 64 node.Text = agent.Name; 65 65 node.Tag = agent; 66 node.Nodes.Add("dummy"); 66 67 agentTreeView.Nodes.Add(node); 67 68 } … … 77 78 78 79 private void agentTreeView_BeforeExpand(object sender, TreeViewCancelEventArgs e) { 80 e.Node.Nodes.Clear(); 81 IAgent agent = (IAgent)e.Node.Tag; 82 foreach(IAgent subAgent in agent.SubAgents) { 83 TreeNode node = new TreeNode(); 84 node.Text = subAgent.Name; 85 node.Tag = subAgent; 86 node.Nodes.Add("dummy"); 87 e.Node.Nodes.Add(node); 88 } 89 foreach(IResult result in agent.Results) { 90 TreeNode node = new TreeNode(); 91 node.Text = result.Summary; 92 node.Tag = result; 93 node.Nodes.Add("dummy"); 94 e.Node.Nodes.Add(node); 95 } 79 96 } 80 97 … … 85 102 detailsGroupBox.Enabled = false; 86 103 if(agentTreeView.SelectedNode != null) { 87 I Agent agent = (IAgent)agentTreeView.SelectedNode.Tag;88 Control control = (Control) new AgentView(agent);104 IViewable viewable = (IViewable)agentTreeView.SelectedNode.Tag; 105 Control control = (Control)viewable.CreateView(); 89 106 detailsGroupBox.Controls.Add(control); 90 107 control.Dock = DockStyle.Fill; -
trunk/sources/HeuristicLab.CEDMA.Core/ConsoleEditor.cs
r389 r393 38 38 private Label projectLabel; 39 39 private Button newButton; 40 private Timer refreshTimer; 41 private System.ComponentModel.IContainer components; 40 42 private Console console; 41 43 … … 46 48 47 49 private void InitializeComponent() { 50 this.components = new System.ComponentModel.Container(); 48 51 this.uriTextBox = new System.Windows.Forms.TextBox(); 49 52 this.uriLabel = new System.Windows.Forms.Label(); … … 54 57 this.projectLabel = new System.Windows.Forms.Label(); 55 58 this.newButton = new System.Windows.Forms.Button(); 59 this.refreshTimer = new System.Windows.Forms.Timer(this.components); 56 60 this.tabControl.SuspendLayout(); 57 61 this.SuspendLayout(); … … 135 139 this.newButton.UseVisualStyleBackColor = true; 136 140 // 141 // refreshTimer 142 // 143 this.refreshTimer.Interval = 3000; 144 this.refreshTimer.Tick += new System.EventHandler(this.refreshTimer_Tick); 145 // 137 146 // ConsoleEditor 138 147 // … … 161 170 agentsPage.Controls.Add((Control)console.AgentList.CreateView()); 162 171 agentsPage.Controls[0].Dock = DockStyle.Fill; 172 refreshTimer.Enabled = true; 163 173 } catch(CommunicationException ex) { 164 174 // TASK create helper class for error reporting … … 166 176 } 167 177 } 178 179 private void refreshTimer_Tick(object sender, EventArgs e) { 180 refreshTimer.Stop(); 181 UpdateControls(); 182 refreshTimer.Enabled = true; 183 } 168 184 } 169 185 } -
trunk/sources/HeuristicLab.CEDMA.Core/ConsoleEditor.resx
r357 r393 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <metadata name="refreshTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 121 <value>17, 17</value> 122 </metadata> 120 123 </root> -
trunk/sources/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj
r389 r393 62 62 <SubType>UserControl</SubType> 63 63 </Compile> 64 <Compile Include="Result.cs" /> 64 65 <Compile Include="IResult.cs" /> 65 66 <Compile Include="DbPersistenceManager.cs" /> -
trunk/sources/HeuristicLab.CEDMA.Core/IAgent.cs
r389 r393 28 28 29 29 namespace HeuristicLab.CEDMA.Core { 30 public interface IAgent : IDatabaseItem {30 public interface IAgent : IDatabaseItem, IViewable { 31 31 string Name { get; } 32 32 ProcessStatus Status { get; } … … 35 35 ICollection<IResult> Results { get; } 36 36 bool Terminated { get; } 37 37 void Save(); 38 38 void Start(); 39 39 } -
trunk/sources/HeuristicLab.CEDMA.Core/IDatabaseItem.cs
r377 r393 31 31 IDatabase Database { get; set; } 32 32 long Id { get; set; } 33 void Save();34 33 } 35 34 } -
trunk/sources/HeuristicLab.CEDMA.Core/IResult.cs
r389 r393 28 28 29 29 namespace HeuristicLab.CEDMA.Core { 30 public interface IResult : IDatabaseItem {30 public interface IResult : IDatabaseItem, IViewable { 31 31 string Summary { get; } 32 32 string Description { get; } -
trunk/sources/HeuristicLab.CEDMA.DB/Database.cs
r392 r393 298 298 statusParameter.Value = status.ToString(); 299 299 c.Parameters.Add(statusParameter); 300 301 300 SQLiteDataReader r = c.ExecuteReader(); 302 301 while(r.Read()) { … … 330 329 agent.Id = r.GetInt32(0); 331 330 agent.ParentAgentId = r.IsDBNull(1) ? null : new Nullable<long>(r.GetInt32(1)); 332 agent.Name = r. GetString(2);331 agent.Name = r.IsDBNull(2)?"-":r.GetString(2); 333 332 agent.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(3)); 334 333 agent.ControllerAgent = r.GetBoolean(4); … … 353 352 using(DbCommand c = cnn.CreateCommand()) { 354 353 c.CommandText = "Select id, name, status, controllerAgent, rawdata from Agent where ParentAgentId=@ParentAgentId"; 354 DbParameter parentParameter = c.CreateParameter(); 355 parentParameter.ParameterName = "@ParentAgentId"; 356 parentParameter.Value = parentAgentId; 357 c.Parameters.Add(parentParameter); 358 355 359 using(DbDataReader r = c.ExecuteReader()) { 356 360 while(r.Read()) { … … 358 362 agent.ParentAgentId = parentAgentId; 359 363 agent.Id = r.GetInt32(0); 360 agent.Name = r. GetString(1);364 agent.Name = r.IsDBNull(1)?"-":r.GetString(1); 361 365 agent.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(2)); 362 366 agent.ControllerAgent = r.GetBoolean(3); -
trunk/sources/HeuristicLab.CEDMA.Operators/OnGridProcessor.cs
r390 r393 40 40 AddVariableInfo(new VariableInfo("AgentId", "Id of the agent that the run should be associated to.", typeof(IntData), VariableKind.In)); 41 41 AddVariableInfo(new VariableInfo("OperatorGraph", "The operator graph that should be executed on the grid", typeof(IOperatorGraph), VariableKind.In)); 42 AddVariableInfo(new VariableInfo(" ServerUrl", "Urlof the CEDMA server", typeof(StringData), VariableKind.In));42 AddVariableInfo(new VariableInfo("CedmaServerUri", "Uri of the CEDMA server", typeof(StringData), VariableKind.In)); 43 43 } 44 44 … … 46 46 47 47 IOperatorGraph operatorGraph = scope.GetVariableValue<IOperatorGraph>("OperatorGraph", false); 48 string serverUrl = scope.GetVariableValue<StringData>(" ServerUrl", true).Data;48 string serverUrl = scope.GetVariableValue<StringData>("CedmaServerUri", true).Data; 49 49 long agentId = scope.GetVariableValue<IntData>("AgentId", true).Data; 50 51 Agent agent = new Agent(); 52 foreach(IOperator op in operatorGraph.Operators) { 53 agent.OperatorGraph.AddOperator(op); 54 } 55 agent.OperatorGraph.InitialOperator = operatorGraph.InitialOperator; 50 56 51 57 NetTcpBinding binding = new NetTcpBinding(); … … 56 62 using(ChannelFactory<IDatabase> factory = new ChannelFactory<IDatabase>(binding)) { 57 63 IDatabase database = factory.CreateChannel(new EndpointAddress(serverUrl)); 58 long id = database.InsertAgent(agentId, null, false, DbPersistenceManager.Save( operatorGraph));64 long id = database.InsertAgent(agentId, null, false, DbPersistenceManager.Save(agent)); 59 65 database.UpdateAgent(id, ProcessStatus.Waiting); 60 66 } -
trunk/sources/HeuristicLab.CEDMA.Server/AgentScheduler.cs
r390 r393 29 29 using System.Threading; 30 30 using HeuristicLab.CEDMA.Core; 31 using HeuristicLab.Data; 31 32 32 33 namespace HeuristicLab.CEDMA.Server { … … 35 36 private List<IEngine> engines; 36 37 private Dictionary<IEngine, AgentEntry> agent; 38 private string serverUri; 37 39 38 public AgentScheduler(Database database ) {40 public AgentScheduler(Database database, string serverUri) { 39 41 this.database = database; 42 this.serverUri = serverUri; 40 43 engines = new List<IEngine>(); 41 44 agent = new Dictionary<IEngine, AgentEntry>(); … … 74 77 engine.Reset(); 75 78 79 // initialize CEDMA variables for the execution of the agent 80 engine.GlobalScope.AddVariable(new Variable("AgentId", new IntData((int)a.Id))); 81 engine.GlobalScope.AddVariable(new Variable("CedmaServerUri", new StringData(serverUri))); 82 76 83 agent[engine] = a; 77 84 engines.Add(engine); -
trunk/sources/HeuristicLab.CEDMA.Server/HeuristicLab.CEDMA.Server.csproj
r377 r393 89 89 <Name>HeuristicLab.Core</Name> 90 90 </ProjectReference> 91 <ProjectReference Include="..\HeuristicLab.Data\HeuristicLab.Data.csproj"> 92 <Project>{F473D9AF-3F09-4296-9F28-3C65118DAFFA}</Project> 93 <Name>HeuristicLab.Data</Name> 94 </ProjectReference> 91 95 <ProjectReference Include="..\HeuristicLab.Grid\HeuristicLab.Grid.csproj"> 92 96 <Project>{545CE756-98D8-423B-AC2E-6E7D70926E5C}</Project> -
trunk/sources/HeuristicLab.CEDMA.Server/RunScheduler.cs
r392 r393 31 31 using HeuristicLab.Grid; 32 32 using System.Diagnostics; 33 using HeuristicLab.Data; 33 34 34 35 namespace HeuristicLab.CEDMA.Server { … … 39 40 public AtomicOperation Operation; 40 41 } 42 private string serverUri; 41 43 private Database database; 42 44 private JobManager jobManager; … … 47 49 private AutoResetEvent runningJobs = new AutoResetEvent(false); 48 50 49 public RunScheduler(Database database, JobManager jobManager ) {51 public RunScheduler(Database database, JobManager jobManager, string serverUri) { 50 52 this.database = database; 51 53 this.jobManager = jobManager; 54 this.serverUri = serverUri; 52 55 jobQueue = new Queue<Job>(); 53 56 Thread resultsGatheringThread = new Thread(GatherResults); … … 66 69 } 67 70 foreach(AgentEntry entry in agents) { 68 IOperatorGraph opGraph = (IOperatorGraph)DbPersistenceManager.Restore(entry.RawData); 69 AtomicOperation op = new AtomicOperation(opGraph.InitialOperator, new Scope()); 71 Agent agent = (Agent)DbPersistenceManager.Restore(entry.RawData); 72 IOperatorGraph opGraph = agent.OperatorGraph; 73 Scope scope = new Scope(); 74 // initialize CEDMA variables for the execution of the agent 75 scope.AddVariable(new Variable("AgentId", new IntData((int)entry.Id))); 76 scope.AddVariable(new Variable("CedmaServerUri", new StringData(serverUri))); 77 AtomicOperation op = new AtomicOperation(opGraph.InitialOperator, scope); 70 78 WaitHandle wHandle; 71 79 lock(remoteCommLock) { -
trunk/sources/HeuristicLab.CEDMA.Server/ServerForm.cs
r380 r393 55 55 56 56 private void InitAgentScheduler() { 57 AgentScheduler scheduler = new AgentScheduler(database );57 AgentScheduler scheduler = new AgentScheduler(database, addressTextBox.Text); 58 58 Thread agentSchedulerThread = new Thread(scheduler.Run); 59 59 agentSchedulerThread.Start(); … … 63 63 JobManager jobManager = new JobManager(gridAddress.Text); 64 64 jobManager.Reset(); 65 RunScheduler scheduler = new RunScheduler(database, jobManager );65 RunScheduler scheduler = new RunScheduler(database, jobManager, addressTextBox.Text); 66 66 Thread runSchedulerThread = new Thread(scheduler.Run); 67 67 runSchedulerThread.Start();
Note: See TracChangeset
for help on using the changeset viewer.