Changeset 5363 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager
- Timestamp:
- 01/24/11 10:50:01 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobClient.cs
r5055 r5363 23 23 using System.Collections.Generic; 24 24 using System.Drawing; 25 using System.IO; 25 26 using System.Linq; 27 using HeuristicLab.Clients.Hive.Jobs; 26 28 using HeuristicLab.Collections; 27 29 using HeuristicLab.Common; 28 30 using HeuristicLab.Core; 29 31 using HeuristicLab.Optimization; 30 using HeuristicLab.P ersistence.Default.CompositeSerializers.Storable;32 using HeuristicLab.PluginInfrastructure; 31 33 using HeuristicLab.Services.Hive.Common.DataTransfer; 32 using HeuristicLab.Clients.Hive.Jobs;33 using HeuristicLab.PluginInfrastructure;34 using System.IO;35 using HeuristicLab.PluginInfrastructure.Manager;36 34 37 35 namespace HeuristicLab.Clients.Hive { … … 44 42 get { 45 43 if (job.Id == Guid.Empty) { // not yet uploaded 46 return HeuristicLab.Common.Resources.VS 2008ImageLibrary.Event;44 return HeuristicLab.Common.Resources.VSImageLibrary.Event; 47 45 } else { 48 if (job.JobState == JobState.Waiting) return HeuristicLab.Common.Resources.VS 2008ImageLibrary.ExecutablePrepared;49 else if (job.JobState == JobState.WaitingForChildJobs) return HeuristicLab.Common.Resources.VS 2008ImageLibrary.ExecutablePrepared;50 else if (job.JobState == JobState.Calculating) return HeuristicLab.Common.Resources.VS 2008ImageLibrary.ExecutableStarted;51 else if (job.JobState == JobState.Aborted) return HeuristicLab.Common.Resources.VS 2008ImageLibrary.ExecutableStopped;52 else if (job.JobState == JobState.Failed) return HeuristicLab.Common.Resources.VS 2008ImageLibrary.Error;53 else if (job.JobState == JobState.Finished) return HeuristicLab.Common.Resources.VS 2008ImageLibrary.ExecutableStopped;54 else return HeuristicLab.Common.Resources.VS 2008ImageLibrary.Event;46 if (job.JobState == JobState.Waiting) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePrepared; 47 else if (job.JobState == JobState.WaitingForChildJobs) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePrepared; 48 else if (job.JobState == JobState.Calculating) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStarted; 49 else if (job.JobState == JobState.Aborted) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped; 50 else if (job.JobState == JobState.Failed) return HeuristicLab.Common.Resources.VSImageLibrary.Error; 51 else if (job.JobState == JobState.Finished) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped; 52 else return HeuristicLab.Common.Resources.VSImageLibrary.Event; 55 53 } 56 54 } … … 177 175 } else if (OptimizerJob.Optimizer is Optimization.BatchRun) { 178 176 Optimization.BatchRun batchRun = OptimizerJob.OptimizerAsBatchRun; 179 if (batchRun. Algorithm!= null) {177 if (batchRun.Optimizer != null) { 180 178 while (this.childHiveJobs.Count < batchRun.Repetitions) { 181 this.childHiveJobs.Add(new HiveJob(batchRun. Algorithm));179 this.childHiveJobs.Add(new HiveJob(batchRun.Optimizer)); 182 180 } 183 181 while (this.childHiveJobs.Count > batchRun.Repetitions) { … … 200 198 Optimization.BatchRun batchRun = OptimizerJob.OptimizerAsBatchRun; 201 199 batchRun.RepetitionsChanged += new EventHandler(batchRun_RepetitionsChanged); 202 batchRun. AlgorithmChanged += new EventHandler(batchRun_AlgorithmChanged);200 batchRun.OptimizerChanged += new EventHandler(batchRun_OptimizerChanged); 203 201 } 204 202 OptimizerJob.ComputeInParallelChanged += new EventHandler(OptimizerJob_ComputeInParallelChanged); … … 217 215 Optimization.BatchRun batchRun = OptimizerJob.OptimizerAsBatchRun; 218 216 batchRun.RepetitionsChanged -= new EventHandler(batchRun_RepetitionsChanged); 219 batchRun. AlgorithmChanged -= new EventHandler(batchRun_AlgorithmChanged);217 batchRun.OptimizerChanged -= new EventHandler(batchRun_OptimizerChanged); 220 218 } 221 219 OptimizerJob.ComputeInParallelChanged -= new EventHandler(OptimizerJob_ComputeInParallelChanged); … … 224 222 } 225 223 226 void batchRun_ AlgorithmChanged(object sender, EventArgs e) {224 void batchRun_OptimizerChanged(object sender, EventArgs e) { 227 225 if (syncJobsWithOptimizers) { 228 226 this.childHiveJobs.Clear(); … … 308 306 /// replace the child-optimizer in the experiment 309 307 /// if this.Optimizer is BatchRun 310 /// add the runs from the optimizerJob to the batchrun and replace the algorithm308 /// add the runs from the optimizerJob to the batchrun and replace the Optimizer 311 309 /// </summary> 312 310 public void UpdateChildOptimizer(OptimizerJob optimizerJob, Guid childJobId) { … … 341 339 342 340 /// <summary> 343 /// Adds the runs from the optimizerJob to the batchrun and replaces the algorithm341 /// Adds the runs from the optimizerJob to the batchrun and replaces the Optimizer 344 342 /// Sideeffect: the optimizerJob.Optimizer will be prepared (scopes are deleted and executionstate will be reset) 345 343 /// </summary> 346 344 private void UpdateOptimizerInBatchRun(BatchRun batchRun, OptimizerJob optimizerJob) { 347 if (batchRun. Algorithm== null) {348 batchRun. Algorithm = (IAlgorithm)optimizerJob.Optimizer; // only set the first optimizer as algorithm. if every time the Algorithmwould be set, the runs would be cleared each time345 if (batchRun.Optimizer == null) { 346 batchRun.Optimizer = (IOptimizer)optimizerJob.Optimizer; // only set the first optimizer as Optimizer. if every time the Optimizer would be set, the runs would be cleared each time 349 347 } 350 348 foreach (IRun run in optimizerJob.Optimizer.Runs) { … … 438 436 } else if (withoutChildOptimizers && this.OptimizerJob.Optimizer is Optimization.BatchRun) { 439 437 OptimizerJob clonedJob = (OptimizerJob)this.OptimizerJob.Clone(); 440 clonedJob.OptimizerAsBatchRun. Algorithm= null;438 clonedJob.OptimizerAsBatchRun.Optimizer = null; 441 439 jobByteArray = PersistenceUtil.Serialize(clonedJob); 442 440 } else if (this.OptimizerJob.Optimizer is IAlgorithm) { … … 462 460 private void UpdateRequiredPlugins() { 463 461 List<Guid> pluginList = new List<Guid>(); 464 462 465 463 IEnumerable<IPluginDescription> neededPlugins = ApplicationManager.Manager.Plugins; //HivePluginInfoDto.FindPluginsNeeded(optimizerJob.GetType()); 466 464 using (var service = ServiceLocator.Instance.GetService()) { … … 481 479 } 482 480 pluginList.Add(service.Obj.AddPlugin(p, pluginDatas)); 483 } 481 } 484 482 } 485 483 }
Note: See TracChangeset
for help on using the changeset viewer.