- Timestamp:
- 03/22/11 11:36:53 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveExperimentClient.cs
r5718 r5786 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Configuration; 25 using System.IO; 24 26 using System.Linq; 25 27 using System.Threading; 26 28 using HeuristicLab.Clients.Hive.Jobs; 29 using HeuristicLab.Collections; 27 30 using HeuristicLab.Common; 28 31 using HeuristicLab.Core; 29 32 using HeuristicLab.Optimization; 33 using HeuristicLab.PluginInfrastructure; 30 34 31 35 namespace HeuristicLab.Clients.Hive { 32 using System.Configuration;33 using System.IO;34 using HeuristicLab.Collections;35 using HeuristicLab.PluginInfrastructure;36 37 36 /// <summary> 38 37 /// An experiment which contains multiple batch runs of algorithms. … … 378 377 379 378 #region HiveJob Events 380 void HiveJob_JobStateChanged(object sender, EventArgs e) {379 private void HiveJob_JobStateChanged(object sender, EventArgs e) { 381 380 if (HiveJob != null) { 382 381 rootJobId = HiveJob.Job.Id; … … 520 519 HiveJob hj = hiveJob.GetHiveJobByJobId(lightweightJob.Id); 521 520 if (hj != null) { 521 DateTime lastJobDataUpdate = hj.Job.LastJobDataUpdate; 522 522 hj.UpdateFromLightweightJob(lightweightJob); 523 if ((hj.Job.State == JobState.Aborted || 524 hj.Job.State == JobState.Failed || 525 hj.Job.State == JobState.Finished) && 526 !hj.IsFinishedOptimizerDownloaded) { 523 524 // lastJobDataUpdate equals DateTime.MinValue right after it was uploaded. When the first results are polled, this value is updated 525 if (lastJobDataUpdate != DateTime.MinValue && lastJobDataUpdate < hj.Job.LastJobDataUpdate) { 527 526 LogMessage(hj.Job.Id, "Downloading optimizer for job"); 528 527 OptimizerJob optimizerJob = LoadOptimizerJob(hj.Job.Id); 529 528 if (optimizerJob == null) { 530 529 // something bad happened to this job. set to finished to allow the rest beeing downloaded 531 hj.IsFinishedOptimizerDownloaded = true;530 //hj.IsFinishedOptimizerDownloaded = true; 532 531 } else { 533 if (lightweightJob.ParentJobId.HasValue) {534 HiveJob parentHiveJob = HiveJob.GetHiveJobByJobId(lightweightJob.ParentJobId.Value);535 parentHiveJob.UpdateChildOptimizer(optimizerJob, hj.Job.Id);532 // if the job is paused, download but don't integrate into parent optimizer (to avoid Prepare) 533 if (hj.Job.State == JobState.Paused) { 534 536 535 } else { 537 this.HiveJob.IsFinishedOptimizerDownloaded = true; 536 if (lightweightJob.ParentJobId.HasValue) { 537 HiveJob parentHiveJob = HiveJob.GetHiveJobByJobId(lightweightJob.ParentJobId.Value); 538 parentHiveJob.UpdateChildOptimizer(optimizerJob, hj.Job.Id); 539 } else { 540 //this.HiveJob.IsFinishedOptimizerDownloaded = true; 541 } 538 542 } 539 543 } … … 550 554 551 555 private bool AllJobsFinished() { 552 return HiveJob.GetAllHiveJobs().All(hj => hj.IsFinishedOptimizerDownloaded); 556 //return HiveJob.GetAllHiveJobs().All(hj => hj.IsFinishedOptimizerDownloaded); 557 return HiveJob.GetAllHiveJobs().All(j => j.Job.State == JobState.Finished 558 || j.Job.State == JobState.Aborted 559 || j.Job.State == JobState.Failed); 553 560 } 554 561 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobClient.cs
r5779 r5786 77 77 DergisterOptimizerEvents(); 78 78 optimizerJob = value; 79 if (optimizerJob.ExecutionState == ExecutionState.Stopped) {80 IsFinishedOptimizerDownloaded = true;81 }79 //if (optimizerJob.ExecutionState == ExecutionState.Stopped) { 80 // IsFinishedOptimizerDownloaded = true; 81 //} 82 82 RegisterOptimizerEvents(); 83 83 OnOptimizerJobChanged(); … … 91 91 } 92 92 93 private bool isFinishedOptimizerDownloaded;94 public bool IsFinishedOptimizerDownloaded {95 get { return isFinishedOptimizerDownloaded; }96 set {97 if (isFinishedOptimizerDownloaded != value) {98 isFinishedOptimizerDownloaded = value;99 OnIsFinishedOptimizerDownloadedChanged();100 }101 }102 }93 //private bool isFinishedOptimizerDownloaded; 94 //public bool IsFinishedOptimizerDownloaded { 95 // get { return isFinishedOptimizerDownloaded; } 96 // set { 97 // if (isFinishedOptimizerDownloaded != value) { 98 // isFinishedOptimizerDownloaded = value; 99 // OnIsFinishedOptimizerDownloadedChanged(); 100 // } 101 // } 102 //} 103 103 104 104 private bool syncJobsWithOptimizers = true; … … 331 331 } 332 332 if (childIsFinishedOptimizerDownloaded) { 333 child.IsFinishedOptimizerDownloaded = true;333 //child.IsFinishedOptimizerDownloaded = true; // todo: clean up with childIsFinishedOptimizerDownloaded 334 334 } 335 335 syncJobsWithOptimizers = true; … … 345 345 } 346 346 foreach (IRun run in optimizerJob.Optimizer.Runs) { 347 if (!batchRun.Runs.Contains(run)) 347 if (!batchRun.Runs.Contains(run)) { 348 run.Name = GetNewRunName(run, batchRun.Runs); 348 349 batchRun.Runs.Add(run); 350 } 351 } 352 } 353 354 /// <summary> 355 /// Parses the run numbers out of runs and renames the run to the next number 356 /// </summary> 357 private static string GetNewRunName(IRun run, RunCollection runs) { 358 int idx = run.Name.IndexOf("Run ") + 4; 359 360 if (idx == -1 || runs.Count == 0) 361 return run.Name; 362 363 int maxRunNumber = int.MinValue; 364 foreach (IRun r in runs) { 365 int number = GetRunNumber(r.Name); 366 maxRunNumber = Math.Max(maxRunNumber, number); 367 } 368 369 return run.Name.Substring(0, idx) + (maxRunNumber + 1).ToString(); 370 } 371 372 /// <summary> 373 /// Parses the number of a Run out of its name. Example "Genetic Algorithm Run 3" -> 3 374 /// </summary> 375 private static int GetRunNumber(string runName) { 376 int idx = runName.IndexOf("Run ") + 4; 377 if (idx == -1) { 378 return 0; 379 } else { 380 return int.Parse(runName.Substring(idx, runName.Length - idx)); 349 381 } 350 382 } … … 403 435 if (lightweightJob != null) { 404 436 job.Id = lightweightJob.Id; 405 job. Id = lightweightJob.Id;437 job.ParentJobId = lightweightJob.ParentJobId; 406 438 job.ExecutionTime = lightweightJob.ExecutionTime; 407 439 job.State = lightweightJob.State; 408 440 job.StateLog = new List<StateLog>(lightweightJob.StateLog); 409 // what about parentJob 441 job.Command = lightweightJob.Command; 442 job.LastJobDataUpdate = lightweightJob.LastJobDataUpdate; 443 410 444 OnJobStateChanged(); 411 445 OnToStringChanged(); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveServiceClient.cs
r5779 r5786 94 94 95 95 [System.Runtime.Serialization.OptionalFieldAttribute()] 96 private System.DateTime LastJobDataUpdateField; 97 98 [System.Runtime.Serialization.OptionalFieldAttribute()] 96 99 private System.Nullable<System.Guid> ParentJobIdField; 97 100 … … 132 135 this.ExecutionTimeField = value; 133 136 this.RaisePropertyChanged("ExecutionTime"); 137 } 138 } 139 } 140 141 [System.Runtime.Serialization.DataMemberAttribute()] 142 public System.DateTime LastJobDataUpdate 143 { 144 get 145 { 146 return this.LastJobDataUpdateField; 147 } 148 set 149 { 150 if ((this.LastJobDataUpdateField.Equals(value) != true)) 151 { 152 this.LastJobDataUpdateField = value; 153 this.RaisePropertyChanged("LastJobDataUpdate"); 134 154 } 135 155 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/LightweightJob.cs
r5779 r5786 43 43 this.State = job.State; 44 44 this.Command = job.Command; 45 this.LastJobDataUpdate = job.LastJobDataUpdate; 45 46 } 46 47 … … 52 53 this.State = original.State; 53 54 this.Command = original.Command; 55 this.LastJobDataUpdate = original.LastJobDataUpdate; 54 56 } 55 57 public override IDeepCloneable Clone(Cloner cloner) {
Note: See TracChangeset
for help on using the changeset viewer.