Changeset 4813


Ignore:
Timestamp:
11/16/10 14:48:34 (8 years ago)
Author:
cneumuel
Message:

#1260

  • minor bug fixes.
  • updated to latest trunk
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  
    7272      get { return log; }
    7373    }
    74    
     74
    7575    private string resourceIds;
    7676    public string ResourceIds {
     
    8383      }
    8484    }
    85    
     85
    8686    private bool isPollingResults;
    8787    public bool IsPollingResults {
     
    465465            LogMessage(hj.JobDto.Id, "Downloading optimizer for job");
    466466            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;
    470470            } 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              }
    472477            }
    473478          }
     
    584589        jobCount++;
    585590        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        }
    587598        progress.ProgressValue = (double)jobCount / totalJobCount;
    588599        HiveJob childHiveJob = new HiveJob(optimizerJob, false);
     
    598609      using (Disposable<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
    599610        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        }
    601617      }
    602618    }
  • branches/HeuristicLab.Hive.ExperimentManager/HeuristicLab.Hive.ExperimentManager/3.3/HiveJob.cs

    r4791 r4813  
    3131using HeuristicLab.Optimization;
    3232using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     33using HeuristicLab.PluginInfrastructure.Manager;
     34using HeuristicLab.PluginInfrastructure;
    3335
    3436namespace HeuristicLab.Hive.ExperimentManager {
     
    7981          DergisterOptimizerEvents();
    8082          job = value;
    81           if (job.ExecutionState == ExecutionState.Stopped) {
     83          if (job != null && job.ExecutionState == ExecutionState.Stopped) {
    8284            IsFinishedOptimizerDownloaded = true;
    8385          }
     
    142144      this.syncJobsWithOptimizers = autoCreateChildHiveJobs;
    143145      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      }
    145152      this.syncJobsWithOptimizers = true;
    146153    }
     
    163170    /// </summary>
    164171    private void UpdateChildHiveJobs() {
    165       if (Job != null && syncJobsWithOptimizers) {
     172      if (Job != null && Job.Optimizer != null && syncJobsWithOptimizers) {
    166173        if (Job.Optimizer is Optimization.Experiment) {
    167174          Optimization.Experiment experiment = (Optimization.Experiment)Job.Optimizer;
     
    184191
    185192    private void RegisterOptimizerEvents() {
    186       if (Job != null) {
     193      if (Job != null && Job.Optimizer != null) {
    187194        if (Job.Optimizer is Optimization.Experiment) {
    188195          Optimization.Experiment experiment = Job.OptimizerAsExperiment;
     
    288295      this.childHiveJobs.Add(hiveJob);
    289296      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        }
    296305      }
    297306      syncJobsWithOptimizers = true;
     
    308317      bool childIsFinishedOptimizerDownloaded = false;
    309318
    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);
    316322          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        }
    320331      }
    321332
     
    374385    /// </summary>
    375386    internal void SetIndexInParentOptimizerList(HiveJob parentHiveJob) {
    376       if (parentHiveJob != null) {
     387      if (parentHiveJob != null && parentHiveJob.Job != null && parentHiveJob.Job.Optimizer != null) {
    377388        if (parentHiveJob.Job.Optimizer is Optimization.Experiment) {
    378389          this.Job.IndexInParentOptimizerList = parentHiveJob.Job.OptimizerAsExperiment.Optimizers.IndexOf(this.Job.Optimizer);
     
    389400
    390401    public override string ToString() {
    391       if (jobDto != null) {
     402      if (job != null) {
    392403        return job.ToString();
    393404      } else {
     
    420431    /// </param>
    421432    public SerializedJob GetAsSerializedJob(bool withoutChildOptimizers) {
     433      if (this.job == null || this.job.Optimizer == null)
     434        return null;
     435
    422436      byte[] jobByteArray;
    423437      if (withoutChildOptimizers && this.Job.Optimizer is Optimization.Experiment) {
     
    450464    /// </summary>
    451465    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      }
    453470    }
    454471
Note: See TracChangeset for help on using the changeset viewer.