Changeset 2088 for trunk/sources
- Timestamp:
- 06/24/09 17:27:17 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.CEDMA.Server/3.3
- Files:
-
- 6 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherBase.cs
r2047 r2088 41 41 private IStore store; 42 42 private DataSet dataset; 43 43 44 public IEnumerable<string> AllowedTargetVariables { 45 get { 46 if (dataset != null) { 47 return dataset.Problem.AllowedTargetVariables.Select(x => dataset.Problem.Dataset.GetVariableName(x)); 48 } else return new string[0]; 49 } 50 } 51 52 public IEnumerable<string> AllowedInputVariables { 53 get { 54 if (dataset != null) { 55 return dataset.Problem.AllowedInputVariables.Select(x => dataset.Problem.Dataset.GetVariableName(x)); 56 } else return new string[0]; 57 } 58 } 59 44 60 public DispatcherBase(IStore store) { 45 61 this.store = store; … … 91 107 return Enumerable.Range(0, dataset.Rows).Select(x => dataset.GetValue(x, targetVariable)).Distinct(); 92 108 } 109 110 #region IViewable Members 111 112 public IView CreateView() { 113 return new DispatcherView(this); 114 } 115 116 #endregion 93 117 } 94 118 } -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/ExecuterBase.cs
r2080 r2088 129 129 130 130 public abstract string[] GetJobs(); 131 132 133 #region IViewable Members 134 135 public IView CreateView() { 136 return new ExecuterView(this); 137 } 138 139 #endregion 131 140 } 132 141 } -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/HeuristicLab.CEDMA.Server-3.3.csproj
r2058 r2088 91 91 </ItemGroup> 92 92 <ItemGroup> 93 <Compile Include="ExecuterView.cs"> 94 <SubType>UserControl</SubType> 95 </Compile> 96 <Compile Include="ExecuterView.Designer.cs"> 97 <DependentUpon>ExecuterView.cs</DependentUpon> 98 </Compile> 99 <Compile Include="DispatcherView.cs"> 100 <SubType>UserControl</SubType> 101 </Compile> 102 <Compile Include="DispatcherView.Designer.cs"> 103 <DependentUpon>DispatcherView.cs</DependentUpon> 104 </Compile> 93 105 <Compile Include="ExecuterBase.cs" /> 94 106 <Compile Include="IExecuter.cs" /> … … 101 113 <Compile Include="Properties\AssemblyInfo.cs" /> 102 114 <Compile Include="ServerForm.cs"> 103 <SubType> Form</SubType>115 <SubType>UserControl</SubType> 104 116 </Compile> 105 117 <Compile Include="ServerForm.designer.cs"> … … 159 171 </ItemGroup> 160 172 <ItemGroup> 173 <EmbeddedResource Include="DispatcherView.resx"> 174 <DependentUpon>DispatcherView.cs</DependentUpon> 175 </EmbeddedResource> 176 <EmbeddedResource Include="ExecuterView.resx"> 177 <DependentUpon>ExecuterView.cs</DependentUpon> 178 </EmbeddedResource> 161 179 <EmbeddedResource Include="ServerForm.resx"> 162 180 <DependentUpon>ServerForm.cs</DependentUpon> -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/IDispatcher.cs
r1922 r2088 38 38 39 39 namespace HeuristicLab.CEDMA.Server { 40 public interface IDispatcher {40 public interface IDispatcher : IViewable { 41 41 IAlgorithm GetNextJob(); 42 42 } -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/IExecuter.cs
r1898 r2088 37 37 38 38 namespace HeuristicLab.CEDMA.Server { 39 public interface IExecuter {39 public interface IExecuter : IViewable { 40 40 int MaxActiveJobs { get; set; } 41 41 string[] GetJobs(); -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/Server.cs
r2075 r2088 32 32 using HeuristicLab.Grid; 33 33 using HeuristicLab.Grid.HiveBridge; 34 using HeuristicLab.Core; 34 35 35 36 namespace HeuristicLab.CEDMA.Server { 36 public class Server {37 public class Server : IViewable { 37 38 private static readonly string rdfFile = AppDomain.CurrentDomain.BaseDirectory + "rdf_store.db3"; 38 39 private static readonly string rdfConnectionString = "sqlite:rdf:Data Source=\"" + rdfFile + "\""; … … 40 41 private ServiceHost host; 41 42 private Store store; 43 42 44 private IDispatcher dispatcher; 45 public IDispatcher Dispatcher { get { return dispatcher; } } 43 46 private IExecuter executer; 47 public IExecuter Executer { get { return executer; } } 44 48 45 49 private string gridServiceUrl; … … 53 57 get { return cedmaServiceUrl; } 54 58 set { cedmaServiceUrl = value; } 55 }56 57 private int maxActiveJobs;58 public int MaxActiveJobs {59 get { return maxActiveJobs; }60 set {61 if (value > 0) {62 maxActiveJobs = value;63 if (executer != null) {64 executer.MaxActiveJobs = value;65 }66 }67 }68 59 } 69 60 … … 80 71 cedmaServiceUrl = "net.tcp://" + addresses[index] + ":8002/CEDMA"; 81 72 store = new Store(rdfConnectionString); 82 maxActiveJobs = 10;83 73 } 84 74 … … 103 93 } 104 94 105 internal string[] GetActiveJobDescriptions() {106 if (executer != null) return executer.GetJobs();107 else return new string[] { };108 }109 110 95 internal void Connect(string serverUrl) { 111 96 dispatcher = new SimpleDispatcher(store); … … 118 103 } 119 104 executer = new GridExecuter(dispatcher, store, gridServer); 120 executer.MaxActiveJobs = MaxActiveJobs;121 105 executer.Start(); 122 106 } 107 #region IViewable Members 108 109 public IView CreateView() { 110 return new ServerForm(this); 111 } 112 113 #endregion 123 114 } 124 115 } -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/ServerApplication.cs
r1529 r2088 30 30 class ServerApplication : ApplicationBase { 31 31 public override void Run() { 32 Form mainForm = new ServerForm(); 32 Server server = new Server(); 33 server.Start(); 34 Form mainForm = new Form(); 35 UserControl serverControl = (UserControl)server.CreateView(); 36 serverControl.Dock = DockStyle.Fill; 37 mainForm.Controls.Add(serverControl); 33 38 Application.Run(mainForm); 34 39 } -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/ServerForm.cs
r2075 r2088 41 41 42 42 namespace HeuristicLab.CEDMA.Server { 43 public partial class ServerForm : Form{43 public partial class ServerForm : ViewBase { 44 44 private Server server; 45 45 46 47 public ServerForm() {46 public ServerForm(Server server) { 47 this.server = server; 48 48 InitializeComponent(); 49 server = new Server();50 server.Start();51 49 addressTextBox.Text = server.CedmaServiceUrl; 52 }53 54 private void refreshTimer_Tick(object sender, EventArgs e) {55 listBox.DataSource = server.GetActiveJobDescriptions();56 50 } 57 51 58 52 private void connectButton_Click(object sender, EventArgs e) { 59 53 server.Connect(address.Text); 60 maxActiveJobsUpDown.Enabled = true; 61 activeJobsLabel.Enabled = true; 62 maxActiveJobsUpDown.Value = server.MaxActiveJobs; 63 connectButton.Enabled = false; 64 refreshTimer.Start(); 65 } 66 67 private void maxActiveJobsUpDown_ValueChanged(object sender, EventArgs e) { 68 server.MaxActiveJobs = Convert.ToInt32(maxActiveJobsUpDown.Value); 54 UserControl executerControl = (UserControl)server.Executer.CreateView(); 55 executerControl.Dock = DockStyle.Fill; 56 executerTabPage.Controls.Add(executerControl); 57 UserControl dispatcherControl = (UserControl)server.Dispatcher.CreateView(); 58 dispatcherControl.Dock = DockStyle.Fill; 59 dispatcherTabPage.Controls.Add(dispatcherControl); 60 connectButton.Enabled = false; 69 61 } 70 62 } -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/ServerForm.designer.cs
r2075 r2088 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this.components = new System.ComponentModel.Container();48 47 this.addressTextBox = new System.Windows.Forms.TextBox(); 49 48 this.externalAddressLabel = new System.Windows.Forms.Label(); … … 51 50 this.address = new System.Windows.Forms.TextBox(); 52 51 this.connectButton = new System.Windows.Forms.Button(); 53 this.listBox = new System.Windows.Forms.ListBox(); 54 this.refreshTimer = new System.Windows.Forms.Timer(this.components); 55 this.maxActiveJobsUpDown = new System.Windows.Forms.NumericUpDown(); 56 this.activeJobsLabel = new System.Windows.Forms.Label(); 57 ((System.ComponentModel.ISupportInitialize)(this.maxActiveJobsUpDown)).BeginInit(); 52 this.tabControl = new System.Windows.Forms.TabControl(); 53 this.executerTabPage = new System.Windows.Forms.TabPage(); 54 this.dispatcherTabPage = new System.Windows.Forms.TabPage(); 55 this.tabControl.SuspendLayout(); 58 56 this.SuspendLayout(); 59 57 // … … 101 99 this.connectButton.Click += new System.EventHandler(this.connectButton_Click); 102 100 // 103 // listBox101 // tabControl 104 102 // 105 this. listBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)103 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 106 104 | System.Windows.Forms.AnchorStyles.Left) 107 105 | System.Windows.Forms.AnchorStyles.Right))); 108 this.listBox.FormattingEnabled = true; 109 this.listBox.Location = new System.Drawing.Point(12, 84); 110 this.listBox.Name = "listBox"; 111 this.listBox.Size = new System.Drawing.Size(350, 251); 112 this.listBox.TabIndex = 11; 106 this.tabControl.Controls.Add(this.executerTabPage); 107 this.tabControl.Controls.Add(this.dispatcherTabPage); 108 this.tabControl.Location = new System.Drawing.Point(3, 58); 109 this.tabControl.Name = "tabControl"; 110 this.tabControl.SelectedIndex = 0; 111 this.tabControl.Size = new System.Drawing.Size(573, 543); 112 this.tabControl.TabIndex = 14; 113 113 // 114 // refreshTimer114 // executerTabPage 115 115 // 116 this.refreshTimer.Interval = 1000; 117 this.refreshTimer.Tick += new System.EventHandler(this.refreshTimer_Tick); 116 this.executerTabPage.Location = new System.Drawing.Point(4, 22); 117 this.executerTabPage.Name = "executerTabPage"; 118 this.executerTabPage.Padding = new System.Windows.Forms.Padding(3); 119 this.executerTabPage.Size = new System.Drawing.Size(565, 517); 120 this.executerTabPage.TabIndex = 0; 121 this.executerTabPage.Text = "Executer"; 122 this.executerTabPage.UseVisualStyleBackColor = true; 118 123 // 119 // maxActiveJobsUpDown124 // dispatcherTabPage 120 125 // 121 this.maxActiveJobsUpDown.Enabled = false; 122 this.maxActiveJobsUpDown.Location = new System.Drawing.Point(106, 59); 123 this.maxActiveJobsUpDown.Maximum = new decimal(new int[] { 124 64, 125 0, 126 0, 127 0}); 128 this.maxActiveJobsUpDown.Name = "maxActiveJobsUpDown"; 129 this.maxActiveJobsUpDown.Size = new System.Drawing.Size(120, 20); 130 this.maxActiveJobsUpDown.TabIndex = 12; 131 this.maxActiveJobsUpDown.ValueChanged += new System.EventHandler(this.maxActiveJobsUpDown_ValueChanged); 132 // 133 // activeJobsLabel 134 // 135 this.activeJobsLabel.AutoSize = true; 136 this.activeJobsLabel.Enabled = false; 137 this.activeJobsLabel.Location = new System.Drawing.Point(12, 61); 138 this.activeJobsLabel.Name = "activeJobsLabel"; 139 this.activeJobsLabel.Size = new System.Drawing.Size(84, 13); 140 this.activeJobsLabel.TabIndex = 13; 141 this.activeJobsLabel.Text = "&Max active jobs:"; 126 this.dispatcherTabPage.Location = new System.Drawing.Point(4, 22); 127 this.dispatcherTabPage.Name = "dispatcherTabPage"; 128 this.dispatcherTabPage.Padding = new System.Windows.Forms.Padding(3); 129 this.dispatcherTabPage.Size = new System.Drawing.Size(565, 517); 130 this.dispatcherTabPage.TabIndex = 1; 131 this.dispatcherTabPage.Text = "Dispatcher"; 132 this.dispatcherTabPage.UseVisualStyleBackColor = true; 142 133 // 143 134 // ServerForm … … 145 136 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 146 137 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 147 this.ClientSize = new System.Drawing.Size(374, 342); 148 this.Controls.Add(this.activeJobsLabel); 149 this.Controls.Add(this.maxActiveJobsUpDown); 150 this.Controls.Add(this.listBox); 138 this.Controls.Add(this.tabControl); 151 139 this.Controls.Add(this.connectButton); 152 140 this.Controls.Add(this.gridAddressLabel); … … 155 143 this.Controls.Add(this.addressTextBox); 156 144 this.Name = "ServerForm"; 157 this. Text = "CEDMA Server";158 ((System.ComponentModel.ISupportInitialize)(this.maxActiveJobsUpDown)).EndInit();145 this.Size = new System.Drawing.Size(579, 604); 146 this.tabControl.ResumeLayout(false); 159 147 this.ResumeLayout(false); 160 148 this.PerformLayout(); … … 169 157 private System.Windows.Forms.TextBox address; 170 158 private System.Windows.Forms.Button connectButton; 171 private System.Windows.Forms.ListBox listBox; 172 private System.Windows.Forms.Timer refreshTimer; 173 private System.Windows.Forms.NumericUpDown maxActiveJobsUpDown; 174 private System.Windows.Forms.Label activeJobsLabel; 159 private System.Windows.Forms.TabControl tabControl; 160 private System.Windows.Forms.TabPage executerTabPage; 161 private System.Windows.Forms.TabPage dispatcherTabPage; 175 162 } 176 163 } -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/ServerForm.resx
r1529 r2088 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>123 120 </root>
Note: See TracChangeset
for help on using the changeset viewer.