Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2088 for trunk/sources


Ignore:
Timestamp:
06/24/09 17:27:17 (15 years ago)
Author:
gkronber
Message:

Added views for the executer and the dispatcher and the server (which contains the executer and dispatcher views). #676 (Cockpit for the CEDMA Server to control algorithm settings)

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  
    4141    private IStore store;
    4242    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
    4460    public DispatcherBase(IStore store) {
    4561      this.store = store;
     
    91107      return Enumerable.Range(0, dataset.Rows).Select(x => dataset.GetValue(x, targetVariable)).Distinct();
    92108    }
     109
     110    #region IViewable Members
     111
     112    public IView CreateView() {
     113      return new DispatcherView(this);
     114    }
     115
     116    #endregion
    93117  }
    94118}
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/ExecuterBase.cs

    r2080 r2088  
    129129
    130130    public abstract string[] GetJobs();
     131
     132
     133    #region IViewable Members
     134
     135    public IView CreateView() {
     136      return new ExecuterView(this);
     137    }
     138
     139    #endregion
    131140  }
    132141}
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/HeuristicLab.CEDMA.Server-3.3.csproj

    r2058 r2088  
    9191  </ItemGroup>
    9292  <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>
    93105    <Compile Include="ExecuterBase.cs" />
    94106    <Compile Include="IExecuter.cs" />
     
    101113    <Compile Include="Properties\AssemblyInfo.cs" />
    102114    <Compile Include="ServerForm.cs">
    103       <SubType>Form</SubType>
     115      <SubType>UserControl</SubType>
    104116    </Compile>
    105117    <Compile Include="ServerForm.designer.cs">
     
    159171  </ItemGroup>
    160172  <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>
    161179    <EmbeddedResource Include="ServerForm.resx">
    162180      <DependentUpon>ServerForm.cs</DependentUpon>
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/IDispatcher.cs

    r1922 r2088  
    3838
    3939namespace HeuristicLab.CEDMA.Server {
    40   public interface IDispatcher {
     40  public interface IDispatcher : IViewable {
    4141    IAlgorithm GetNextJob();
    4242  }
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/IExecuter.cs

    r1898 r2088  
    3737
    3838namespace HeuristicLab.CEDMA.Server {
    39   public interface IExecuter {
     39  public interface IExecuter : IViewable {
    4040    int MaxActiveJobs { get; set; }
    4141    string[] GetJobs();
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/Server.cs

    r2075 r2088  
    3232using HeuristicLab.Grid;
    3333using HeuristicLab.Grid.HiveBridge;
     34using HeuristicLab.Core;
    3435
    3536namespace HeuristicLab.CEDMA.Server {
    36   public class Server {
     37  public class Server : IViewable {
    3738    private static readonly string rdfFile = AppDomain.CurrentDomain.BaseDirectory + "rdf_store.db3";
    3839    private static readonly string rdfConnectionString = "sqlite:rdf:Data Source=\"" + rdfFile + "\"";
     
    4041    private ServiceHost host;
    4142    private Store store;
     43
    4244    private IDispatcher dispatcher;
     45    public IDispatcher Dispatcher { get { return dispatcher; } }
    4346    private IExecuter executer;
     47    public IExecuter Executer { get { return executer; } }
    4448
    4549    private string gridServiceUrl;
     
    5357      get { return cedmaServiceUrl; }
    5458      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       }
    6859    }
    6960
     
    8071      cedmaServiceUrl = "net.tcp://" + addresses[index] + ":8002/CEDMA";
    8172      store = new Store(rdfConnectionString);
    82       maxActiveJobs = 10;
    8373    }
    8474
     
    10393    }
    10494
    105     internal string[] GetActiveJobDescriptions() {
    106       if (executer != null) return executer.GetJobs();
    107       else return new string[] { };
    108     }
    109 
    11095    internal void Connect(string serverUrl) {
    11196      dispatcher = new SimpleDispatcher(store);
     
    118103      }
    119104      executer = new GridExecuter(dispatcher, store, gridServer);
    120       executer.MaxActiveJobs = MaxActiveJobs;
    121105      executer.Start();
    122106    }
     107    #region IViewable Members
     108
     109    public IView CreateView() {
     110      return new ServerForm(this);
     111    }
     112
     113    #endregion
    123114  }
    124115}
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/ServerApplication.cs

    r1529 r2088  
    3030  class ServerApplication : ApplicationBase {
    3131    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);
    3338      Application.Run(mainForm);
    3439    }
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/ServerForm.cs

    r2075 r2088  
    4141
    4242namespace HeuristicLab.CEDMA.Server {
    43   public partial class ServerForm : Form {
     43  public partial class ServerForm : ViewBase {
    4444    private Server server;
    4545
    46 
    47     public ServerForm() {
     46    public ServerForm(Server server) {
     47      this.server = server;
    4848      InitializeComponent();
    49       server = new Server();
    50       server.Start();
    5149      addressTextBox.Text = server.CedmaServiceUrl;
    52     }
    53 
    54     private void refreshTimer_Tick(object sender, EventArgs e) {
    55       listBox.DataSource = server.GetActiveJobDescriptions();
    5650    }
    5751
    5852    private void connectButton_Click(object sender, EventArgs e) {
    5953      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;     
    6961    }
    7062  }
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/ServerForm.designer.cs

    r2075 r2088  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.components = new System.ComponentModel.Container();
    4847      this.addressTextBox = new System.Windows.Forms.TextBox();
    4948      this.externalAddressLabel = new System.Windows.Forms.Label();
     
    5150      this.address = new System.Windows.Forms.TextBox();
    5251      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();
    5856      this.SuspendLayout();
    5957      //
     
    10199      this.connectButton.Click += new System.EventHandler(this.connectButton_Click);
    102100      //
    103       // listBox
     101      // tabControl
    104102      //
    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)
    106104                  | System.Windows.Forms.AnchorStyles.Left)
    107105                  | 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;
    113113      //
    114       // refreshTimer
     114      // executerTabPage
    115115      //
    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;
    118123      //
    119       // maxActiveJobsUpDown
     124      // dispatcherTabPage
    120125      //
    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;
    142133      //
    143134      // ServerForm
     
    145136      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    146137      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);
    151139      this.Controls.Add(this.connectButton);
    152140      this.Controls.Add(this.gridAddressLabel);
     
    155143      this.Controls.Add(this.addressTextBox);
    156144      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);
    159147      this.ResumeLayout(false);
    160148      this.PerformLayout();
     
    169157    private System.Windows.Forms.TextBox address;
    170158    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;
    175162  }
    176163}
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/ServerForm.resx

    r1529 r2088  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </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>
    123120</root>
Note: See TracChangeset for help on using the changeset viewer.