Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/24/11 10:50:01 (13 years ago)
Author:
ascheibe
Message:

#1233 adapt Hive to HL trunk

Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobClient.cs

    r5055 r5363  
    2323using System.Collections.Generic;
    2424using System.Drawing;
     25using System.IO;
    2526using System.Linq;
     27using HeuristicLab.Clients.Hive.Jobs;
    2628using HeuristicLab.Collections;
    2729using HeuristicLab.Common;
    2830using HeuristicLab.Core;
    2931using HeuristicLab.Optimization;
    30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     32using HeuristicLab.PluginInfrastructure;
    3133using HeuristicLab.Services.Hive.Common.DataTransfer;
    32 using HeuristicLab.Clients.Hive.Jobs;
    33 using HeuristicLab.PluginInfrastructure;
    34 using System.IO;
    35 using HeuristicLab.PluginInfrastructure.Manager;
    3634
    3735namespace HeuristicLab.Clients.Hive {
     
    4442      get {
    4543        if (job.Id == Guid.Empty) { // not yet uploaded
    46           return HeuristicLab.Common.Resources.VS2008ImageLibrary.Event;
     44          return HeuristicLab.Common.Resources.VSImageLibrary.Event;
    4745        } else {
    48           if (job.JobState == JobState.Waiting) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutablePrepared;
    49           else if (job.JobState == JobState.WaitingForChildJobs) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutablePrepared;
    50           else if (job.JobState == JobState.Calculating) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutableStarted;
    51           else if (job.JobState == JobState.Aborted) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutableStopped;
    52           else if (job.JobState == JobState.Failed) return HeuristicLab.Common.Resources.VS2008ImageLibrary.Error;
    53           else if (job.JobState == JobState.Finished) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutableStopped;
    54           else return HeuristicLab.Common.Resources.VS2008ImageLibrary.Event;
     46          if (job.JobState == JobState.Waiting) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePrepared;
     47          else if (job.JobState == JobState.WaitingForChildJobs) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePrepared;
     48          else if (job.JobState == JobState.Calculating) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStarted;
     49          else if (job.JobState == JobState.Aborted) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped;
     50          else if (job.JobState == JobState.Failed) return HeuristicLab.Common.Resources.VSImageLibrary.Error;
     51          else if (job.JobState == JobState.Finished) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped;
     52          else return HeuristicLab.Common.Resources.VSImageLibrary.Event;
    5553        }
    5654      }
     
    177175        } else if (OptimizerJob.Optimizer is Optimization.BatchRun) {
    178176          Optimization.BatchRun batchRun = OptimizerJob.OptimizerAsBatchRun;
    179           if (batchRun.Algorithm != null) {
     177          if (batchRun.Optimizer != null) {
    180178            while (this.childHiveJobs.Count < batchRun.Repetitions) {
    181               this.childHiveJobs.Add(new HiveJob(batchRun.Algorithm));
     179              this.childHiveJobs.Add(new HiveJob(batchRun.Optimizer));
    182180            }
    183181            while (this.childHiveJobs.Count > batchRun.Repetitions) {
     
    200198          Optimization.BatchRun batchRun = OptimizerJob.OptimizerAsBatchRun;
    201199          batchRun.RepetitionsChanged += new EventHandler(batchRun_RepetitionsChanged);
    202           batchRun.AlgorithmChanged += new EventHandler(batchRun_AlgorithmChanged);
     200          batchRun.OptimizerChanged += new EventHandler(batchRun_OptimizerChanged);
    203201        }
    204202        OptimizerJob.ComputeInParallelChanged += new EventHandler(OptimizerJob_ComputeInParallelChanged);
     
    217215          Optimization.BatchRun batchRun = OptimizerJob.OptimizerAsBatchRun;
    218216          batchRun.RepetitionsChanged -= new EventHandler(batchRun_RepetitionsChanged);
    219           batchRun.AlgorithmChanged -= new EventHandler(batchRun_AlgorithmChanged);
     217          batchRun.OptimizerChanged -= new EventHandler(batchRun_OptimizerChanged);
    220218        }
    221219        OptimizerJob.ComputeInParallelChanged -= new EventHandler(OptimizerJob_ComputeInParallelChanged);
     
    224222    }
    225223
    226     void batchRun_AlgorithmChanged(object sender, EventArgs e) {
     224    void batchRun_OptimizerChanged(object sender, EventArgs e) {
    227225      if (syncJobsWithOptimizers) {
    228226        this.childHiveJobs.Clear();
     
    308306    ///   replace the child-optimizer in the experiment
    309307    /// if this.Optimizer is BatchRun
    310     ///   add the runs from the optimizerJob to the batchrun and replace the algorithm
     308    ///   add the runs from the optimizerJob to the batchrun and replace the Optimizer
    311309    /// </summary>
    312310    public void UpdateChildOptimizer(OptimizerJob optimizerJob, Guid childJobId) {
     
    341339
    342340    /// <summary>
    343     /// Adds the runs from the optimizerJob to the batchrun and replaces the algorithm
     341    /// Adds the runs from the optimizerJob to the batchrun and replaces the Optimizer
    344342    /// Sideeffect: the optimizerJob.Optimizer will be prepared (scopes are deleted and executionstate will be reset)
    345343    /// </summary>
    346344    private void UpdateOptimizerInBatchRun(BatchRun batchRun, OptimizerJob optimizerJob) {
    347       if (batchRun.Algorithm == null) {
    348         batchRun.Algorithm = (IAlgorithm)optimizerJob.Optimizer; // only set the first optimizer as algorithm. if every time the Algorithm would be set, the runs would be cleared each time
     345      if (batchRun.Optimizer == null) {
     346        batchRun.Optimizer = (IOptimizer)optimizerJob.Optimizer; // only set the first optimizer as Optimizer. if every time the Optimizer would be set, the runs would be cleared each time
    349347      }
    350348      foreach (IRun run in optimizerJob.Optimizer.Runs) {
     
    438436      } else if (withoutChildOptimizers && this.OptimizerJob.Optimizer is Optimization.BatchRun) {
    439437        OptimizerJob clonedJob = (OptimizerJob)this.OptimizerJob.Clone();
    440         clonedJob.OptimizerAsBatchRun.Algorithm = null;
     438        clonedJob.OptimizerAsBatchRun.Optimizer = null;
    441439        jobByteArray = PersistenceUtil.Serialize(clonedJob);
    442440      } else if (this.OptimizerJob.Optimizer is IAlgorithm) {
     
    462460    private void UpdateRequiredPlugins() {
    463461      List<Guid> pluginList = new List<Guid>();
    464      
     462
    465463      IEnumerable<IPluginDescription> neededPlugins = ApplicationManager.Manager.Plugins; //HivePluginInfoDto.FindPluginsNeeded(optimizerJob.GetType());
    466464      using (var service = ServiceLocator.Instance.GetService()) {
     
    481479            }
    482480            pluginList.Add(service.Obj.AddPlugin(p, pluginDatas));
    483           }         
     481          }
    484482        }
    485483      }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/Jobs/OptimizerJob.cs

    r5062 r5363  
    2424using HeuristicLab.Common;
    2525using HeuristicLab.Core;
     26using HeuristicLab.Hive;
    2627using HeuristicLab.Optimization;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    28 using HeuristicLab.Hive;
    2929
    3030namespace HeuristicLab.Clients.Hive.Jobs {
     
    8585      this.log = new Log();
    8686    }
    87     public OptimizerJob(IOptimizer optimizer) : this() {
     87    public OptimizerJob(IOptimizer optimizer)
     88      : this() {
    8889      this.Optimizer = optimizer;
    8990
     
    9899    [StorableConstructor]
    99100    protected OptimizerJob(bool deserializing) { }
    100     protected OptimizerJob(OptimizerJob original, Cloner cloner) : base(original, cloner) {
     101    protected OptimizerJob(OptimizerJob original, Cloner cloner)
     102      : base(original, cloner) {
    101103      this.Optimizer = cloner.Clone(original.Optimizer);
    102104      this.log = cloner.Clone(original.Log);
     
    145147    public virtual void Start() {
    146148      if ((optimizer is Optimization.Experiment && OptimizerAsExperiment.Optimizers.Count == 0) || // experiment would not fire OnStopped if it has 0 optimizers
    147           (optimizer is Optimization.BatchRun && OptimizerAsBatchRun.Algorithm == null)) { // batchrun would not fire OnStopped if algorithm == null
     149          (optimizer is Optimization.BatchRun && OptimizerAsBatchRun.Optimizer == null)) { // batchrun would not fire OnStopped if algorithm == null
    148150        OnJobStopped();
    149151      } else {
     
    281283    protected virtual void OnDescriptionChanged() {
    282284      var handler = DescriptionChanged;
    283       if(handler != null) handler(this, EventArgs.Empty);
     285      if (handler != null) handler(this, EventArgs.Empty);
    284286    }
    285287    public event EventHandler ItemImageChanged;
Note: See TracChangeset for help on using the changeset viewer.