Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5451


Ignore:
Timestamp:
02/07/11 16:49:22 (14 years ago)
Author:
ascheibe
Message:

#1233

  • added Sleep cmd
  • adapted gui for new cmds
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.SlaveTrayIcon/MainWindow.cs

    r5320 r5451  
    4949      } else {
    5050        if (Content != null) {
    51           Content.HardPauseCore();
     51          Content.StopAll();
    5252        }
    5353      }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.4/SlaveItem.cs

    r5450 r5451  
    9292    }
    9393
    94     public void SoftPauseCore() {
     94    public void PauseAll() {
    9595      try {
    9696        if (pipeFactory.State != CommunicationState.Faulted && pipeFactory.State != CommunicationState.Closed)
    97           pipeProxy.StopAll();
     97          pipeProxy.PauseAll();
    9898      }
    9999      catch (Exception e) {
     
    102102    }
    103103
    104     public void HardPauseCore() {
     104    public void StopAll() {
    105105      try {
    106106        if (pipeFactory.State != CommunicationState.Faulted && pipeFactory.State != CommunicationState.Closed)
    107           pipeProxy.PauseAll();
     107          pipeProxy.StopAll();
    108108      }
    109109      catch (Exception e) {
     
    122122    }
    123123
     124    public void Sleep() {
     125      try {
     126        if (pipeFactory.State != CommunicationState.Faulted && pipeFactory.State != CommunicationState.Closed)
     127          pipeProxy.Sleep();
     128      }
     129      catch (Exception e) {
     130        OnMessageLogged("Error sending core to sleep: " + e.ToString());
     131      }
     132    }
     133
    124134    public void Close() {
    125135      if (pipeFactory.State != CommunicationState.Closed) {
     
    130140
    131141    public event EventHandler<EventArgs<StatusCommons>> SlaveStatusChanged;
    132     public void OnStatusChanged(StatusCommons status) {     
     142    public void OnStatusChanged(StatusCommons status) {
    133143      var handler = SlaveStatusChanged;
    134144      if (handler != null) handler(this, new EventArgs<StatusCommons>(status));
     
    136146
    137147    public event EventHandler<EventArgs<string>> SlaveMessageLogged;
    138     public void OnMessageLogged(string message) {     
     148    public void OnMessageLogged(string message) {
    139149      var handler = SlaveMessageLogged;
    140150      if (handler != null) handler(this, new EventArgs<string>(message));
     
    142152
    143153    public event EventHandler SlaveShutdown;
    144     public void OnShutdown() {     
     154    public void OnShutdown() {
    145155      var handler = SlaveShutdown;
    146156      if (handler != null) handler(this, EventArgs.Empty);
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.4/SlaveView.Designer.cs

    r5363 r5451  
    4747      this.label1 = new System.Windows.Forms.Label();
    4848      this.txtLog = new System.Windows.Forms.TextBox();
    49       this.btnSoftPause = new System.Windows.Forms.Button();
    50       this.btnHardPause = new System.Windows.Forms.Button();
     49      this.btnPauseAll = new System.Windows.Forms.Button();
     50      this.btnStopAll = new System.Windows.Forms.Button();
    5151      this.btnRestart = new System.Windows.Forms.Button();
     52      this.btnSleep = new System.Windows.Forms.Button();
    5253      this.SuspendLayout();
    5354      //
     
    7273      this.txtLog.TabIndex = 1;
    7374      //
    74       // btnSoftPause
     75      // btnPauseAll
    7576      //
    76       this.btnSoftPause.Location = new System.Drawing.Point(390, 46);
    77       this.btnSoftPause.Name = "btnSoftPause";
    78       this.btnSoftPause.Size = new System.Drawing.Size(111, 23);
    79       this.btnSoftPause.TabIndex = 2;
    80       this.btnSoftPause.Text = "Soft Pause Core";
    81       this.btnSoftPause.UseVisualStyleBackColor = true;
    82       this.btnSoftPause.Click += new System.EventHandler(this.btnSoftPause_Click);
     77      this.btnPauseAll.Location = new System.Drawing.Point(390, 24);
     78      this.btnPauseAll.Name = "btnPauseAll";
     79      this.btnPauseAll.Size = new System.Drawing.Size(111, 23);
     80      this.btnPauseAll.TabIndex = 2;
     81      this.btnPauseAll.Text = "Pause all jobs";
     82      this.btnPauseAll.UseVisualStyleBackColor = true;
     83      this.btnPauseAll.Click += new System.EventHandler(this.btnSoftPause_Click);
    8384      //
    84       // btnHardPause
     85      // btnStopAll
    8586      //
    86       this.btnHardPause.Location = new System.Drawing.Point(390, 87);
    87       this.btnHardPause.Name = "btnHardPause";
    88       this.btnHardPause.Size = new System.Drawing.Size(111, 23);
    89       this.btnHardPause.TabIndex = 3;
    90       this.btnHardPause.Text = "Hard Pause Core";
    91       this.btnHardPause.UseVisualStyleBackColor = true;
    92       this.btnHardPause.Click += new System.EventHandler(this.btnHardPause_Click);
     87      this.btnStopAll.Location = new System.Drawing.Point(390, 53);
     88      this.btnStopAll.Name = "btnStopAll";
     89      this.btnStopAll.Size = new System.Drawing.Size(111, 23);
     90      this.btnStopAll.TabIndex = 3;
     91      this.btnStopAll.Text = "Stop all jobs";
     92      this.btnStopAll.UseVisualStyleBackColor = true;
     93      this.btnStopAll.Click += new System.EventHandler(this.btnHardPause_Click);
    9394      //
    9495      // btnRestart
    9596      //
    96       this.btnRestart.Location = new System.Drawing.Point(390, 127);
     97      this.btnRestart.Location = new System.Drawing.Point(390, 111);
    9798      this.btnRestart.Name = "btnRestart";
    9899      this.btnRestart.Size = new System.Drawing.Size(111, 23);
     
    102103      this.btnRestart.Click += new System.EventHandler(this.btnRestart_Click);
    103104      //
     105      // btnSleep
     106      //
     107      this.btnSleep.Location = new System.Drawing.Point(390, 82);
     108      this.btnSleep.Name = "btnSleep";
     109      this.btnSleep.Size = new System.Drawing.Size(111, 23);
     110      this.btnSleep.TabIndex = 5;
     111      this.btnSleep.Text = "Send slave to sleep";
     112      this.btnSleep.UseVisualStyleBackColor = true;
     113      this.btnSleep.Click += new System.EventHandler(this.btnSleep_Click);
     114      //
    104115      // SlaveView
    105116      //
    106117      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    107118      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     119      this.Controls.Add(this.btnSleep);
    108120      this.Controls.Add(this.btnRestart);
    109       this.Controls.Add(this.btnHardPause);
    110       this.Controls.Add(this.btnSoftPause);
     121      this.Controls.Add(this.btnStopAll);
     122      this.Controls.Add(this.btnPauseAll);
    111123      this.Controls.Add(this.txtLog);
    112124      this.Controls.Add(this.label1);
     
    122134    private System.Windows.Forms.Label label1;
    123135    private System.Windows.Forms.TextBox txtLog;
    124     private System.Windows.Forms.Button btnSoftPause;
    125     private System.Windows.Forms.Button btnHardPause;
     136    private System.Windows.Forms.Button btnPauseAll;
     137    private System.Windows.Forms.Button btnStopAll;
    126138    private System.Windows.Forms.Button btnRestart;
     139    private System.Windows.Forms.Button btnSleep;
    127140  }
    128141}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.4/SlaveView.cs

    r5320 r5451  
    9696    private void btnSoftPause_Click(object sender, System.EventArgs e) {
    9797      if (Content != null)
    98         Content.SoftPauseCore();
     98        Content.PauseAll();
    9999    }
    100100
    101101    private void btnHardPause_Click(object sender, System.EventArgs e) {
    102102      if (Content != null)
    103         Content.HardPauseCore();
     103        Content.StopAll();
    104104    }
    105105
     
    108108        Content.RestartCore();
    109109    }
     110
     111    private void btnSleep_Click(object sender, System.EventArgs e) {
     112      if (Content != null)
     113        Content.Sleep();
     114    }
    110115  }
    111116}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs

    r5450 r5451  
    140140      } else if (container is MessageContainer) {
    141141        switch (container.Message) {
    142           //Pull a Job from the Server
    143142          case MessageContainer.MessageType.CalculateJob:
    144143            Job myJob = wcfService.GetJob(container.JobId);
     
    147146            StartJobInAppDomain(myJob, jobData);
    148147            break;
    149 
    150148          case MessageContainer.MessageType.ShutdownSlave:
    151149            ShutdownCore();
     
    171169          case MessageContainer.MessageType.Restart:
    172170            DoStartSlave();
     171            break;
     172          case MessageContainer.MessageType.Sleep:
     173            Sleep();
    173174            break;
    174175        }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/HeartbeatManager.cs

    r5404 r5451  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.Diagnostics;
    2524using System.Threading;
    2625using HeuristicLab.Common;
     
    9493                FreeCores = info.Cores.HasValue ? info.Cores.Value - ConfigManager.Instance.GetUsedCores() : 0,
    9594                FreeMemory = ConfigManager.GetFreeMemory(),
    96                 JobProgress = ConfigManager.Instance.GetExecutionTimeOfAllJobs()
     95                JobProgress = ConfigManager.Instance.GetExecutionTimeOfAllJobs(),
     96                AssignJob = true //TODO: check if we want another job
    9797              };
    9898
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/PluginCache.cs

    r5327 r5451  
    125125        CopyFile(baseDir, targetDir, "HeuristicLab.Services.Hive.Common-3.4.dll");
    126126        CopyFile(baseDir, targetDir, "HeuristicLab.Hive-3.4.dll");
     127        CopyFile(baseDir, targetDir, "HeuristicLab.Clients.Common-3.3.dll");
    127128
    128129        //TODO: remove, just needed for unit tests
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ServiceContracts/ISlaveCommunication.cs

    r5450 r5451  
    3838
    3939    [OperationContract]
     40    void Sleep();
     41
     42    [OperationContract]
    4043    void PauseAll();
    4144
     
    4851    [OperationContract]
    4952    void ShutdownSlave();
    50 
    5153
    5254    //callbacks
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/SlaveCommunicationService.cs

    r5450 r5451  
    107107      MessageQueue.GetInstance().AddMessage(mc);
    108108    }
     109
     110    public void Sleep() {
     111      MessageContainer mc = new MessageContainer(MessageContainer.MessageType.Sleep);
     112      MessageQueue.GetInstance().AddMessage(mc);
     113    }
    109114  }
    110115}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/MessageContainer.cs

    r5450 r5451  
    4242      PauseJob,  // pause the job and submit the results   
    4343      PauseAll,  // pause all jobs and submit results
    44       Restart,        //restart operation after Soft/HardPause
     44      Restart,   // restart operation after Sleep
     45      Sleep,     // disconnect from server, but don't shutdown
    4546      ShutdownSlave,  // slave should shutdown immediately without submitting results
    4647      SayHello,  // Slave should say hello, because he is unknown to the server
Note: See TracChangeset for help on using the changeset viewer.