Changeset 6200 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/RefreshableHiveExperiment.cs
- Timestamp:
- 05/16/11 00:18:48 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/RefreshableHiveExperiment.cs
r6199 r6200 28 28 using HeuristicLab.Core; 29 29 using HeuristicLab.Hive; 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;31 30 32 31 namespace HeuristicLab.Clients.Hive { 33 [StorableClass]34 32 public class RefreshableHiveExperiment : IHiveItem, IDeepCloneable, IContent, IProgressReporter { 35 33 private JobResultPoller jobResultPoller; … … 37 35 private static object locker = new object(); 38 36 39 [Storable]40 37 private HiveExperiment hiveExperiment; 41 38 public HiveExperiment HiveExperiment { … … 55 52 56 53 /** include jobs when refreshing **/ 57 [Storable]58 54 private bool includeJobs; 59 55 public bool IncludeJobs { … … 62 58 } 63 59 64 [Storable]65 60 private bool refreshAutomatically; 66 61 public bool RefreshAutomatically { … … 83 78 } 84 79 85 [Storable]86 80 private bool isControllable = true; 87 81 public bool IsControllable { … … 95 89 } 96 90 97 [Storable]98 91 private ILog log; 99 92 public ILog Log { … … 120 113 cloner.RegisterClonedObject(original, this); 121 114 this.HiveExperiment = original.HiveExperiment; 122 this.RefreshAutomatically = original.RefreshAutomatically;123 115 this.IncludeJobs = original.IncludeJobs; 124 116 this.IsControllable = original.IsControllable; 125 117 this.Log = cloner.Clone(original.Log); 118 this.RefreshAutomatically = false; // do not start results polling automatically 126 119 } 127 120 public IDeepCloneable Clone(Cloner cloner) { … … 196 189 197 190 if (exception != null) { 198 var ex = new ConcurrentJobDownloaderException("Downloading job failed .", exception);191 var ex = new ConcurrentJobDownloaderException("Downloading job failed", exception); 199 192 LogException(ex); 200 193 localHiveJob.IsDownloading = false; … … 206 199 } else { 207 200 // if the job is paused, download but don't integrate into parent optimizer (to avoid Prepare) 208 209 201 210 202 if (localJob.State == JobState.Paused) { … … 231 223 } 232 224 UpdateTotalExecutionTime(); 233 UpdateStat s();225 UpdateStatistics(); 234 226 } 235 227 … … 237 229 private void LogException(Exception exception) { 238 230 lock (logLocker) { 239 log.LogException(exception);231 this.log.LogException(exception); 240 232 } 241 233 } … … 243 235 private void LogMessage(string message) { 244 236 lock (logLocker) { 245 log.LogMessage(message);237 this.log.LogMessage(message); 246 238 } 247 239 } … … 256 248 } 257 249 258 private void UpdateStat s() {250 private void UpdateStatistics() { 259 251 var jobs = hiveExperiment.GetAllHiveJobs(); 260 252 hiveExperiment.JobCount = jobs.Count(); 261 253 hiveExperiment.CalculatingCount = jobs.Count(j => j.Job.State == JobState.Calculating); 262 254 hiveExperiment.FinishedCount = jobs.Count(j => j.Job.State == JobState.Finished); 255 OnJobStatisticsChanged(); 263 256 } 264 257 … … 269 262 && j.IsFinishedJobDownloaded); 270 263 } 271 272 //public bool AllJobsFinishedAndDownloaded() {273 // return this.AllJobsFinished() && hiveExperiment.GetAllHiveJobs().All(j => j.JobItem.;274 //}275 264 276 265 private void jobResultPoller_ExceptionOccured(object sender, EventArgs<Exception> e) { … … 359 348 if (handler != null) handler(this, EventArgs.Empty); 360 349 } 350 351 public event EventHandler JobStatisticsChanged; 352 private void OnJobStatisticsChanged() { 353 var handler = JobStatisticsChanged; 354 if (handler != null) handler(this, EventArgs.Empty); 355 } 361 356 #endregion 362 357
Note: See TracChangeset
for help on using the changeset viewer.