Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8871


Ignore:
Timestamp:
11/06/12 12:53:58 (10 years ago)
Author:
ascheibe
Message:

#1950

  • fixed a bug where runs were downloaded multiple times
  • fixed a bug where "Refresh automatically" wasn't disabled when the job was finished
  • added a locker around the code that integrates downloaded optimizers as in rare cases collections were modified by multiple threads which lead to an exception
Location:
trunk/sources/HeuristicLab.Clients.Hive/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveTasks/HiveTask.cs

    r7259 r8871  
    334334    private void RegisterJobEvents() {
    335335      if (task != null)
    336         task.PropertyChanged += new PropertyChangedEventHandler(job_PropertyChanged);
     336        task.PropertyChanged += new PropertyChangedEventHandler(task_PropertyChanged);
    337337    }
    338338
    339339    private void DeregisterJobEvents() {
    340340      if (task != null)
    341         task.PropertyChanged += new PropertyChangedEventHandler(job_PropertyChanged);
    342     }
    343 
    344     private void job_PropertyChanged(object sender, PropertyChangedEventArgs e) {
     341        task.PropertyChanged += new PropertyChangedEventHandler(task_PropertyChanged);
     342    }
     343
     344    private void task_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    345345      if (e.PropertyName == "State") {
    346346        IsFinishedTaskDownloaded = false;
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/RefreshableJob.cs

    r8869 r8871  
    3434    private JobResultPoller jobResultPoller;
    3535    private ConcurrentTaskDownloader<ItemTask> jobDownloader;
    36     private static object locker = new object();
     36    private object locker = new object();
     37    private object downloadFinishedLocker = new object();
    3738
    3839    public bool IsProgressing { get; set; }
     
    258259      }
    259260    }
     261
    260262    private void jobResultPoller_JobResultReceived(object sender, EventArgs<IEnumerable<LightweightTask>> e) {
    261263      foreach (LightweightTask lightweightTask in e.Value) {
     
    273275            hiveTask.IsDownloading = true;
    274276            jobDownloader.DownloadTaskData(hiveTask.Task, (localJob, itemJob) => {
    275               log.LogMessage(string.Format("Finished downloading task {0}", localJob.Id));
    276               HiveTask localHiveTask = GetHiveTaskById(localJob.Id);
    277 
    278               if (itemJob == null) {
    279                 localHiveTask.IsDownloading = false;
    280               }
    281 
    282               if (itemJob == null) {
    283                 // something bad happened to this task. bad task, BAAAD task!
    284               } else {
    285                 // if the task is paused, download but don't integrate into parent optimizer (to avoid Prepare)
    286 
    287                 if (localJob.State == TaskState.Paused) {
    288                   localHiveTask.ItemTask = itemJob;
     277              lock (downloadFinishedLocker) {
     278                log.LogMessage(string.Format("Finished downloading task {0}", localJob.Id));
     279                HiveTask localHiveTask = GetHiveTaskById(localJob.Id);
     280
     281                if (itemJob == null) {
     282                  // something bad happened to this task. bad task, BAAAD task!
     283                  localHiveTask.IsDownloading = false;
    289284                } else {
    290                   if (localJob.ParentTaskId.HasValue) {
    291                     HiveTask parentHiveTask = GetHiveTaskById(localJob.ParentTaskId.Value);
    292                     parentHiveTask.IntegrateChild(itemJob, localJob.Id);
     285                  // if the task is paused, download but don't integrate into parent optimizer (to avoid Prepare)
     286                  if (localJob.State == TaskState.Paused) {
     287                    localHiveTask.ItemTask = itemJob;
    293288                  } else {
    294                     localHiveTask.ItemTask = itemJob;
     289                    if (localJob.ParentTaskId.HasValue) {
     290                      HiveTask parentHiveTask = GetHiveTaskById(localJob.ParentTaskId.Value);
     291                      parentHiveTask.IntegrateChild(itemJob, localJob.Id);
     292                    } else {
     293                      localHiveTask.ItemTask = itemJob;
     294                    }
    295295                  }
     296                  localHiveTask.IsDownloading = false;
     297                  localHiveTask.Task.LastTaskDataUpdate = lightweightTask.LastTaskDataUpdate;
    296298                }
    297                 localHiveTask.IsDownloading = false;
    298                 localHiveTask.Task.LastTaskDataUpdate = localJob.LastTaskDataUpdate;
    299299              }
    300300            });
     
    334334                                                   || j.Task.State == TaskState.Aborted
    335335                                                   || j.Task.State == TaskState.Failed)
    336                                                    && j.IsFinishedTaskDownloaded);
     336                                                   && !j.IsDownloading);
    337337    }
    338338
Note: See TracChangeset for help on using the changeset viewer.