Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6371


Ignore:
Timestamp:
06/06/11 18:33:03 (13 years ago)
Author:
ascheibe
Message:

#1233

  • code cleanups for slave review
  • added switch between privileged and unprivileged sandbox
  • removed childjob management because it's not used
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
1 deleted
34 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.ConsoleClient/Program.cs

    r6101 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2323using System.Threading;
    2424
    25 
    26 
    2725namespace HeuristicLab.Clients.Hive.SlaveCore.ConsoleClient {
    2826  public class Program {
    2927    static void Main(string[] args) {
    30       //mock the hive service for testing purposes
    31       //ServiceLocator.Instance = new MockServiceLocator();
    32 
    3328      //slave part
    3429      Core core = new Core();
     
    4742      listener.Close();
    4843      core.Shutdown();
    49       Console.ReadKey();
     44      Console.ReadLine();
    5045    }
    5146  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.ConsoleClient/SlaveCommListener.cs

    r6359 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2929
    3030  /// <summary>
    31   /// mock a client, simply print out messages
     31  /// Mock a client, simply print out messages
    3232  /// </summary>
    3333  [CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant)]
     
    7575
    7676    public void OnStatusChanged(StatusCommons status) {
    77       string msg = string.Format( "{0}: {1}", DateTime.Now.ToString("HH:mm:ss"), status);
     77      string msg = string.Format("{0}: {1}", DateTime.Now.ToString("HH:mm:ss"), status);
    7878      Console.WriteLine(msg);
    7979      debugOutput.WriteLine(msg);
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.SlaveTrayIcon/MainWindow.Designer.cs

    r6263 r6371  
    189189      this.tabAbout.Location = new System.Drawing.Point(4, 22);
    190190      this.tabAbout.Name = "tabAbout";
    191       this.tabAbout.Size = new System.Drawing.Size(577, 347);
     191      this.tabAbout.Size = new System.Drawing.Size(597, 367);
    192192      this.tabAbout.TabIndex = 2;
    193193      this.tabAbout.Text = "About HeuristicLab Hive";
     
    215215      this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
    216216      this.Name = "MainWindow";
    217       this.Text = "HeuristicLab Hive Slave View";
     217      this.Text = "HeuristicLab Hive Slave";
    218218      this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainWindow_FormClosing);
    219219      this.contextMenuNotifyIcon.ResumeLayout(false);
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.SlaveTrayIcon/Program.cs

    r6257 r6371  
    2525        mw.RestoreFromTray();
    2626      }
    27      
    2827
    2928      mw.Content = new SlaveItem();
    30 
    3129      Application.Run();
    3230    }
     
    3634    /// (based on http://www.codeproject.com/KB/cs/processownersid.aspx)
    3735    /// </summary>   
    38     public static string GetProcessOwner(int pid) {
     36    private static string GetProcessOwner(int pid) {
    3937      string ownerSID = String.Empty;
    4038      string processName = String.Empty;
     
    5957
    6058    /// <summary>
    61     /// kill all other slave tray icons, we only want 1 running at a time
     59    /// Kill all other slave tray icons, we only want 1 running at a time
    6260    /// (and if a newer version is installed the older one should be killed)
    6361    /// </summary>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.4/JobsView.cs

    r6263 r6371  
    5252      base.OnContentChanged();
    5353      if (Content == null) {
    54 
    5554      } else {
    56 
    5755      }
    5856    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.4/LogView.cs

    r6230 r6371  
    6262      base.OnContentChanged();
    6363      if (Content == null) {
    64         // TODO: Put code here when content is null
    6564      } else {
    66         // TODO: Put code here when content has been changed and is not null
    6765      }
    6866    }
     
    7068    protected override void SetEnabledStateOfControls() {
    7169      base.SetEnabledStateOfControls();
    72       // TODO: Put code here to enable or disable controls based on whether the Content is/not null or the view is ReadOnly
    7370    }
    7471
     
    8986    }
    9087    #endregion
    91 
    9288  }
    9389}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.4/SlaveItem.cs

    r6263 r6371  
    2727
    2828namespace HeuristicLab.Clients.Hive.SlaveCore.Views {
    29 
    3029
    3130  public enum SlaveDisplayStat {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.4/SlaveView.cs

    r6263 r6371  
    3939  [Content(typeof(SlaveItem), IsDefaultView = true)]
    4040  public partial class SlaveView : ItemView {
     41    private SlaveDisplayStat lastSlaveDisplayStat;
     42    private const string serviceName = "HeuristicLab.Clients.Hive.SlaveCore.SlaveWindowsService";
    4143
    4244    private const UInt32 BCM_SETSHIELD = 0x160C;
     
    5254      }
    5355    }
    54 
    55     private SlaveDisplayStat lastSlaveDisplayStat;
    5656
    5757    public SlaveView() {
     
    241241
    242242    /// <summary>
    243     /// shows the windows UAC dialog and restarts tray icon app
     243    /// Shows the windows UAC dialog and restarts tray icon app
    244244    /// </summary>
    245245    private void ElevateApplication() {
    246       // Launch itself as administrator
     246      // launch itself as administrator
    247247      ProcessStartInfo proc = new ProcessStartInfo(Application.ExecutablePath, "showui");
    248248      proc.UseShellExecute = true;
     
    262262
    263263    private void StartService() {
    264       string serviceName = "HeuristicLab.Clients.Hive.SlaveCore.SlaveWindowsService";
    265264      TimeSpan timeout = TimeSpan.FromMilliseconds(5000);
    266265
     
    284283
    285284    private void StopService() {
    286       string serviceName = "HeuristicLab.Clients.Hive.SlaveCore.SlaveWindowsService";
    287285      TimeSpan timeout = TimeSpan.FromMilliseconds(7000);
    288286
     
    329327      }
    330328    }
    331 
    332 
    333329  }
    334330}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs

    r6357 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2828using HeuristicLab.Common;
    2929using HeuristicLab.Core;
    30 using HeuristicLab.Hive;
    3130
    3231
     
    3433  /// <summary>
    3534  /// The core component of the Hive Slave.
    36   /// Handles commands sent from the Hive Server.
     35  /// Handles commands sent from the Hive Server and does all webservice calls for jobs.
    3736  /// </summary>
    3837  public class Core : MarshalByRefObject {
     
    4140      get { return heartbeatManager; }
    4241    }
     42
     43    public EventLog ServiceEventLog { get; set; }
    4344
    4445    private Semaphore waitShutdownSem = new Semaphore(0, 1);
     
    5152    private PluginManager pluginManager;
    5253
    53     public EventLog ServiceEventLog { get; set; }
    54 
    5554    public Core() {
    5655      var log = new ThreadSafeLog(new Log());
     
    6665
    6766    /// <summary>
    68     /// Main Method for the client
     67    /// Main method for the client
    6968    /// </summary>
    7069    public void Start() {
     
    7271
    7372      try {
    74         //manager.Core = this;
    75 
    7673        //start the client communication service (pipe between slave and slave gui)
    7774        slaveComm = new ServiceHost(typeof(SlaveCommunicationService));
     
    321318      this.jobManager.ExceptionOccured += new EventHandler<EventArgs<SlaveJob, Exception>>(jobManager_ExceptionOccured);
    322319      this.jobManager.JobAborted += new EventHandler<EventArgs<SlaveJob>>(jobManager_JobAborted);
    323       this.jobManager.NewChildJob += new EventHandler<EventArgs<SlaveJob, IJob>>(jobManager_NewChildJob);
    324       this.jobManager.WaitForChildJobs += new EventHandler<EventArgs<SlaveJob, JobData>>(jobManager_WaitForChildJobs);
    325       this.jobManager.DeleteChildJobs += new EventHandler<EventArgs<SlaveJob>>(jobManager_DeleteChildJobs);
    326320    }
    327321
     
    404398      SlaveStatusInfo.DecrementUsedCores(e.Value.CoresNeeded);
    405399    }
    406 
    407     private void jobManager_NewChildJob(object sender, EventArgs<SlaveJob, IJob> e) {
    408       var job = new Job() { CoresNeeded = 1, MemoryNeeded = 0 };
    409       WcfService.Instance.AddChildJob(e.Value.JobId, job, e.Value2);
    410     }
    411 
    412     private void jobManager_WaitForChildJobs(object sender, EventArgs<SlaveJob, JobData> e) {
    413       try {
    414         SlaveStatusInfo.DecrementUsedCores(e.Value.CoresNeeded);
    415         heartbeatManager.AwakeHeartBeatThread();
    416         Job job = wcfService.GetJob(e.Value.JobId);
    417         if (job == null) throw new JobNotFoundException(e.Value.JobId);
    418         job.ExecutionTime = e.Value.ExecutionTime;
    419         job.IsParentJob = true;
    420         job.FinishWhenChildJobsFinished = false;
    421         JobData jobData = e.Value.GetJobData();
    422         wcfService.UpdateJobData(job, jobData, configManager.GetClientInfo().Id, JobState.Waiting);
    423       }
    424       catch (JobNotFoundException ex) {
    425         clientCom.LogMessage(ex.ToString());
    426       }
    427       catch (Exception ex) {
    428         clientCom.LogMessage(ex.ToString());
    429       }
    430     }
    431 
    432     private void jobManager_DeleteChildJobs(object sender, EventArgs<SlaveJob> e) {
    433       try {
    434         WcfService.Instance.DeleteChildJobs(e.Value.JobId);
    435       }
    436       catch (Exception ex) {
    437         clientCom.LogMessage(ex.ToString());
    438       }
    439     }
    440400    #endregion
    441401
     
    491451    /// </summary>
    492452    private void ShutdownCore() {
    493       clientCom.LogMessage("Shutdown Signal received");
     453      clientCom.LogMessage("Shutdown signal received");
    494454      clientCom.LogMessage("Stopping heartbeat");
    495455      heartbeatManager.StopHeartBeat();
    496456      abortRequested = true;
     457
     458      DoAbortAll();
     459
    497460      clientCom.LogMessage("Logging out");
    498 
    499       DoAbortAll();
    500 
    501461      WcfService.Instance.Disconnect();
    502462      clientCom.Shutdown();
     
    514474      clientCom.LogMessage("Restart received");
    515475      configManager.Asleep = false;
    516       clientCom.LogMessage("Restart done");
    517476    }
    518477
     
    524483      clientCom.LogMessage("Sleep received - not accepting any new jobs");
    525484      configManager.Asleep = true;
    526       DoPauseAll();   
     485      DoPauseAll();
    527486    }
    528487    #endregion
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/DummyListener.cs

    r5599 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Exceptions/InvalidStateException.cs

    r5786 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs

    r6357 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    2523using System.Threading;
    2624using HeuristicLab.Common;
     
    2826using HeuristicLab.Hive;
    2927
    30 
    3128namespace HeuristicLab.Clients.Hive.SlaveCore {
     29  /// <summary>
     30  /// The executor runs in the appdomain and handles the execution of an Hive job.
     31  /// </summary>
    3232  public class Executor : MarshalByRefObject, IDisposable {
    3333    public Guid JobId { get; set; }
    34     public IJob Job { get; set; }
     34    private IJob Job { get; set; }
    3535    public int CoresNeeded { get; set; }
    3636    public int MemoryNeeded { get; set; }
    3737    private bool wasJobAborted = false;
    38     public Core Core { get; set; }
    3938    private Semaphore pauseStopSem = new Semaphore(0, 1);
    4039    private Semaphore startJobSem = new Semaphore(0, 1);
    4140    //make pause or stop wait until start is finished
    4241    private Semaphore jobStartedSem = new Semaphore(0, 1);
    43 
    44     public ExecutorQueue executorQueue;
    45 
    46     public bool SendHeartbeatForExecutor { get; set; } // Todo: get rid of??
     42    private ExecutorQueue executorQueue;
     43    public ExecutorQueue ExecutorCommandQueue {
     44      get {
     45        return executorQueue;
     46      }
     47    }
    4748    public bool IsStopping { get; set; }
    4849    public bool IsPausing { get; set; }
    49 
    50     public DateTime CreationTime { get; set; }
    51 
     50    private DateTime CreationTime { get; set; }
    5251    private Exception currentException;
    5352    public String CurrentException {
     
    6160    }
    6261
    63     public ExecutionState ExecutionState {
     62    private ExecutionState ExecutionState {
    6463      get {
    6564        return Job != null ? Job.ExecutionState : HeuristicLab.Core.ExecutionState.Stopped;
     
    7473
    7574    public Executor() {
    76       SendHeartbeatForExecutor = true;
    7775      IsStopping = false;
    7876      IsPausing = false;
     
    8078    }
    8179
    82     /// <param name="serializedJob"></param>
    83     /// <param name="collectChildJobs">if true, all child-jobs are downloaded and the job will be resumed.</param>
    8480    public void Start(byte[] serializedJob) {
    8581      try {
     
    8985        RegisterJobEvents();
    9086
    91         if (Job.CollectChildJobs) {
    92           IEnumerable<JobData> childjobs = WcfService.Instance.GetChildJobs(JobId);
    93           Job.Resume(childjobs.Select(j => PersistenceUtil.Deserialize<IJob>(j.Data)));
    94         } else {
    95           Job.Start();
    96           if (!jobStartedSem.WaitOne(TimeSpan.FromSeconds(15))) {
    97             throw new TimeoutException("Timeout when starting the job. JobStarted event was not fired.");
    98           }
    99           jobStartedSem.Release();
    100         }
     87        Job.Start();
     88        if (!jobStartedSem.WaitOne(TimeSpan.FromSeconds(15))) {
     89          throw new TimeoutException("Timeout when starting the job. JobStarted event was not fired.");
     90        }
     91        jobStartedSem.Release();
    10192      }
    10293      catch (Exception e) {
     
    10899    public void Pause() {
    109100      IsPausing = true;
    110       SendHeartbeatForExecutor = false;
    111101      // wait until job is started. if this does not happen, the Job is null an we give up
    112102      jobStartedSem.WaitOne(TimeSpan.FromSeconds(15));
    113103      if (Job == null) {
    114         currentException = new Exception("Pausing job " + this.JobId + ": Job is null"); // Todo: use more specific exception
     104        currentException = new Exception("Pausing job " + this.JobId + ": Job is null");
    115105        return;
    116106      }
     
    123113        }
    124114        catch (Exception ex) {
    125           currentException = new Exception("Error pausing job " + this.JobId + ": " + ex.ToString()); // Todo: use more specific exception
     115          currentException = new Exception("Error pausing job " + this.JobId + ": " + ex.ToString());
    126116        }
    127117      }
     
    130120    public void Stop() {
    131121      IsStopping = true;
    132       SendHeartbeatForExecutor = false;
    133122      // wait until job is started. if this does not happen, the Job is null an we give up
    134123      jobStartedSem.WaitOne(TimeSpan.FromSeconds(15));
    135124      if (Job == null) {
    136         currentException = new Exception("Stopping job " + this.JobId + ": Job is null"); // Todo: use more specific exception
     125        currentException = new Exception("Stopping job " + this.JobId + ": Job is null");
    137126      }
    138127      wasJobAborted = true;
     
    144133        }
    145134        catch (Exception ex) {
    146           currentException = new Exception("Error stopping job " + this.JobId + ": " + ex.ToString()); // Todo: use more specific exception
     135          currentException = new Exception("Error stopping job " + this.JobId + ": " + ex.ToString());
    147136        }
    148137      }
     
    152141      Job.JobStopped += new EventHandler(Job_JobStopped);
    153142      Job.JobFailed += new EventHandler(Job_JobFailed);
    154       Job.NewChildJob += new EventHandler<EventArgs<IJob>>(Job_NewChildJob);
    155       Job.WaitForChildJobs += new EventHandler(Job_WaitForChildJobs);
    156       Job.DeleteChildJobs += new EventHandler(Job_DeleteChildJobs);
    157143      Job.JobPaused += new EventHandler(Job_JobPaused);
    158144      Job.JobStarted += new EventHandler(Job_JobStarted);
     
    162148      Job.JobStopped -= new EventHandler(Job_JobStopped);
    163149      Job.JobFailed -= new EventHandler(Job_JobFailed);
    164       Job.NewChildJob -= new EventHandler<EventArgs<IJob>>(Job_NewChildJob);
    165       Job.WaitForChildJobs -= new EventHandler(Job_WaitForChildJobs);
    166       Job.DeleteChildJobs -= new EventHandler(Job_DeleteChildJobs);
    167150      Job.JobPaused -= new EventHandler(Job_JobPaused);
    168151      Job.JobStarted -= new EventHandler(Job_JobStarted);
     
    170153
    171154    #region Job Events
    172     private void Job_NewChildJob(object sender, EventArgs<IJob> e) {
    173       //JobData childJobData = new JobData();
    174       //IEnumerable<Type> types;
    175       //childJobData.Data = PersistenceUtil.Serialize(e.Value, out types);
    176       //IEnumerable<Plugin> plugins;
    177       //PluginUtil.CollectDeclaringPlugins
    178 
    179       //Job childJob = new Job();
    180       //childJob.CoresNeeded = 1;
    181       //childJob.MemoryNeeded = 0;
    182       //childJob.PluginsNeededIds = FindPluginsNeeded(e.Value);
    183 
    184       //ExecutorMessage msg = new ExecutorMessage(ExecutorMessageType.NewChildJob);
    185       //msg.MsgData = childJobData;
    186       //msg.MsgJob = childJob;
    187 
    188       //executorQueue.AddMessage(msg);
    189      
    190       executorQueue.AddMessage(new JobExecutorMessage(ExecutorMessageType.NewChildJob, e.Value));
    191     }
    192 
    193     private void Job_WaitForChildJobs(object sender, EventArgs e) {
    194       // Pause the job and send it back to the hive. The server will awake it when all child-jobs are finished
    195       this.Job.CollectChildJobs = true;
    196 
    197       //JobData jdata = new JobData();
    198       //jdata.Data = PersistenceUtil.Serialize(Job);
    199       //jdata.JobId = this.JobId;
    200 
    201       //ExecutorMessage msg = new ExecutorMessage(ExecutorMessageType.WaitForChildJobs);
    202       //msg.MsgData = jdata;
    203       //executorQueue.AddMessage(msg);
    204 
    205       executorQueue.AddMessage(new ExecutorMessage(ExecutorMessageType.WaitForChildJobs));
    206     }
    207 
    208     private void Job_DeleteChildJobs(object sender, EventArgs e) {
    209       executorQueue.AddMessage(ExecutorMessageType.DeleteChildJobs);
    210     }
    211 
    212155    private void Job_JobFailed(object sender, EventArgs e) {
    213156      EventArgs<Exception> ex = (EventArgs<Exception>)e;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ExecutorMessage.cs

    r6357 r6371  
    1 
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
    222using System;
    3 using HeuristicLab.Hive;
     23
    424namespace HeuristicLab.Clients.Hive.SlaveCore {
     25
    526  [Serializable]
    627  public enum ExecutorMessageType {
     
    930    JobStopped,
    1031    JobFailed,
    11     NewChildJob,
    12     WaitForChildJobs,
    13     DeleteChildJobs,
    1432    StopExecutorMonitoringThread
    1533  }
     
    2341    }
    2442  }
    25 
    26   [Serializable]
    27   public class JobExecutorMessage : ExecutorMessage {
    28     public IJob Job { get; private set; }
    29 
    30     public JobExecutorMessage(ExecutorMessageType messageType, IJob job) : base(messageType) {
    31       this.Job = job;
    32     }
    33   }
    3443}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ExecutorQueue.cs

    r6203 r6371  
    1 
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
    222using System;
    323using System.Collections.Generic;
    424using System.Threading;
     25
    526namespace HeuristicLab.Clients.Hive.SlaveCore {
    6 
     27  /// <summary>
     28  /// Every Executor gets an ExecutorQueue in which it can push messages.
     29  /// These messages are then read and processed from outside the appdomain.
     30  /// </summary>
    731  public class ExecutorQueue : MarshalByRefObject {
    832    private Queue<ExecutorMessage> queue = null;
    933    private Semaphore semaphore = null;
    1034
    11     /// <summary>
    12     /// Creates a new MessageQueue Object.
    13     /// A new Queue and a Semaphore is created. The Semaphore is set to a max size of 5000.
    14     /// </summary>
    1535    public ExecutorQueue() {
    1636      queue = new Queue<ExecutorMessage>();
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/HeuristicLabClientsHiveSlavePlugin.cs.frame

    r6033 r6371  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22
     23using System;
    224using System.Collections.Generic;
    325using System.Linq;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/IPluginProvider.cs

    r6357 r6371  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/JobStatus.cs

    r6357 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Manager/ConfigManager.cs

    r6357 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3939
    4040    /// <summary>
    41     /// if the Sleeping is true, the Slave won't accept any new jobs
     41    /// if Asleep is true, the Slave won't accept any new jobs
    4242    /// </summary>
    4343    public bool Asleep { get; set; }
    44 
    45     //public Core Core { get; set; }
    4644    private JobManager jobManager;
    4745    private Slave slave;
     
    111109    public Dictionary<Guid, TimeSpan> GetExecutionTimeOfAllJobs() {
    112110      Dictionary<Guid, TimeSpan> prog = new Dictionary<Guid, TimeSpan>();
    113 
    114       //lock (slaveJobs) {
    115       //  foreach (KeyValuePair<Guid, SlaveJob> kvp in slaveJobs) {
    116       //    Executor e = kvp.Value.JobExecutor;
    117       //    if (e != null && !kvp.Value.Finished) {
    118       //      //don't include jobs in hb's which are currently serializing
    119       //      if (e.SendHeartbeatForExecutor) {
    120       //        prog[e.JobId] = e.ExecutionTime;
    121       //      }
    122       //    }
    123       //  }
    124       //}
    125111      prog = jobManager.GetExecutionTimes();
    126 
    127112      return prog;
    128113    }
     
    159144
    160145    /// <summary>
    161     /// Generate a guid based on mac address of the first found nic (yes, mac addresses are not unique...).
     146    /// Generate a guid based on mac address of the first found nic (yes, mac addresses are not unique...)
     147    /// and the machine name.
    162148    /// Format:
    163149    ///
     
    169155    /// The mac address is saved in the last 48 bits of the Data 4 segment
    170156    /// of the guid (first 2 bytes of Data 4 are reserved).
    171     /// D1 contains the name of the machine.
     157    /// D1 contains the hash of the machinename.
    172158    /// </summary>   
    173159    private static Guid GetUniqueMachineIdFromMac() {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Manager/HeartbeatManager.cs

    r6357 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2727namespace HeuristicLab.Clients.Hive.SlaveCore {
    2828  /// <summary>
    29   /// Heartbeat class. It sends every x ms a heartbeat to the server and receives a Message
     29  /// Heartbeat Manager sends every x ms a heartbeat to the server and receives a message.
     30  /// The message is added to the MessageQueue from where the Core pulls them and decides what to do.
    3031  /// </summary>
    3132  public class HeartbeatManager {
     
    8687            if (wcfService.ConnState == NetworkEnum.WcfConnState.Connected) {
    8788              Slave info = ConfigManager.Instance.GetClientInfo();
    88              
     89
    8990              Heartbeat heartBeatData = new Heartbeat {
    9091                SlaveId = info.Id,
     
    120121    }
    121122
    122 
    123123    #region Eventhandler
    124124    public event EventHandler<EventArgs<Exception>> ExceptionOccured;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Manager/JobManager.cs

    r6357 r6371  
    2626using HeuristicLab.Common;
    2727using HeuristicLab.Core;
    28 using HeuristicLab.Hive;
    2928
    3029namespace HeuristicLab.Clients.Hive.SlaveCore {
     30
     31  /// <summary>
     32  /// Holds a list of slave jobs and manages access to this list.
     33  /// Forwards events from SlaveJob and forwards commands to SlaveJob.
     34  /// </summary>
    3135  public class JobManager {
    3236    private static ReaderWriterLockSlim slaveJobsLocker = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
     
    164168      finally { slaveJobsLocker.ExitWriteLock(); }
    165169    }
     170
    166171    private void RemoveSlaveJob(Guid jobId, SlaveJob slaveJob) {
    167172      slaveJobsLocker.EnterWriteLock();
     
    181186      slaveJob.JobFailed += new EventHandler<EventArgs<Guid, Exception>>(slaveJob_JobFailed);
    182187      slaveJob.ExceptionOccured += new EventHandler<EventArgs<Guid, Exception>>(slaveJob_ExceptionOccured);
    183       slaveJob.NewChildJob += new EventHandler<EventArgs<Guid, HeuristicLab.Hive.IJob>>(slaveJob_NewChildJob);
    184       slaveJob.WaitForChildJobs += new EventHandler<EventArgs<Guid>>(slaveJob_WaitForChildJobs);
    185       slaveJob.DeleteChildJobs += new EventHandler<EventArgs<Guid>>(slaveJob_DeleteChildJobs);
    186188    }
    187189
     
    192194      slaveJob.JobFailed -= new EventHandler<EventArgs<Guid, Exception>>(slaveJob_JobFailed);
    193195      slaveJob.ExceptionOccured -= new EventHandler<EventArgs<Guid, Exception>>(slaveJob_ExceptionOccured);
    194       slaveJob.NewChildJob -= new EventHandler<EventArgs<Guid, HeuristicLab.Hive.IJob>>(slaveJob_NewChildJob);
    195       slaveJob.WaitForChildJobs -= new EventHandler<EventArgs<Guid>>(slaveJob_WaitForChildJobs);
    196       slaveJob.DeleteChildJobs -= new EventHandler<EventArgs<Guid>>(slaveJob_DeleteChildJobs);
    197196    }
    198197
     
    285284      SlaveStatusInfo.IncrementExceptionOccured();
    286285      OnExceptionOccured(slaveJob, e.Value2);
    287     }
    288 
    289     private void slaveJob_NewChildJob(object sender, EventArgs<Guid, IJob> e) {
    290       var slaveJob = slaveJobs[e.Value];
    291       OnNewChildJob(slaveJob, e.Value2);
    292     }
    293 
    294     private void slaveJob_WaitForChildJobs(object sender, EventArgs<Guid> e) {
    295       SlaveJob slaveJob;
    296       slaveJobsLocker.EnterUpgradeableReadLock();
    297       try {
    298         slaveJob = slaveJobs[e.Value];
    299         RemoveSlaveJob(e.Value, slaveJob);
    300       }
    301       finally { slaveJobsLocker.ExitUpgradeableReadLock(); }
    302 
    303       JobData jobData = null;
    304       try {
    305         jobData = slaveJob.GetJobData();
    306         if (jobData == null) throw new SerializationException();
    307         SlaveStatusInfo.IncrementJobsFinished();
    308         OnWaitForChildJobs(slaveJob, jobData);
    309       }
    310       catch (Exception ex) {
    311         RemoveSlaveJob(e.Value, slaveJob);
    312         SlaveStatusInfo.IncrementJobsFailed();
    313         OnJobFailed(slaveJob, jobData, ex);
    314       }
    315     }
    316 
    317     private void slaveJob_DeleteChildJobs(object sender, EventArgs<Guid> e) {
    318       var slaveJob = slaveJobs[e.Value];
    319       OnDeleteChildJobs(slaveJob);
    320286    }
    321287    #endregion
     
    357323      if (handler != null) handler(this, new EventArgs<SlaveJob>(slaveJob));
    358324    }
    359 
    360     public event EventHandler<EventArgs<SlaveJob, IJob>> NewChildJob;
    361     private void OnNewChildJob(SlaveJob slaveJob, IJob job) {
    362       var handler = NewChildJob;
    363       if (handler != null) handler(this, new EventArgs<SlaveJob, IJob>(slaveJob, job));
    364     }
    365 
    366     public event EventHandler<EventArgs<SlaveJob, JobData>> WaitForChildJobs;
    367     private void OnWaitForChildJobs(SlaveJob slaveJob, JobData jobData) {
    368       var handler = WaitForChildJobs;
    369       if (handler != null) handler(this, new EventArgs<SlaveJob, JobData>(slaveJob, jobData));
    370     }
    371 
    372     public event EventHandler<EventArgs<SlaveJob>> DeleteChildJobs;
    373     private void OnDeleteChildJobs(SlaveJob slaveJob) {
    374       var handler = DeleteChildJobs;
    375       if (handler != null) handler(this, new EventArgs<SlaveJob>(slaveJob));
    376     }
    377325    #endregion
    378326
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Manager/PluginManager.cs

    r6357 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3333    private static object locker = new object();
    3434    private const string lastUsedFileName = "lastUsed.dat";
    35 
    3635    //maximum number of days after which a plugin gets deleted if not used
    3736    private const int maxAge = 5;
    3837
     38    private string PluginCacheDir { get; set; }
     39    public string PluginTempBaseDir { get; set; }
    3940    private ILog log;
    4041    private IPluginProvider pluginService;
    41     public string PluginCacheDir { get; set; }
    42     public string PluginTempBaseDir { get; set; }
    43 
    4442    private List<Guid> cachedPluginsGuids = new List<Guid>();
    45 
    46     //public static PluginCache Instance {
    47     //  get {        return instance;      }
    48     //  set {}
    49     //}
    5043
    5144    public PluginManager(IPluginProvider pluginService, ILog log) {
     
    9285
    9386        if (requestedPlugin.Name == "Configuration") {
    94           configFileName = Path.Combine(targetDir, Path.GetFileName(filePaths.SingleOrDefault())); // configuration plugin consists only of 1 file (usually the "HeuristicLab X.X.exe.config")
     87          // configuration plugin consists only of 1 file (usually the "HeuristicLab X.X.exe.config")
     88          configFileName = Path.Combine(targetDir, Path.GetFileName(filePaths.SingleOrDefault()));
    9589        }
    9690      }
     
    179173          configFileName = "";
    180174        }
    181         log.LogMessage("Fetched " + missingGuids.Count + " plugins for job " + job.Id);
     175        log.LogMessage(string.Format("Fetched {0} plugins for job {1}", missingGuids.Count, job.Id));
    182176      }
    183177    }
     
    290284        while (tries > 0) {
    291285          try {
    292             if(Directory.Exists(path)) Directory.Delete(path, true);
     286            if (Directory.Exists(path)) Directory.Delete(path, true);
    293287            tries = 0;
    294288          }
    295           catch (Exception e) {
     289          catch (Exception) {
    296290            Thread.Sleep(1000);
    297291            tries--;
    298             if (tries == 0) throw;// TODO: don't know what to do
     292            if (tries == 0) throw;
    299293          }
    300294        }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/MessageQueue.cs

    r6204 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/NetworkEnum.cs

    r5599 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
    22 
    2322namespace HeuristicLab.Clients.Hive.SlaveCore {
    2423  public class NetworkEnum {
    25     public enum WcfConnState { Connected, Disconnected, Failed } 
     24    public enum WcfConnState { Connected, Disconnected, Failed }
    2625  }
    2726}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Properties/AssemblyInfo.cs.frame

    r5043 r6371  
    1111[assembly: AssemblyCompany("")]
    1212[assembly: AssemblyProduct("HeuristicLab")]
    13 [assembly: AssemblyCopyright("(c) 2002-2010 HEAL")]
     13[assembly: AssemblyCopyright("(c) 2002-2011 HEAL")]
    1414[assembly: AssemblyTrademark("")]
    1515[assembly: AssemblyCulture("")]
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ServiceContracts/ISlaveCommunication.cs

    r6263 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ServiceContracts/ISlaveCommunicationCallbacks.cs

    r5599 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2121
    2222using System.ServiceModel;
    23 using HeuristicLab.Clients.Hive.SlaveCore;
    2423
    2524namespace HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/SlaveClientCom.cs

    r5795 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    5252    private void SetupClientCom() {
    5353      DummyListener dummy = new DummyListener();
    54       pipeFactory = new DuplexChannelFactory<ISlaveCommunication>(dummy, "SlaveCommunicationServiceEndpoint");
     54      try {
     55        pipeFactory = new DuplexChannelFactory<ISlaveCommunication>(dummy, "SlaveCommunicationServiceEndpoint");
     56      }
     57      catch {
     58        pipeFactory = new DuplexChannelFactory<ISlaveCommunication>(dummy, new NetNamedPipeBinding(), new EndpointAddress("net.pipe://localhost/HeuristicLabSlaveCom"));
     59      }
    5560
    5661      ISlaveCommunication pipeProxy = pipeFactory.CreateChannel();
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/SlaveCommunicationService.cs

    r6357 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2424using HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts;
    2525
    26 
    2726namespace HeuristicLab.Clients.Hive.SlaveCore {
    28 
    2927  public class SlaveCommunicationService : ISlaveCommunication {
    3028    private static List<ISlaveCommunicationCallbacks> subscribers = new List<ISlaveCommunicationCallbacks>();
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/SlaveJob.cs

    r6357 r6371  
    1 
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
    222using System;
    323using System.IO;
     
    525using HeuristicLab.Common;
    626using HeuristicLab.Core;
    7 using HeuristicLab.Hive;
    827using HeuristicLab.PluginInfrastructure.Sandboxing;
    928
    1029namespace HeuristicLab.Clients.Hive.SlaveCore {
    1130
     31  /// <summary>
     32  ///  Manages a single job and it's appdomain.
     33  /// </summary>
    1234  public class SlaveJob : MarshalByRefObject {
    1335    private Executor executor;
     
    1840    private PluginManager pluginManager;
    1941    private ILog log;
    20 
    2142    public Guid JobId { get; private set; }
    2243    public bool IsPrepared { get; private set; }
     
    4869      }
    4970      catch (Exception) {
    50         DisposeAppDomain(); // make sure to clean up if something went wrong
     71        // make sure to clean up if something went wrong
     72        DisposeAppDomain();
    5173        throw;
    5274      }
     
    7294
    7395    private AppDomain CreateAppDomain(Job job, String pluginDir, string configFileName) {
    74       appDomain = SandboxManager.CreateAndInitPrivilegedSandbox(job.Id.ToString(), pluginDir, Path.Combine(pluginDir, configFileName));
     96      if (job.IsPrivileged) {
     97        appDomain = SandboxManager.CreateAndInitPrivilegedSandbox(job.Id.ToString(), pluginDir, Path.Combine(pluginDir, configFileName));
     98      } else {
     99        appDomain = SandboxManager.CreateAndInitSandbox(job.Id.ToString(), pluginDir, Path.Combine(pluginDir, configFileName));
     100      }
    75101      appDomain.UnhandledException += new UnhandledExceptionEventHandler(AppDomain_UnhandledException);
    76102
     
    90116    }
    91117
    92     /// <summary>
    93     /// Kill a appdomain with a specific id.
    94     /// </summary>
    95     /// <param name="JobId">the GUID of the job</param>   
    96118    public void DisposeAppDomain() {
    97119      log.LogMessage(string.Format("Shutting down Appdomain for Job {0}", JobId));
     
    128150    private void AppDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
    129151      DisposeAppDomain();
    130       OnExceptionOccured(new Exception("Unhandled exception: " +e.ExceptionObject.ToString()));
     152      OnExceptionOccured(new Exception("Unhandled exception: " + e.ExceptionObject.ToString()));
    131153    }
    132154
     
    145167        if (executorMonitoringRun) {
    146168          executorMonitoringRun = false;
    147           executor.executorQueue.AddMessage(ExecutorMessageType.StopExecutorMonitoringThread);
     169          executor.ExecutorCommandQueue.AddMessage(ExecutorMessageType.StopExecutorMonitoringThread);
    148170        }
    149171      }
     
    158180      while (executorMonitoringRun) {
    159181        //this blocks through the appdomain border, that's why the lease gets renewed
    160         ExecutorMessage message = executor.executorQueue.GetMessage();
     182        ExecutorMessage message = executor.ExecutorCommandQueue.GetMessage();
    161183
    162184        switch (message.MessageType) {
     
    181203            OnJobFailed(new JobFailedException(executor.CurrentException));
    182204            DisposeAppDomain();
    183             break;
    184 
    185           case ExecutorMessageType.NewChildJob:
    186             OnNewChildJob(((JobExecutorMessage)message).Job);
    187             break;
    188 
    189           case ExecutorMessageType.WaitForChildJobs:
    190             executorMonitoringRun = false;
    191             OnWaitForChildJobs();
    192             DisposeAppDomain();
    193             break;
    194 
    195           case ExecutorMessageType.DeleteChildJobs:
    196             OnDeleteChildJobs();
    197205            break;
    198206
     
    240248      if (handler != null) handler(this, new EventArgs<Guid, Exception>(this.JobId, exception));
    241249    }
    242 
    243     public event EventHandler<EventArgs<Guid, IJob>> NewChildJob;
    244     private void OnNewChildJob(IJob job) {
    245       var handler = NewChildJob;
    246       if (handler != null) handler(this, new EventArgs<Guid, IJob>(this.JobId, job));
    247     }
    248 
    249     public event EventHandler<EventArgs<Guid>> WaitForChildJobs;
    250     private void OnWaitForChildJobs() {
    251       var handler = WaitForChildJobs;
    252       if (handler != null) handler(this, new EventArgs<Guid>(this.JobId));
    253     }
    254 
    255     public event EventHandler<EventArgs<Guid>> DeleteChildJobs;
    256     private void OnDeleteChildJobs() {
    257       var handler = DeleteChildJobs;
    258       if (handler != null) handler(this, new EventArgs<Guid>(this.JobId));
    259     }
    260250  }
    261251}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/SlaveStatusInfo.cs

    r6357 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/StatusCommons.cs

    r6357 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    5858
    5959    public override string ToString() {
    60       return string.Format("Status: {0}, Fetc,Start,Fin,Abor,Fail,Exc: {1},{2},{3},{4},{5},{6}", 
     60      return string.Format("Status: {0}, Fetc,Start,Fin,Abor,Fail,Exc: {1},{2},{3},{4},{5},{6}",
    6161        Status, JobsFetched, JobsStarted, JobsFinished, JobsAborted, JobsFailed, ExceptionsOccured);
    6262    }
    63 
    64 
    6563  }
    6664}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/WcfService.cs

    r6357 r6371  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2929
    3030  /// <summary>
    31   /// WcfService class is implemented as a Singleton and works as a communication Layer with the Server
     31  /// WcfService class is implemented as a singleton and works as a communication layer with the Hive server
    3232  /// </summary>
    3333  public class WcfService : MarshalByRefObject, IPluginProvider {
    3434    private static WcfService instance;
     35    public DateTime ConnectedSince { get; private set; }
     36    public NetworkEnum.WcfConnState ConnState { get; private set; }
     37
    3538    /// <summary>
    3639    /// Getter for the Instance of the WcfService
     
    4851    }
    4952
    50     public DateTime ConnectedSince { get; private set; }
    51     public NetworkEnum.WcfConnState ConnState { get; private set; }
    52 
    5353    private WcfService() {
    5454      ConnState = NetworkEnum.WcfConnState.Disconnected;
     
    9999
    100100    /// <summary>
    101     /// Uploads the JobData and sets a new jobState (while correctly setting Transferring state)
     101    /// Uploads the jobData and sets a new jobState (while correctly setting Transferring state)
    102102    /// </summary>
    103103    public void UpdateJobData(Job job, JobData jobData, Guid slaveId, JobState state) {
     
    122122
    123123    #region Plugin Methods
    124 
    125124    public Plugin GetPlugin(Guid id) {
    126125      return CallHiveService(s => s.GetPlugin(id));
     
    152151    #region Helpers
    153152    /// <summary>
    154     /// Connects with the Server, registers the events and fires the Connected (and quiet possibly the ConnectionRestored) Event.
     153    /// Connects with the server, registers the events and fires the Connected event.
    155154    /// </summary>
    156155    public void Connect(Slave slaveInfo) {
     
    164163
    165164    /// <summary>
    166     /// Disconnects the Slave from the Server
     165    /// Disconnects the slave from the server
    167166    /// </summary>
    168167    public void Disconnect() {
     
    174173
    175174    /// <summary>
    176     /// Network communication Error Handler - Every network error gets logged and the connection switches to faulted state
    177     /// </summary>
    178     /// <param name="e">The Exception</param>
     175    /// Network communication error handler.
     176    /// Every network error gets logged and the connection switches to faulted state
     177    /// </summary>
    179178    private void HandleNetworkError(Exception e) {
    180179      ConnState = NetworkEnum.WcfConnState.Failed;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Hive 3.4.sln

    r6361 r6371  
    9494EndProject
    9595Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Clients.Hive.Slave-3.4.ConsoleTests", "HeuristicLab.Clients.Hive.Slave\3.4\ConsoleTests\HeuristicLab.Clients.Hive.Slave-3.4.ConsoleTests.csproj", "{B09E8C65-8D4D-48B3-8E9A-F6FC52107261}"
    96 EndProject
    97 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Clients.Hive.Slave-3.4.Tests", "HeuristicLab.Clients.Hive.Slave\3.4\Tests\HeuristicLab.Clients.Hive.Slave-3.4.Tests.csproj", "{C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}"
    9896EndProject
    9997Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4", "HeuristicLab.Clients.Hive.Slave.ConsoleClient\HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4.csproj", "{464D70B8-2D91-485C-B622-22E4A4891C68}"
     
    416414    {B09E8C65-8D4D-48B3-8E9A-F6FC52107261}.Release|x86.ActiveCfg = Release|x86
    417415    {B09E8C65-8D4D-48B3-8E9A-F6FC52107261}.Release|x86.Build.0 = Release|x86
    418     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    419     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
    420     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
    421     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Debug|Mixed Platforms.Build.0 = Debug|x86
    422     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Debug|x64.ActiveCfg = Debug|x86
    423     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Debug|x86.ActiveCfg = Debug|x86
    424     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Debug|x86.Build.0 = Debug|x86
    425     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
    426     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Release|Any CPU.Build.0 = Release|Any CPU
    427     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Release|Mixed Platforms.ActiveCfg = Release|x86
    428     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Release|Mixed Platforms.Build.0 = Release|x86
    429     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Release|x64.ActiveCfg = Release|x86
    430     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Release|x86.ActiveCfg = Release|x86
    431     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}.Release|x86.Build.0 = Release|x86
    432416    {464D70B8-2D91-485C-B622-22E4A4891C68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    433417    {464D70B8-2D91-485C-B622-22E4A4891C68}.Debug|Any CPU.Build.0 = Debug|Any CPU
     
    471455    {542AD827-817C-44E9-AD28-D6607BC4FA10} = {622F8E95-CDFC-4B4E-BBA7-3EE4E47DB52A}
    472456    {B09E8C65-8D4D-48B3-8E9A-F6FC52107261} = {622F8E95-CDFC-4B4E-BBA7-3EE4E47DB52A}
    473     {C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA} = {622F8E95-CDFC-4B4E-BBA7-3EE4E47DB52A}
    474457    {464D70B8-2D91-485C-B622-22E4A4891C68} = {622F8E95-CDFC-4B4E-BBA7-3EE4E47DB52A}
    475458    {EC2C8109-6E1E-4C88-9A2B-908CFF2EF4AC} = {E69A1E5F-63F7-493F-BBA2-163D6E321D44}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Hive/3.4/IJob.cs

    r6110 r6371  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using HeuristicLab.Common;
    2523using HeuristicLab.Core;
    2624
     
    4341    bool ComputeInParallel { get; set; }
    4442
    45     /// <summary>
    46     /// If this is set to true, the job should be Resumed with the child-jobs attatched instead of Started
    47     /// </summary>
    48     bool CollectChildJobs { get; set; }
    4943
    5044    void Prepare();
     
    5549
    5650    void Stop();
    57 
    58     void Resume(IEnumerable<IJob> childJobs);
    5951
    6052    event EventHandler ComputeInParallelChanged;
     
    7163
    7264    event EventHandler JobStarted;
    73 
    74     /// <summary>
    75     /// When this event occurs the job wants to sleep until all his child jobs are finished
    76     /// </summary>
    77     event EventHandler WaitForChildJobs;
    78 
    79     /// <summary>
    80     /// This event will be fired when the job wants to have a child-job to be computed
    81     /// </summary>
    82     event EventHandler<EventArgs<IJob>> NewChildJob;
    83 
    84     /// <summary>
    85     /// Will be fired when job wants all child-jobs to be deleted from hive
    86     /// </summary>
    87     event EventHandler DeleteChildJobs;
    88 
    89 
    9065  }
    9166}
Note: See TracChangeset for help on using the changeset viewer.