Changeset 4813
- Timestamp:
- 11/16/10 14:48:34 (14 years ago)
- Location:
- branches/HeuristicLab.Hive.ExperimentManager
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.ExperimentManager/HeuristicLab.Hive.ExperimentManager/3.3/HiveExperiment.cs
r4760 r4813 72 72 get { return log; } 73 73 } 74 74 75 75 private string resourceIds; 76 76 public string ResourceIds { … … 83 83 } 84 84 } 85 85 86 86 private bool isPollingResults; 87 87 public bool IsPollingResults { … … 465 465 LogMessage(hj.JobDto.Id, "Downloading optimizer for job"); 466 466 OptimizerJob optimizerJob = LoadOptimizerJob(hj.JobDto.Id); 467 if ( jobResult.ParentJobId.HasValue) {468 HiveJob parentHiveJob = HiveJob.GetHiveJobByJobId(jobResult.ParentJobId.Value);469 parentHiveJob.UpdateChildOptimizer(optimizerJob, hj.JobDto.Id);467 if (optimizerJob == null) { 468 // something bad happened to this job. set to finished to allow the rest beeing downloaded 469 hj.IsFinishedOptimizerDownloaded = true; 470 470 } else { 471 this.HiveJob.IsFinishedOptimizerDownloaded = true; 471 if (jobResult.ParentJobId.HasValue) { 472 HiveJob parentHiveJob = HiveJob.GetHiveJobByJobId(jobResult.ParentJobId.Value); 473 parentHiveJob.UpdateChildOptimizer(optimizerJob, hj.JobDto.Id); 474 } else { 475 this.HiveJob.IsFinishedOptimizerDownloaded = true; 476 } 472 477 } 473 478 } … … 584 589 jobCount++; 585 590 progress.Status = string.Format("Deserializing {0} of {1} jobs ({2} kb)...", jobCount, totalJobCount, allSerializedJobs[jobResult.Id].SerializedJobData.Count() / 1024); 586 OptimizerJob optimizerJob = SerializedJob.Deserialize<OptimizerJob>(allSerializedJobs[jobResult.Id].SerializedJobData); 591 OptimizerJob optimizerJob = null; 592 try { 593 optimizerJob = SerializedJob.Deserialize<OptimizerJob>(allSerializedJobs[jobResult.Id].SerializedJobData); 594 } 595 catch { 596 optimizerJob = null; 597 } 587 598 progress.ProgressValue = (double)jobCount / totalJobCount; 588 599 HiveJob childHiveJob = new HiveJob(optimizerJob, false); … … 598 609 using (Disposable<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) { 599 610 ResponseObject<SerializedJob> serializedJob = service.Obj.GetLastSerializedResult(jobId); 600 return SerializedJob.Deserialize<OptimizerJob>(serializedJob.Obj.SerializedJobData); 611 try { 612 return SerializedJob.Deserialize<OptimizerJob>(serializedJob.Obj.SerializedJobData); 613 } 614 catch { 615 return null; 616 } 601 617 } 602 618 } -
branches/HeuristicLab.Hive.ExperimentManager/HeuristicLab.Hive.ExperimentManager/3.3/HiveJob.cs
r4791 r4813 31 31 using HeuristicLab.Optimization; 32 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 33 using HeuristicLab.PluginInfrastructure.Manager; 34 using HeuristicLab.PluginInfrastructure; 33 35 34 36 namespace HeuristicLab.Hive.ExperimentManager { … … 79 81 DergisterOptimizerEvents(); 80 82 job = value; 81 if (job .ExecutionState == ExecutionState.Stopped) {83 if (job != null && job.ExecutionState == ExecutionState.Stopped) { 82 84 IsFinishedOptimizerDownloaded = true; 83 85 } … … 142 144 this.syncJobsWithOptimizers = autoCreateChildHiveJobs; 143 145 this.JobDto = serializedJob.JobInfo; 144 this.Job = SerializedJob.Deserialize<OptimizerJob>(serializedJob.SerializedJobData); 146 try { 147 this.Job = SerializedJob.Deserialize<OptimizerJob>(serializedJob.SerializedJobData); 148 } 149 catch { 150 this.Job = null; 151 } 145 152 this.syncJobsWithOptimizers = true; 146 153 } … … 163 170 /// </summary> 164 171 private void UpdateChildHiveJobs() { 165 if (Job != null && syncJobsWithOptimizers) {172 if (Job != null && Job.Optimizer != null && syncJobsWithOptimizers) { 166 173 if (Job.Optimizer is Optimization.Experiment) { 167 174 Optimization.Experiment experiment = (Optimization.Experiment)Job.Optimizer; … … 184 191 185 192 private void RegisterOptimizerEvents() { 186 if (Job != null ) {193 if (Job != null && Job.Optimizer != null) { 187 194 if (Job.Optimizer is Optimization.Experiment) { 188 195 Optimization.Experiment experiment = Job.OptimizerAsExperiment; … … 288 295 this.childHiveJobs.Add(hiveJob); 289 296 syncJobsWithOptimizers = false; 290 if (this.Job.Optimizer is Optimization.Experiment) { 291 if (!this.Job.OptimizerAsExperiment.Optimizers.Contains(hiveJob.Job.Optimizer)) { 292 UpdateOptimizerInExperiment(this.Job.OptimizerAsExperiment, hiveJob.Job); 293 } 294 } else if (this.Job.Optimizer is Optimization.BatchRun) { 295 UpdateOptimizerInBatchRun(this.Job.OptimizerAsBatchRun, hiveJob.Job); 297 if (this.Job != null && hiveJob.Job != null) { 298 if (this.Job.Optimizer is Optimization.Experiment) { 299 if (!this.Job.OptimizerAsExperiment.Optimizers.Contains(hiveJob.Job.Optimizer)) { 300 UpdateOptimizerInExperiment(this.Job.OptimizerAsExperiment, hiveJob.Job); 301 } 302 } else if (this.Job.Optimizer is Optimization.BatchRun) { 303 UpdateOptimizerInBatchRun(this.Job.OptimizerAsBatchRun, hiveJob.Job); 304 } 296 305 } 297 306 syncJobsWithOptimizers = true; … … 308 317 bool childIsFinishedOptimizerDownloaded = false; 309 318 310 if (this.Job.Optimizer is Optimization.Experiment) { 311 UpdateOptimizerInExperiment(this.Job.OptimizerAsExperiment, optimizerJob); 312 childIsFinishedOptimizerDownloaded = true; 313 } else if (this.Job.Optimizer is Optimization.BatchRun) { 314 UpdateOptimizerInBatchRun(this.Job.OptimizerAsBatchRun, optimizerJob); 315 if (this.Job.OptimizerAsBatchRun.Repetitions == this.Job.Optimizer.Runs.Count) { 319 if (this.Job != null && this.Job.Optimizer != null) { 320 if (this.Job.Optimizer is Optimization.Experiment) { 321 UpdateOptimizerInExperiment(this.Job.OptimizerAsExperiment, optimizerJob); 316 322 childIsFinishedOptimizerDownloaded = true; 317 } 318 } else { 319 childIsFinishedOptimizerDownloaded = optimizerJob.Optimizer.ExecutionState == ExecutionState.Stopped; 323 } else if (this.Job.Optimizer is Optimization.BatchRun) { 324 UpdateOptimizerInBatchRun(this.Job.OptimizerAsBatchRun, optimizerJob); 325 if (this.Job.OptimizerAsBatchRun.Repetitions == this.Job.Optimizer.Runs.Count) { 326 childIsFinishedOptimizerDownloaded = true; 327 } 328 } else { 329 childIsFinishedOptimizerDownloaded = optimizerJob.Optimizer.ExecutionState == ExecutionState.Stopped; 330 } 320 331 } 321 332 … … 374 385 /// </summary> 375 386 internal void SetIndexInParentOptimizerList(HiveJob parentHiveJob) { 376 if (parentHiveJob != null ) {387 if (parentHiveJob != null && parentHiveJob.Job != null && parentHiveJob.Job.Optimizer != null) { 377 388 if (parentHiveJob.Job.Optimizer is Optimization.Experiment) { 378 389 this.Job.IndexInParentOptimizerList = parentHiveJob.Job.OptimizerAsExperiment.Optimizers.IndexOf(this.Job.Optimizer); … … 389 400 390 401 public override string ToString() { 391 if (job Dto!= null) {402 if (job != null) { 392 403 return job.ToString(); 393 404 } else { … … 420 431 /// </param> 421 432 public SerializedJob GetAsSerializedJob(bool withoutChildOptimizers) { 433 if (this.job == null || this.job.Optimizer == null) 434 return null; 435 422 436 byte[] jobByteArray; 423 437 if (withoutChildOptimizers && this.Job.Optimizer is Optimization.Experiment) { … … 450 464 /// </summary> 451 465 private void UpdateRequiredPlugins() { 452 this.JobDto.PluginsNeeded = HivePluginInfoDto.FindPluginsNeeded(job.GetType()); 466 if (job != null) { 467 //this.JobDto.PluginsNeeded = HivePluginInfoDto.FindPluginsNeeded(job); 468 this.JobDto.PluginsNeeded = ApplicationManager.Manager.Plugins.Select(x => new HivePluginInfoDto { Name = x.Name, Version = x.Version }).ToList(); 469 } 453 470 } 454 471
Note: See TracChangeset
for help on using the changeset viewer.