Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/10/11 17:58:59 (13 years ago)
Author:
cneumuel
Message:

#1233

  • added semaphores to ensure an appdomain is never unloaded when the start method has not finished
  • HiveEngine uploading and downloading of jobs works and is displayed in the view
File:
1 edited

Legend:

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

    r6168 r6178  
    3434  public class RefreshableHiveExperiment : IHiveItem, IDeepCloneable, IContent, IProgressReporter {
    3535    private JobResultPoller jobResultPoller;
    36     private JobDownloader<ItemJob> jobDownloader = new JobDownloader<ItemJob>(2, 2);
     36    private ConcurrentJobDownloader<ItemJob> jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2);
    3737    private static object locker = new object();
    3838
     
    8383    }
    8484
     85    [Storable]
     86    private bool isControllable = true;
     87    public bool IsControllable {
     88      get { return isControllable; }
     89      set {
     90        if (value != isControllable) {
     91          isControllable = value;
     92          OnIsControllableChanged();
     93        }
     94      }
     95    }
     96
    8597    #region Constructors and Cloning
    8698    public RefreshableHiveExperiment() {
     
    99111      this.RefreshAutomatically = original.RefreshAutomatically;
    100112      this.IncludeJobs = original.IncludeJobs;
     113      this.IsControllable = original.IsControllable;
    101114    }
    102115    public IDeepCloneable Clone(Cloner cloner) {
     
    163176            jobDownloader.DownloadJob(hj.Job.Id, (id, itemJob, exception) => {
    164177              if (exception != null) {
    165                 throw new JobDownloaderException("Downloading job failed.", exception);
     178                throw new ConcurrentJobDownloaderException("Downloading job failed.", exception);
    166179              }
    167180
     
    171184                // if the job is paused, download but don't integrate into parent optimizer (to avoid Prepare)
    172185                if (hj.Job.State == JobState.Paused) {
    173                   hj.JobItem = itemJob;
     186                  hj.ItemJob = itemJob;
    174187                } else {
    175188                  if (lightweightJob.ParentJobId.HasValue) {
     
    177190                    parentHiveJob.IntegrateChild(itemJob, hj.Job.Id);
    178191                  } else {
    179                     hj.JobItem = itemJob;
     192                    hj.ItemJob = itemJob;
    180193                  }
    181194                }
     
    211224
    212225    public bool AllJobsFinished() {
    213       return hiveExperiment.GetAllHiveJobs().All(j => j.Job.State == JobState.Finished
    214                                             || j.Job.State == JobState.Aborted
    215                                             || j.Job.State == JobState.Failed);
     226      return hiveExperiment.GetAllHiveJobs().All(j => (j.Job.State == JobState.Finished
     227                                                   || j.Job.State == JobState.Aborted
     228                                                   || j.Job.State == JobState.Failed)
     229                                                   && j.ItemJobDownloaded);
    216230    }
    217231
     
    299313      if (handler != null) handler(sender, e);
    300314    }
     315
     316    public event EventHandler IsControllableChanged;
     317    private void OnIsControllableChanged() {
     318      var handler = IsControllableChanged;
     319      if (handler != null) handler(this, EventArgs.Empty);
     320    }
    301321    #endregion
    302322
Note: See TracChangeset for help on using the changeset viewer.