Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/09/08 21:37:36 (16 years ago)
Author:
gkronber
Message:

worked on #188

Location:
trunk/sources/HeuristicLab.CEDMA.Server
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Server/AgentScheduler.cs

    r372 r375  
    5959        engines.Remove(e);
    6060        AgentEntry entry = agent[e];
    61         entry.Status = AgentStatus.Finished;
    62         database.Update(entry);
     61        entry.Status = ProcessStatus.Finished;
     62        database.UpdateAgent(entry.Id, entry.Status);
    6363      }
    6464    }
    6565    private void CreateNewEngines() {
    66       ICollection<AgentEntry> agents = database.GetAgentEntries(AgentStatus.Waiting);
     66      ICollection<AgentEntry> agents = database.GetAgents(ProcessStatus.Waiting);
    6767      foreach(AgentEntry a in agents) {
    6868        SequentialEngine.SequentialEngine engine = new HeuristicLab.SequentialEngine.SequentialEngine();
     
    7575        agent[engine] = a;
    7676        engines.Add(engine);
    77         a.Status = AgentStatus.Active;
    78         database.Update(a);
     77        a.Status = ProcessStatus.Active;
     78        database.UpdateAgent(a.Id, a.Status);
    7979      }
    8080    }
     
    8484          engine.ExecuteStep();
    8585        }
    86         Thread.Sleep(100); // prevent over-load
     86        Thread.Sleep(100); // prevent overload
    8787      }
    8888    }
  • trunk/sources/HeuristicLab.CEDMA.Server/HeuristicLab.CEDMA.Server.csproj

    r372 r375  
    6060  <ItemGroup>
    6161    <Compile Include="AgentScheduler.cs" />
     62    <Compile Include="RunScheduler.cs" />
    6263    <Compile Include="DbPersistenceManager.cs" />
    6364    <Compile Include="ServerApplication.cs" />
     
    8788      <Project>{F43B59AB-2B8C-4570-BC1E-15592086517C}</Project>
    8889      <Name>HeuristicLab.Core</Name>
     90    </ProjectReference>
     91    <ProjectReference Include="..\HeuristicLab.Grid\HeuristicLab.Grid.csproj">
     92      <Project>{545CE756-98D8-423B-AC2E-6E7D70926E5C}</Project>
     93      <Name>HeuristicLab.Grid</Name>
    8994    </ProjectReference>
    9095    <ProjectReference Include="..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
  • trunk/sources/HeuristicLab.CEDMA.Server/ServerForm.cs

    r372 r375  
    3636using System.Data.Common;
    3737using System.Threading;
     38using HeuristicLab.Grid;
    3839
    3940namespace HeuristicLab.CEDMA.Server {
     
    4546    public ServerForm() {
    4647      InitializeComponent();
    47       InitDatabase();
    48       InitAgentScheduler();
    49 
    5048      // windows XP returns the external ip on index 0 while windows vista returns the external ip on index 2
    5149      if (System.Environment.OSVersion.Version.Major >= 6) {
     
    5452        addressTextBox.Text = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[0] + ":8002/CEDMA/World";
    5553      }
    56       Start();
    5754    }
    5855
    5956    private void InitAgentScheduler() {
    6057      AgentScheduler scheduler = new AgentScheduler(database);
     58      ThreadPool.QueueUserWorkItem(delegate(object status) { scheduler.Run(); });
     59    }
     60
     61    private void InitRunScheduler() {
     62      JobManager jobManager = new JobManager(gridAddress.Text);
     63      RunScheduler scheduler = new RunScheduler(database, jobManager);
    6164      ThreadPool.QueueUserWorkItem(delegate(object status) { scheduler.Run(); });
    6265    }
     
    7477
    7578    private void Start() {
     79      InitDatabase();
     80      InitAgentScheduler();
     81      InitRunScheduler();
     82
    7683      host = new ServiceHost(database, new Uri(addressTextBox.Text));
    7784      ServiceThrottlingBehavior throttlingBehavior = new ServiceThrottlingBehavior();
     
    95102    private void statusUpdateTimer_Tick(object sender, EventArgs e) {
    96103    }
     104
     105    private void startButton_Click(object sender, EventArgs e) {
     106      Start();
     107      startButton.Enabled = false;
     108    }
    97109  }
    98110}
  • trunk/sources/HeuristicLab.CEDMA.Server/ServerForm.designer.cs

    r352 r375  
    5151      this.activeAgentsTextBox = new System.Windows.Forms.TextBox();
    5252      this.statusUpdateTimer = new System.Windows.Forms.Timer(this.components);
     53      this.gridAddressLabel = new System.Windows.Forms.Label();
     54      this.gridAddress = new System.Windows.Forms.TextBox();
     55      this.startButton = new System.Windows.Forms.Button();
    5356      this.SuspendLayout();
    5457      //
     
    7376      //
    7477      this.activeAgentsLabel.AutoSize = true;
    75       this.activeAgentsLabel.Location = new System.Drawing.Point(12, 35);
     78      this.activeAgentsLabel.Location = new System.Drawing.Point(12, 61);
    7679      this.activeAgentsLabel.Name = "activeAgentsLabel";
    7780      this.activeAgentsLabel.Size = new System.Drawing.Size(75, 13);
     
    8184      // activeAgentsTextBox
    8285      //
    83       this.activeAgentsTextBox.Location = new System.Drawing.Point(106, 32);
     86      this.activeAgentsTextBox.Location = new System.Drawing.Point(106, 58);
    8487      this.activeAgentsTextBox.Name = "activeAgentsTextBox";
    8588      this.activeAgentsTextBox.ReadOnly = true;
     
    9598      this.statusUpdateTimer.Tick += new System.EventHandler(this.statusUpdateTimer_Tick);
    9699      //
     100      // gridAddressLabel
     101      //
     102      this.gridAddressLabel.AutoSize = true;
     103      this.gridAddressLabel.Location = new System.Drawing.Point(12, 35);
     104      this.gridAddressLabel.Name = "gridAddressLabel";
     105      this.gridAddressLabel.Size = new System.Drawing.Size(69, 13);
     106      this.gridAddressLabel.TabIndex = 9;
     107      this.gridAddressLabel.Text = "&Grid address:";
     108      //
     109      // gridAddress
     110      //
     111      this.gridAddress.Location = new System.Drawing.Point(106, 32);
     112      this.gridAddress.Name = "gridAddress";
     113      this.gridAddress.Size = new System.Drawing.Size(229, 20);
     114      this.gridAddress.TabIndex = 8;
     115      //
     116      // startButton
     117      //
     118      this.startButton.Location = new System.Drawing.Point(15, 84);
     119      this.startButton.Name = "startButton";
     120      this.startButton.Size = new System.Drawing.Size(75, 23);
     121      this.startButton.TabIndex = 10;
     122      this.startButton.Text = "Start";
     123      this.startButton.UseVisualStyleBackColor = true;
     124      this.startButton.Click += new System.EventHandler(this.startButton_Click);
     125      //
    97126      // ServerForm
    98127      //
    99128      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    100129      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    101       this.ClientSize = new System.Drawing.Size(347, 62);
     130      this.ClientSize = new System.Drawing.Size(347, 119);
     131      this.Controls.Add(this.startButton);
     132      this.Controls.Add(this.gridAddressLabel);
     133      this.Controls.Add(this.gridAddress);
    102134      this.Controls.Add(this.activeAgentsLabel);
    103135      this.Controls.Add(this.activeAgentsTextBox);
     
    118150    private System.Windows.Forms.TextBox activeAgentsTextBox;
    119151    private System.Windows.Forms.Timer statusUpdateTimer;
     152    private System.Windows.Forms.Label gridAddressLabel;
     153    private System.Windows.Forms.TextBox gridAddress;
     154    private System.Windows.Forms.Button startButton;
    120155  }
    121156}
Note: See TracChangeset for help on using the changeset viewer.