Changeset 7125


Ignore:
Timestamp:
12/05/11 16:45:27 (8 years ago)
Author:
ascheibe
Message:

#1672

  • removed magic numbers for upload retries
  • speed up job downloading by placing deserializing/downloading semaphores correctly
  • increased max. number of parallel downloads/deserializations
  • added more status messages when downloading to make it more clear what's actually happening
  • renamed some variables
Location:
trunk/sources/HeuristicLab.Clients.Hive/3.3
Files:
7 edited

Legend:

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

    r7115 r7125  
    7878    protected Tuple<Task, TaskData> DownloadTaskData(Task task) {
    7979      downloadSemaphore.WaitOne();
    80       deserializeSemaphore.WaitOne();
    8180      TaskData result;
    8281      try {
     
    9089
    9190    protected Tuple<Task, T> DeserializeTask(Tuple<Task, TaskData> taskData) {
     91      deserializeSemaphore.WaitOne();
    9292      try {
    9393        if (abort || taskData.Item2 == null || taskData.Item1 == null) return null;
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r7059 r7125  
    113113        jobs = null;
    114114        throw;
    115       }
    116       finally {
     115      } finally {
    117116        OnRefreshed();
    118117      }
     
    297296        }
    298297        refreshableJob.Job.Modified = false;
    299       }
    300       finally {
     298      } finally {
    301299        refreshableJob.IsProgressing = false;
    302300      }
     
    362360            }
    363361          }
    364         }, -1, "Failed to upload plugins");
     362        }, Settings.Default.MaxRepeatServiceCalls, "Failed to upload plugins");
    365363        cancellationToken.ThrowIfCancellationRequested();
    366364        hiveTask.Task.PluginsNeededIds.Add(configPluginId);
     
    377375            }
    378376          }
    379         }, 50, "Failed to add task", log);
     377        }, Settings.Default.MaxRepeatServiceCalls, "Failed to add task", log);
    380378        cancellationToken.ThrowIfCancellationRequested();
    381379
     
    400398          if (!ae.InnerExceptions.All(e => e is TaskCanceledException)) throw ae; // for some reason the WaitAll throws a AggregateException containg a TaskCanceledException. i don't know where it comes from, however the tasks all finish properly, so for now just ignore it
    401399        }
    402       }
    403       finally {
     400      } finally {
    404401        if (!semaphoreReleased) taskUploadSemaphore.Release();
    405402      }
     
    423420        totalJobCount = allTasks.Count();
    424421
     422        refreshableJob.Progress.Status = "Downloading tasks...";
    425423        TaskDownloader downloader = new TaskDownloader(allTasks.Select(x => x.Id));
    426424        downloader.StartAsync();
     
    445443        }
    446444
     445        refreshableJob.Progress.Status = "Downloading/deserializing complete. Displaying tasks...";
    447446        // build child-task tree
    448447        foreach (HiveTask hiveTask in refreshableJob.HiveTasks) {
     
    451450
    452451        refreshableJob.OnLoaded();
    453       }
    454       finally {
     452      } finally {
    455453        refreshableJob.IsProgressing = false;
    456454      }
    457455    }
    458456
    459     private static void BuildHiveJobTree(HiveTask parentHiveJob, IEnumerable<LightweightTask> allJobs, IDictionary<Guid, HiveTask> allHiveJobs) {
    460       IEnumerable<LightweightTask> childTasks = from job in allJobs
    461                                                 where job.ParentTaskId.HasValue && job.ParentTaskId.Value == parentHiveJob.Task.Id
     457    private static void BuildHiveJobTree(HiveTask parentHiveTask, IEnumerable<LightweightTask> allTasks, IDictionary<Guid, HiveTask> allHiveTasks) {
     458      IEnumerable<LightweightTask> childTasks = from job in allTasks
     459                                                where job.ParentTaskId.HasValue && job.ParentTaskId.Value == parentHiveTask.Task.Id
    462460                                                orderby job.DateCreated ascending
    463461                                                select job;
    464462      foreach (LightweightTask task in childTasks) {
    465         HiveTask childHiveTask = allHiveJobs[task.Id];
    466         parentHiveJob.AddChildHiveJob(childHiveTask);
    467         BuildHiveJobTree(childHiveTask, allJobs, allHiveJobs);
     463        HiveTask childHiveTask = allHiveTasks[task.Id];
     464        parentHiveTask.AddChildHiveTask(childHiveTask);
     465        BuildHiveJobTree(childHiveTask, allTasks, allHiveTasks);
    468466      }
    469467    }
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveJobs/HiveTask.cs

    r6994 r7125  
    238238    }
    239239
    240     public virtual void AddChildHiveJob(HiveTask hiveJob) {
     240    public virtual void AddChildHiveTask(HiveTask hiveTask) {
    241241      childHiveTasksLock.EnterWriteLock();
    242242      try {
    243         this.childHiveTasks.Add(hiveJob);
     243        this.childHiveTasks.Add(hiveTask);
    244244      }
    245245      finally { childHiveTasksLock.ExitWriteLock(); }
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveJobs/OptimizerHiveTask.cs

    r6976 r7125  
    136136            }
    137137          }
    138         }
    139         finally { childHiveTasksLock.ExitWriteLock(); }
     138        } finally { childHiveTasksLock.ExitWriteLock(); }
    140139      }
    141140    }
     
    152151            }
    153152          }
    154         }
    155         finally { childHiveTasksLock.ExitWriteLock(); }
     153        } finally { childHiveTasksLock.ExitWriteLock(); }
    156154      }
    157155    }
     
    163161            this.childHiveTasks.Remove(this.GetChildByOptimizer(item.Value));
    164162          }
    165         }
    166         finally { childHiveTasksLock.ExitWriteLock(); }
     163        } finally { childHiveTasksLock.ExitWriteLock(); }
    167164      }
    168165    }
     
    174171            this.childHiveTasks.Remove(this.GetChildByOptimizer(item.Value));
    175172          }
    176         }
    177         finally { childHiveTasksLock.ExitWriteLock(); }
     173        } finally { childHiveTasksLock.ExitWriteLock(); }
    178174      }
    179175    }
     
    205201          child.syncTasksWithOptimizers = true;
    206202        }
    207       }
    208       finally { childHiveTasksLock.ExitReadLock(); }
     203      } finally { childHiveTasksLock.ExitReadLock(); }
    209204      syncTasksWithOptimizers = true;
    210205    }
     
    268263          child.SetIndexInParentOptimizerList(this);
    269264        }
    270       }
    271       finally { childHiveTasksLock.ExitReadLock(); }
    272     }
    273 
    274     public override void AddChildHiveJob(HiveTask hiveJob) {
    275       base.AddChildHiveJob(hiveJob);
    276       var optimizerHiveJob = (OptimizerHiveTask)hiveJob;
     265      } finally { childHiveTasksLock.ExitReadLock(); }
     266    }
     267
     268    public override void AddChildHiveTask(HiveTask hiveTask) {
     269      base.AddChildHiveTask(hiveTask);
     270      var optimizerHiveJob = (OptimizerHiveTask)hiveTask;
    277271      syncTasksWithOptimizers = false;
    278272      if (this.ItemTask != null && optimizerHiveJob.ItemTask != null) {
     
    339333        }
    340334        return null;
    341       }
    342       finally { childHiveTasksLock.ExitReadLock(); }
     335      } finally { childHiveTasksLock.ExitReadLock(); }
    343336    }
    344337
     
    351344        }
    352345        return null;
    353       }
    354       finally { childHiveTasksLock.ExitReadLock(); }
     346      } finally { childHiveTasksLock.ExitReadLock(); }
    355347    }
    356348
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/Settings.Designer.cs

    r7020 r7125  
    4444        [global::System.Configuration.ApplicationScopedSettingAttribute()]
    4545        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    46         [global::System.Configuration.DefaultSettingValueAttribute("00:00:10")]
     46        [global::System.Configuration.DefaultSettingValueAttribute("00:00:20")]
    4747        public global::System.TimeSpan ResultPollingInterval {
    4848            get {
     
    5353        [global::System.Configuration.ApplicationScopedSettingAttribute()]
    5454        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    55         [global::System.Configuration.DefaultSettingValueAttribute("2")]
     55        [global::System.Configuration.DefaultSettingValueAttribute("5")]
    5656        public int MaxParallelDownloads {
    5757            get {
     
    5959            }
    6060        }
     61       
     62        [global::System.Configuration.ApplicationScopedSettingAttribute()]
     63        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     64        [global::System.Configuration.DefaultSettingValueAttribute("5")]
     65        public int MaxRepeatServiceCalls {
     66            get {
     67                return ((int)(this["MaxRepeatServiceCalls"]));
     68            }
     69        }
    6170    }
    6271}
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/Settings.settings

    r7020 r7125  
    1010    </Setting>
    1111    <Setting Name="ResultPollingInterval" Type="System.TimeSpan" Scope="Application">
    12       <Value Profile="(Default)">00:00:10</Value>
     12      <Value Profile="(Default)">00:00:20</Value>
    1313    </Setting>
    1414    <Setting Name="MaxParallelDownloads" Type="System.Int32" Scope="Application">
    15       <Value Profile="(Default)">2</Value>
     15      <Value Profile="(Default)">5</Value>
     16    </Setting>
     17    <Setting Name="MaxRepeatServiceCalls" Type="System.Int32" Scope="Application">
     18      <Value Profile="(Default)">5</Value>
    1619    </Setting>
    1720  </Settings>
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/app.config

    r7020 r7125  
    1515      </setting>
    1616      <setting name="ResultPollingInterval" serializeAs="String">
    17         <value>00:00:10</value>
     17        <value>00:00:20</value>
    1818      </setting>
    1919      <setting name="MaxParallelDownloads" serializeAs="String">
    20         <value>2</value>
     20        <value>5</value>
     21      </setting>
     22      <setting name="MaxRepeatServiceCalls" serializeAs="String">
     23        <value>5</value>
    2124      </setting>
    2225    </HeuristicLab.Clients.Hive.Settings>
Note: See TracChangeset for help on using the changeset viewer.