Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/16/11 00:18:48 (13 years ago)
Author:
cneumuel
Message:

#1233

  • stability improvements for HiveEngine
File:
1 edited

Legend:

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

    r6199 r6200  
    2828using HeuristicLab.Core;
    2929using HeuristicLab.Hive;
    30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3130
    3231namespace HeuristicLab.Clients.Hive {
    33   [StorableClass]
    3432  public class RefreshableHiveExperiment : IHiveItem, IDeepCloneable, IContent, IProgressReporter {
    3533    private JobResultPoller jobResultPoller;
     
    3735    private static object locker = new object();
    3836
    39     [Storable]
    4037    private HiveExperiment hiveExperiment;
    4138    public HiveExperiment HiveExperiment {
     
    5552
    5653    /** include jobs when refreshing **/
    57     [Storable]
    5854    private bool includeJobs;
    5955    public bool IncludeJobs {
     
    6258    }
    6359
    64     [Storable]
    6560    private bool refreshAutomatically;
    6661    public bool RefreshAutomatically {
     
    8378    }
    8479
    85     [Storable]
    8680    private bool isControllable = true;
    8781    public bool IsControllable {
     
    9589    }
    9690
    97     [Storable]
    9891    private ILog log;
    9992    public ILog Log {
     
    120113      cloner.RegisterClonedObject(original, this);
    121114      this.HiveExperiment = original.HiveExperiment;
    122       this.RefreshAutomatically = original.RefreshAutomatically;
    123115      this.IncludeJobs = original.IncludeJobs;
    124116      this.IsControllable = original.IsControllable;
    125117      this.Log = cloner.Clone(original.Log);
     118      this.RefreshAutomatically = false; // do not start results polling automatically
    126119    }
    127120    public IDeepCloneable Clone(Cloner cloner) {
     
    196189
    197190              if (exception != null) {
    198                 var ex = new ConcurrentJobDownloaderException("Downloading job failed.", exception);
     191                var ex = new ConcurrentJobDownloaderException("Downloading job failed", exception);
    199192                LogException(ex);
    200193                localHiveJob.IsDownloading = false;
     
    206199              } else {
    207200                // if the job is paused, download but don't integrate into parent optimizer (to avoid Prepare)
    208 
    209201
    210202                if (localJob.State == JobState.Paused) {
     
    231223      }
    232224      UpdateTotalExecutionTime();
    233       UpdateStats();
     225      UpdateStatistics();
    234226    }
    235227
     
    237229    private void LogException(Exception exception) {
    238230      lock (logLocker) {
    239         log.LogException(exception);
     231        this.log.LogException(exception);
    240232      }
    241233    }
     
    243235    private void LogMessage(string message) {
    244236      lock (logLocker) {
    245         log.LogMessage(message);
     237        this.log.LogMessage(message);
    246238      }
    247239    }
     
    256248    }
    257249
    258     private void UpdateStats() {
     250    private void UpdateStatistics() {
    259251      var jobs = hiveExperiment.GetAllHiveJobs();
    260252      hiveExperiment.JobCount = jobs.Count();
    261253      hiveExperiment.CalculatingCount = jobs.Count(j => j.Job.State == JobState.Calculating);
    262254      hiveExperiment.FinishedCount = jobs.Count(j => j.Job.State == JobState.Finished);
     255      OnJobStatisticsChanged();
    263256    }
    264257
     
    269262                                                   && j.IsFinishedJobDownloaded);
    270263    }
    271 
    272     //public bool AllJobsFinishedAndDownloaded() {
    273     //  return this.AllJobsFinished() && hiveExperiment.GetAllHiveJobs().All(j => j.JobItem.;
    274     //}
    275264
    276265    private void jobResultPoller_ExceptionOccured(object sender, EventArgs<Exception> e) {
     
    359348      if (handler != null) handler(this, EventArgs.Empty);
    360349    }
     350
     351    public event EventHandler JobStatisticsChanged;
     352    private void OnJobStatisticsChanged() {
     353      var handler = JobStatisticsChanged;
     354      if (handler != null) handler(this, EventArgs.Empty);
     355    }
    361356    #endregion
    362357
Note: See TracChangeset for help on using the changeset viewer.