Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4557


Ignore:
Timestamp:
10/05/10 17:00:47 (14 years ago)
Author:
cneumuel
Message:
  • added presentation for heal stammtisch
  • fixed: wrong ExecutionState bug in HiveExperiment
  • fixed: not all results of a batchRun are downloaded
  • fixed: cannot create WindowHandle Exception because nesting level too high (by using ViewHost)
  • fixed: events are not properly routed by OptimizerJob

#1092

Location:
branches/HeuristicLab.Hive
Files:
5 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Calendar/3.3/Properties/AssemblyInfo.cs

    r4425 r4557  
    5858// [assembly: AssemblyVersion("1.0.*")]
    5959[assembly: AssemblyVersion("3.3.0.0")]
    60 [assembly: AssemblyFileVersion("3.3.0.4424")]
     60[assembly: AssemblyFileVersion("3.3.0.4425")]
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/BusinessObjects/JobResult.cs

    r4424 r4557  
    2727namespace HeuristicLab.Hive.Contracts.BusinessObjects {
    2828
    29   // [chn] Where are those JobResults used? would it make sense to use it instead of JobDto for querying Job-Status? Probably yes
    30   // ask gradinger
    3129  [StorableClass]
    3230  [DataContract]
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/HeuristicLab.Hive.Contracts-3.3.csproj

    r4423 r4557  
    167167  </ItemGroup>
    168168  <ItemGroup>
     169    <None Include="Diagrams\Services.cd" />
    169170    <None Include="HeuristicLab.snk" />
    170171    <None Include="Properties\AssemblyInfo.frame" />
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/HiveJobView.Designer.cs

    r4423 r4557  
    5555      this.childHiveJobView = new HeuristicLab.Hive.Experiment.Views.HiveJobListView();
    5656      this.runsTabPage = new System.Windows.Forms.TabPage();
    57       this.runCollectionView = new HeuristicLab.Optimization.Views.RunCollectionView();
    5857      this.logTabPage = new System.Windows.Forms.TabPage();
    5958      this.logView = new HeuristicLab.Core.Views.LogView();
     59      this.runCollectionViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    6060      this.jobStatusGroupBox.SuspendLayout();
    6161      this.tabControl.SuspendLayout();
     
    386386      // runsTabPage
    387387      //
    388       this.runsTabPage.Controls.Add(this.runCollectionView);
     388      this.runsTabPage.Controls.Add(this.runCollectionViewHost);
    389389      this.runsTabPage.Location = new System.Drawing.Point(4, 22);
    390390      this.runsTabPage.Name = "runsTabPage";
     
    393393      this.runsTabPage.Text = "Runs";
    394394      this.runsTabPage.UseVisualStyleBackColor = true;
    395       //
    396       // runCollectionView
    397       //
    398       this.runCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    399                   | System.Windows.Forms.AnchorStyles.Left)
    400                   | System.Windows.Forms.AnchorStyles.Right)));
    401       this.runCollectionView.Caption = "RunCollection View";
    402       this.runCollectionView.Content = null;
    403       this.runCollectionView.Location = new System.Drawing.Point(3, 3);
    404       this.runCollectionView.Name = "runCollectionView";
    405       this.runCollectionView.ReadOnly = false;
    406       this.runCollectionView.Size = new System.Drawing.Size(613, 486);
    407       this.runCollectionView.TabIndex = 0;
    408395      //
    409396      // logTabPage
     
    430417      this.logView.Size = new System.Drawing.Size(613, 486);
    431418      this.logView.TabIndex = 0;
     419      //
     420      // runCollectionViewHost
     421      //
     422      this.runCollectionViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     423                  | System.Windows.Forms.AnchorStyles.Left)
     424                  | System.Windows.Forms.AnchorStyles.Right)));
     425      this.runCollectionViewHost.Caption = "View";
     426      this.runCollectionViewHost.Content = null;
     427      this.runCollectionViewHost.Enabled = false;
     428      this.runCollectionViewHost.Location = new System.Drawing.Point(3, 3);
     429      this.runCollectionViewHost.Name = "runCollectionViewHost";
     430      this.runCollectionViewHost.ReadOnly = false;
     431      this.runCollectionViewHost.Size = new System.Drawing.Size(613, 486);
     432      this.runCollectionViewHost.TabIndex = 0;
     433      this.runCollectionViewHost.ViewType = null;
    432434      //
    433435      // HiveJobView
     
    488490    private Core.Views.NamedItemView optimizerNamedItemView;
    489491    private System.Windows.Forms.TabPage runsTabPage;
    490     private Optimization.Views.RunCollectionView runCollectionView;
     492    private MainForm.WindowsForms.ViewHost runCollectionViewHost;
    491493  }
    492494}
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/HiveJobView.cs

    r4424 r4557  
    8080      if (Content != null && Content.Job != null && Content.Job.Optimizer != null) {
    8181        optimizerNamedItemView.Content = Content.Job.Optimizer;
    82         runCollectionView.Content = Content.Job.Optimizer.Runs;
     82        runCollectionViewHost.Content = Content.Job.Optimizer.Runs;
    8383      } else {
    8484        optimizerNamedItemView.Content = null;
    85         runCollectionView.Content = null;
     85        runCollectionViewHost.Content = null;
    8686      }
    8787    }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/HeuristicLab.Hive.Experiment-3.3.csproj

    r4423 r4557  
    122122    <Compile Include="HiveJob.cs" />
    123123    <Compile Include="HiveJobList.cs" />
     124    <Compile Include="Jobs\JobList.cs" />
     125    <Compile Include="Jobs\OptimizerJob.cs" />
    124126    <Compile Include="Progress\IProgress.cs" />
    125127    <Compile Include="Progress\IProgressReporter.cs" />
    126128    <Compile Include="JobResultPoller.cs" />
    127129    <Compile Include="Exceptions\JobResultPollingException.cs" />
    128     <Compile Include="Jobs\JobList.cs" />
    129130    <Compile Include="HiveClient.cs" />
    130131    <Compile Include="HiveExperimentList.cs" />
    131     <Compile Include="Jobs\OptimizerJob.cs" />
    132132    <Compile Include="HeuristicLabHiveExperimentPlugin.cs" />
    133133    <Compile Include="Exceptions\OptimizerNotFoundException.cs" />
     
    146146      <SubType>Designer</SubType>
    147147    </None>
     148    <None Include="Jobs.cd" />
    148149    <None Include="HeuristicLab.snk" />
    149150    <None Include="Properties\AssemblyInfo.frame" />
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/HiveExperiment.cs

    r4424 r4557  
    556556            this.ExecutionTime = this.HiveJob.JobDto.DateFinished.Value - this.HiveJob.JobDto.DateCreated.Value;
    557557            this.lastUpdateTime = this.HiveJob.JobDto.DateFinished.Value;
     558            this.ExecutionState = Core.ExecutionState.Stopped;
     559            OnStopped();
    558560          } else {
    559561            this.ExecutionTime = DateTime.Now - this.HiveJob.JobDto.DateCreated.Value;
    560562            this.lastUpdateTime = DateTime.Now;
     563            this.ExecutionState = Core.ExecutionState.Started;
     564            OnStarted();
    561565          }
    562566
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/HiveJob.cs

    r4424 r4557  
    180180        if (Job.Optimizer is Optimization.Experiment) {
    181181          Optimization.Experiment experiment = Job.OptimizerAsExperiment;
    182           experiment.Optimizers.ItemsAdded += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<IOptimizer>>(Optimizers_ItemsAdded);
    183           experiment.Optimizers.ItemsReplaced += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced);
    184           experiment.Optimizers.ItemsRemoved += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<IOptimizer>>(Optimizers_ItemsRemoved);
     182          experiment.Optimizers.ItemsAdded += new Collections.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded);
     183          experiment.Optimizers.ItemsReplaced += new Collections.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced);
     184          experiment.Optimizers.ItemsRemoved += new Collections.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsRemoved);
    185185          experiment.Optimizers.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_CollectionReset);
    186186        } else if (Job.Optimizer is Optimization.BatchRun) {
     
    191191
    192192        Job.ComputeInParallelChanged += new EventHandler(Job_ComputeInParallelChanged);
    193       }
    194     }
    195 
    196     void batchRun_AlgorithmChanged(object sender, EventArgs e) {
    197       if (syncJobsWithOptimizers) {
    198         this.childHiveJobs.Clear();
    199         UpdateChildHiveJobs();
    200       }
    201     }
    202 
    203     void batchRun_RepetitionsChanged(object sender, EventArgs e) {
    204       if (syncJobsWithOptimizers) {
    205         UpdateChildHiveJobs();
    206       }
    207     }
    208 
     193        Job.ToStringChanged += new EventHandler(Job_ToStringChanged);
     194      }
     195    }
    209196    private void DergisterOptimizerEvents() {
    210197      if (Job != null && Job.Optimizer is Optimization.Experiment) {
    211198        if (Job.Optimizer is Optimization.Experiment) {
    212199          Optimization.Experiment experiment = Job.OptimizerAsExperiment;
    213           experiment.Optimizers.ItemsAdded -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<IOptimizer>>(Optimizers_ItemsAdded);
    214           experiment.Optimizers.ItemsReplaced -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced);
    215           experiment.Optimizers.ItemsRemoved -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<IOptimizer>>(Optimizers_ItemsRemoved);
     200          experiment.Optimizers.ItemsAdded -= new Collections.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded);
     201          experiment.Optimizers.ItemsReplaced -= new Collections.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced);
     202          experiment.Optimizers.ItemsRemoved -= new Collections.CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsRemoved);
    216203          experiment.Optimizers.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_CollectionReset);
    217204        } else if (Job.Optimizer is Optimization.BatchRun) {
     
    222209
    223210        Job.ComputeInParallelChanged -= new EventHandler(Job_ComputeInParallelChanged);
    224       }
     211        Job.ToStringChanged -= new EventHandler(Job_ToStringChanged);
     212      }
     213    }
     214       
     215    void batchRun_AlgorithmChanged(object sender, EventArgs e) {
     216      if (syncJobsWithOptimizers) {
     217        this.childHiveJobs.Clear();
     218        UpdateChildHiveJobs();
     219      }
     220    }
     221
     222    void batchRun_RepetitionsChanged(object sender, EventArgs e) {
     223      if (syncJobsWithOptimizers) {
     224        UpdateChildHiveJobs();
     225      }
     226    }
     227   
     228    void Job_ToStringChanged(object sender, EventArgs e) {
     229      this.OnToStringChanged();
    225230    }
    226231
     
    294299    public void UpdateChildOptimizer(OptimizerJob optimizerJob, Guid childJobId) {
    295300      syncJobsWithOptimizers = false; // don't sync with optimizers during this method
    296       ExecutionState executionState = optimizerJob.Optimizer.ExecutionState; // has to be stored before adding the optimizers, because of the sideeffects of updating the optimizers in experiment/batchrun
     301      bool childIsFinishedOptimizerDownloaded = false;
    297302
    298303      if (this.Job.Optimizer is Optimization.Experiment) {
    299304        UpdateOptimizerInExperiment(this.Job.OptimizerAsExperiment, optimizerJob);
    300         executionState = ExecutionState.Stopped;
     305        childIsFinishedOptimizerDownloaded = true;
    301306      } else if (this.Job.Optimizer is Optimization.BatchRun) {
    302307        UpdateOptimizerInBatchRun(this.Job.OptimizerAsBatchRun, optimizerJob);
    303         executionState = ExecutionState.Stopped;
    304       }
     308        if (this.Job.OptimizerAsBatchRun.Repetitions == this.Job.Optimizer.Runs.Count) {
     309          childIsFinishedOptimizerDownloaded = true;
     310        }
     311      } else {
     312        childIsFinishedOptimizerDownloaded = optimizerJob.Optimizer.ExecutionState == ExecutionState.Stopped;
     313      }
     314
    305315      HiveJob child = this.ChildHiveJobs.Single(j => j.JobDto.Id == childJobId);
    306316      if (!optimizerJob.ComputeInParallel) {
     
    309319        child.syncJobsWithOptimizers = true;
    310320      }
    311       if (executionState == ExecutionState.Stopped) {
     321      if (childIsFinishedOptimizerDownloaded) {
    312322        child.IsFinishedOptimizerDownloaded = true;
    313323      }
     
    373383    public override string ToString() {
    374384      if (jobDto != null) {
    375         return job.Name;
     385        return job.ToString();
    376386      } else {
    377387        return base.ToString();
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/Jobs/OptimizerJob.cs

    r4424 r4557  
    3737      set {
    3838        if (value != optimizer) {
    39           if (optimizer != null) {
    40             DeregisterEvents();
    41           }
     39          if (optimizer != null) DeregisterEvents();
    4240          optimizer = value;
    43           if (optimizer != null) {
    44             RegisterEvents();
    45           }
     41          if (optimizer != null) RegisterEvents();
    4642          OnOptimizerChanged();
    4743        }
     
    8884    public OptimizerJob(IOptimizer optimizer)
    8985      : this() {
    90       this.optimizer = optimizer;
     86      this.Optimizer = optimizer;
    9187
    9288      if (optimizer is Optimization.Experiment) {
     
    196192    #endregion
    197193
    198     #region Events
     194    #region Optimizer Events
    199195    protected virtual void RegisterEvents() {
    200196      optimizer.Stopped += new EventHandler(optimizer_Stopped);
    201197      optimizer.ExceptionOccurred += new EventHandler<Common.EventArgs<Exception>>(optimizer_ExceptionOccurred);
    202       optimizer.DescriptionChanged += this.DescriptionChanged;
    203       optimizer.FilenameChanged += this.FilenameChanged;
    204       optimizer.ItemImageChanged += this.ItemImageChanged;
    205       optimizer.NameChanged += this.NameChanged;
    206       optimizer.NameChanging += this.NameChanging;
    207       optimizer.ToStringChanged += this.ToStringChanged;
    208     }
    209 
     198      optimizer.DescriptionChanged += new EventHandler(optimizer_DescriptionChanged);
     199      optimizer.ItemImageChanged += new EventHandler(optimizer_ItemImageChanged);
     200      optimizer.NameChanged += new EventHandler(optimizer_NameChanged);
     201      optimizer.NameChanging += new EventHandler<CancelEventArgs<string>>(optimizer_NameChanging);
     202      optimizer.ToStringChanged += new EventHandler(optimizer_ToStringChanged);
     203    }
    210204    protected virtual void DeregisterEvents() {
    211205      optimizer.Stopped -= new EventHandler(optimizer_Stopped);
    212       optimizer.ExceptionOccurred -= new EventHandler<Common.EventArgs<Exception>>(optimizer_ExceptionOccurred);
     206      optimizer.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(optimizer_ExceptionOccurred);
    213207      optimizer.DescriptionChanged -= this.DescriptionChanged;
    214       optimizer.FilenameChanged -= this.FilenameChanged;
    215208      optimizer.ItemImageChanged -= this.ItemImageChanged;
    216209      optimizer.NameChanged -= this.NameChanged;
     
    219212    }
    220213
     214    void optimizer_ToStringChanged(object sender, EventArgs e) {
     215      this.OnToStringChanged();
     216    }
     217
     218    void optimizer_NameChanging(object sender, CancelEventArgs<string> e) {
     219      this.OnNameChanging(e.Value, e.Cancel);
     220    }
     221
     222    void optimizer_NameChanged(object sender, EventArgs e) {
     223      this.OnNameChanged();
     224    }
     225
     226    void optimizer_ItemImageChanged(object sender, EventArgs e) {
     227      this.OnItemImageChanged();
     228    }
     229
     230    void optimizer_DescriptionChanged(object sender, EventArgs e) {
     231      this.OnDescriptionChanged();
     232    }
     233
    221234    protected virtual void optimizer_ExceptionOccurred(object sender, Common.EventArgs<Exception> e) {
    222235      OnJobFailed(e);
     
    227240    }
    228241    #endregion
    229 
    230242
    231243    #region INamedItem Members
     
    243255      set { optimizer.Description = value; }
    244256    }
    245     public event EventHandler DescriptionChanged;
    246257
    247258    public string Name {
     
    249260      set { optimizer.Name = value; }
    250261    }
     262    #endregion
     263
     264    #region Events
     265    public event EventHandler DescriptionChanged;
     266    protected virtual void OnDescriptionChanged() {
     267      var handler = DescriptionChanged;
     268      if(handler != null) handler(this, EventArgs.Empty);
     269    }
     270    public event EventHandler ItemImageChanged;
     271    protected virtual void OnItemImageChanged() {
     272      var handler = ItemImageChanged;
     273      if (handler != null) handler(this, EventArgs.Empty);
     274    }
     275    public event EventHandler ToStringChanged;
     276    protected virtual void OnToStringChanged() {
     277      var handler = ToStringChanged;
     278      if (handler != null) handler(this, EventArgs.Empty);
     279    }
    251280    public event EventHandler NameChanged;
    252     public event EventHandler<Common.CancelEventArgs<string>> NameChanging;
    253 
     281    protected virtual void OnNameChanged() {
     282      var handler = NameChanged;
     283      if (handler != null) handler(this, EventArgs.Empty);
     284    }
     285    public event EventHandler<CancelEventArgs<string>> NameChanging;
     286    protected virtual void OnNameChanging(string value, bool cancel) {
     287      var handler = NameChanging;
     288      if (handler != null) handler(this, new CancelEventArgs<string>(value, cancel));
     289    }
    254290    #endregion
    255291
     
    264300    }
    265301
    266     public event EventHandler ItemImageChanged;
    267302    public string ItemName {
    268303      get { return optimizer.ItemName; }
     
    272307      get { return optimizer.ItemVersion; }
    273308    }
    274     public event EventHandler ToStringChanged;
    275 
    276     #endregion
    277 
    278     #region IStorableContent Members
    279 
    280     public string Filename {
    281       get;
    282       set;
    283     }
    284     public event EventHandler FilenameChanged;
    285309
    286310    #endregion
Note: See TracChangeset for help on using the changeset viewer.