- Timestamp:
- 03/22/11 15:54:58 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveExperimentClient.cs
r5786 r5793 495 495 jobResultPoller.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobResultPoller_ExceptionOccured); 496 496 jobResultPoller.JobResultsReceived += new EventHandler<EventArgs<IEnumerable<LightweightJob>>>(jobResultPoller_JobResultReceived); 497 jobResultPoller.PollingStarted += new EventHandler(jobResultPoller_PollingStarted);498 jobResultPoller.PollingFinished += new EventHandler(jobResultPoller_PollingFinished);499 497 jobResultPoller.IsPollingChanged += new EventHandler(jobResultPoller_IsPollingChanged); 500 498 } … … 502 500 jobResultPoller.ExceptionOccured -= new EventHandler<EventArgs<Exception>>(jobResultPoller_ExceptionOccured); 503 501 jobResultPoller.JobResultsReceived -= new EventHandler<EventArgs<IEnumerable<LightweightJob>>>(jobResultPoller_JobResultReceived); 504 jobResultPoller.PollingStarted -= new EventHandler(jobResultPoller_PollingStarted);505 jobResultPoller.PollingFinished -= new EventHandler(jobResultPoller_PollingFinished);506 502 jobResultPoller.IsPollingChanged -= new EventHandler(jobResultPoller_IsPollingChanged); 507 503 } 508 504 private void jobResultPoller_IsPollingChanged(object sender, EventArgs e) { 509 505 this.IsPollingResults = jobResultPoller.IsPolling; 510 }511 private void jobResultPoller_PollingFinished(object sender, EventArgs e) {512 LogMessage("Polling results finished");513 }514 private void jobResultPoller_PollingStarted(object sender, EventArgs e) {515 LogMessage("Polling results started");516 506 } 517 507 private void jobResultPoller_JobResultReceived(object sender, EventArgs<IEnumerable<LightweightJob>> e) { … … 527 517 OptimizerJob optimizerJob = LoadOptimizerJob(hj.Job.Id); 528 518 if (optimizerJob == null) { 529 // something bad happened to this job. set to finished to allow the rest beeing downloaded 530 //hj.IsFinishedOptimizerDownloaded = true; 519 // something bad happened to this job. bad job, BAAAD job! 531 520 } else { 532 521 // if the job is paused, download but don't integrate into parent optimizer (to avoid Prepare) 533 522 if (hj.Job.State == JobState.Paused) { 534 523 hj.OptimizerJob = optimizerJob; 535 524 } else { 536 525 if (lightweightJob.ParentJobId.HasValue) { 537 526 HiveJob parentHiveJob = HiveJob.GetHiveJobByJobId(lightweightJob.ParentJobId.Value); 538 527 parentHiveJob.UpdateChildOptimizer(optimizerJob, hj.Job.Id); 539 } else {540 //this.HiveJob.IsFinishedOptimizerDownloaded = true;541 528 } 542 529 } … … 554 541 555 542 private bool AllJobsFinished() { 556 //return HiveJob.GetAllHiveJobs().All(hj => hj.IsFinishedOptimizerDownloaded);557 543 return HiveJob.GetAllHiveJobs().All(j => j.Job.State == JobState.Finished 558 544 || j.Job.State == JobState.Aborted … … 623 609 this.HiveJob = allHiveJobs[this.rootJobId]; 624 610 625 626 //// download them first627 //IDictionary<Guid, Job> allJobs = new Dictionary<Guid, Job>();628 //IDictionary<Guid, JobData> allJobDatas = new Dictionary<Guid, JobData>();629 //foreach (LightweightJob lightweightJob in allResults) {630 // jobCount++;631 // progress.Status = string.Format("Downloading {0} of {1} jobs...", jobCount, totalJobCount);632 // allJobs.Add(lightweightJob.Id, service.GetJob(lightweightJob.Id));633 // allJobDatas.Add(lightweightJob.Id, service.GetJobData(lightweightJob.Id));634 // progress.ProgressValue = (double)jobCount / totalJobCount;635 //}636 637 //jobCount = 1;638 //progress.Status = string.Format("Deserializing {0} of {1} jobs... ({2} kb)", jobCount, totalJobCount, allJobDatas[this.rootJobId].Data.Count() / 1024);639 //this.HiveJob = new HiveJob(allJobs[this.rootJobId], allJobDatas[this.rootJobId], false);640 //allJobDatas.Remove(this.rootJobId); // reduce memory footprint641 //allJobs.Remove(this.rootJobId);642 //progress.ProgressValue = (double)jobCount / totalJobCount;643 644 645 611 if (this.HiveJob.Job.DateFinished.HasValue && this.HiveJob.Job.DateCreated.HasValue) { 646 612 this.ExecutionTime = this.HiveJob.Job.DateFinished.Value - this.HiveJob.Job.DateCreated.Value; … … 656 622 657 623 // build child-job tree 658 //LoadChildResults(service, this.HiveJob, allResults, allJobs, allJobDatas, progress, totalJobCount, ref jobCount);659 624 BuildHiveJobTree(this.HiveJob, allJobs, allHiveJobs); 660 625 StartResultPolling(); … … 739 704 return pluginDatas; 740 705 } 741 742 /// <summary>743 /// Gets the Ids of all plugins needed for executing the job.744 /// All loaded plugins are assumed to be necessary.745 /// If a plugin with the same name and version is already online, it is used. Otherwise the local plugin is uploaded.746 /// If useLocalPlugins is true, all local plugins are uploaded regardless of the existence of the same plugin online.747 /// </summary>748 //public static List<Guid> GetPluginsNeededIds(bool useLocalPlugins) {749 // IEnumerable<IPluginDescription> localPlugins = ApplicationManager.Manager.Plugins;750 // List<Guid> pluginsNeededIds = new List<Guid>();751 752 // using (var service = ServiceLocator.Instance.GetService()) {753 // IEnumerable<Plugin> onlinePlugins = service.Obj.GetPlugins();754 755 // foreach (IPluginDescription localPlugin in localPlugins) {756 // Plugin found = onlinePlugins.Where(onlinePlugin => onlinePlugin.Name == localPlugin.Name && onlinePlugin.Version == localPlugin.Version).SingleOrDefault();757 // if (!useLocalPlugins && found != null) {758 // // plugin is available online; reuse759 // pluginsNeededIds.Add(found.Id);760 // } else {761 // // upload the plugin762 // Plugin p = new Plugin() { Name = localPlugin.Name, Version = localPlugin.Version, IsLocal = useLocalPlugins };763 // List<PluginData> pluginDatas = new List<PluginData>();764 765 // foreach (IPluginFile pf in localPlugin.Files) {766 // PluginData pluginData = new PluginData();767 768 // pluginData.Data = File.ReadAllBytes(pf.Name);769 // pluginDatas.Add(pluginData);770 // }771 // pluginsNeededIds.Add(service.Obj.AddPlugin(p, pluginDatas));772 // }773 // }774 // }775 // return pluginsNeededIds;776 //}777 706 #endregion 778 707 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobClient.cs
r5786 r5793 70 70 public OptimizerJob OptimizerJob { 71 71 get { return optimizerJob; } 72 privateset {72 internal set { 73 73 if (optimizerJob != null && syncJobsWithOptimizers) { 74 74 this.childHiveJobs.Clear(); … … 289 289 syncJobsWithOptimizers = false; 290 290 if (this.OptimizerJob != null && hiveJob.OptimizerJob != null) { 291 // if job is in state Paused, it has to preserve its ResultCollection, which is cleared when a optimizer is added to an experiment 292 OptimizerJob optimizerJobClone = null; 293 if (hiveJob.Job.State == JobState.Paused) { 294 optimizerJobClone = (OptimizerJob)hiveJob.OptimizerJob.Clone(); 295 } 296 291 297 if (this.OptimizerJob.Optimizer is Optimization.Experiment) { 292 298 if (!this.OptimizerJob.OptimizerAsExperiment.Optimizers.Contains(hiveJob.OptimizerJob.Optimizer)) { … … 295 301 } else if (this.OptimizerJob.Optimizer is Optimization.BatchRun) { 296 302 UpdateOptimizerInBatchRun(this.OptimizerJob.OptimizerAsBatchRun, hiveJob.OptimizerJob); 303 } 304 305 if (hiveJob.Job.State == JobState.Paused) { 306 hiveJob.OptimizerJob = optimizerJobClone; 297 307 } 298 308 } … … 524 534 private void OnOptimizerJobChanged() { 525 535 OptimizerJob_ComputeInParallelChanged(this, EventArgs.Empty); 526 var handler = JobChanged;536 var handler = OptimizerJobChanged; 527 537 if (handler != null) handler(this, EventArgs.Empty); 528 538 } … … 649 659 650 660 public void Restart() { 651 ServiceLocator.Instance.CallHiveService(s => s.RestartJob(this.job.Id)); 661 ServiceLocator.Instance.CallHiveService(service => { 662 JobData jobData = new JobData(); 663 jobData.JobId = this.job.Id; 664 jobData.Data = PersistenceUtil.Serialize(this.optimizerJob); 665 service.UpdateJobData(this.Job, jobData); 666 service.RestartJob(this.job.Id); 667 Job job = service.GetJob(this.job.Id); 668 this.job.LastJobDataUpdate = job.LastJobDataUpdate; 669 }); 652 670 } 653 671 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobDownloader.cs
r5599 r5793 88 88 HiveJob hiveJob = new HiveJob(job, jobData, false); 89 89 jobData.Data = null; // reduce memory consumption. 90 hiveJob.OptimizerJob.Prepare(); // reduce memory consumption.91 90 hiveJob.Job = job; 92 91 return hiveJob;
Note: See TracChangeset
for help on using the changeset viewer.