- Timestamp:
- 03/16/11 17:02:15 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveExperimentClient.cs
r5675 r5718 28 28 using HeuristicLab.Core; 29 29 using HeuristicLab.Optimization; 30 using HeuristicLab.Tracing;31 30 32 31 namespace HeuristicLab.Clients.Hive { … … 298 297 string configFilePath = ConfigurationManager.OpenExeConfiguration(exeFilePath).FilePath; 299 298 300 301 299 Plugin configPlugin = new Plugin() { 302 300 Name = "Configuration", … … 343 341 this.progress.ProgressValue = (double)jobCount / totalJobCount; 344 342 345 hiveJob.Job.SetState(JobState.Transferring); 343 //service.UpdateJobState(hiveJob.Job.Id, JobState.Transferring, null, null, null); 344 346 345 if (parentHiveJob != null) { 347 346 hiveJob.Job.Id = service.AddChildJob(parentHiveJob.Job.Id, hiveJob.Job, jobData); … … 349 348 hiveJob.Job.Id = service.AddJob(hiveJob.Job, jobData, groups.ToList()); 350 349 } 351 352 350 LogMessage(hiveJob.Job.Id, "Job sent to Hive"); 353 351 … … 579 577 lock (locker) { 580 578 log.LogMessage(message); 581 Logger.Debug(message);582 579 } 583 580 } … … 639 636 640 637 641 if (this.HiveJob.Job.DateFinished.HasValue ) {642 this.ExecutionTime = this.HiveJob.Job.DateFinished.Value - this.HiveJob.Job.DateCreated ;638 if (this.HiveJob.Job.DateFinished.HasValue && this.HiveJob.Job.DateCreated.HasValue) { 639 this.ExecutionTime = this.HiveJob.Job.DateFinished.Value - this.HiveJob.Job.DateCreated.Value; 643 640 this.lastUpdateTime = this.HiveJob.Job.DateFinished.Value; 644 641 this.ExecutionState = Core.ExecutionState.Stopped; 645 642 OnStopped(); 646 643 } else { 647 this.ExecutionTime = DateTime.Now - this.HiveJob.Job.DateCreated;644 this.ExecutionTime = this.HiveJob.Job.DateCreated.HasValue ? DateTime.Now - this.HiveJob.Job.DateCreated.Value : TimeSpan.Zero; 648 645 this.lastUpdateTime = DateTime.Now; 649 646 this.ExecutionState = Core.ExecutionState.Started; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobClient.cs
r5675 r5718 108 108 MemoryNeeded = 0 109 109 }; 110 job.S etState(JobState.Offline);110 job.State = JobState.Offline; 111 111 this.childHiveJobs = new ItemList<HiveJob>(); 112 112 syncJobsWithOptimizers = true; … … 157 157 private void UpdateChildHiveJobs() { 158 158 if (Job != null && syncJobsWithOptimizers) { 159 if (OptimizerJob.Optimizer is Optimization.Experiment) { 160 Optimization.Experiment experiment = (Optimization.Experiment)OptimizerJob.Optimizer; 161 foreach (IOptimizer childOpt in experiment.Optimizers) { 162 this.childHiveJobs.Add(new HiveJob(childOpt)); 163 } 164 } else if (OptimizerJob.Optimizer is Optimization.BatchRun) { 165 Optimization.BatchRun batchRun = OptimizerJob.OptimizerAsBatchRun; 166 if (batchRun.Optimizer != null) { 167 while (this.childHiveJobs.Count < batchRun.Repetitions) { 168 this.childHiveJobs.Add(new HiveJob(batchRun.Optimizer)); 159 if (!OptimizerJob.ComputeInParallel) { 160 this.childHiveJobs.Clear(); 161 } else { 162 if (OptimizerJob.Optimizer is Optimization.Experiment) { 163 Optimization.Experiment experiment = (Optimization.Experiment)OptimizerJob.Optimizer; 164 foreach (IOptimizer childOpt in experiment.Optimizers) { 165 this.childHiveJobs.Add(new HiveJob(childOpt)); 169 166 } 170 while (this.childHiveJobs.Count > batchRun.Repetitions) { 171 this.childHiveJobs.Remove(this.childHiveJobs.Last()); 167 } else if (OptimizerJob.Optimizer is Optimization.BatchRun) { 168 Optimization.BatchRun batchRun = OptimizerJob.OptimizerAsBatchRun; 169 if (batchRun.Optimizer != null) { 170 while (this.childHiveJobs.Count < batchRun.Repetitions) { 171 this.childHiveJobs.Add(new HiveJob(batchRun.Optimizer)); 172 } 173 while (this.childHiveJobs.Count > batchRun.Repetitions) { 174 this.childHiveJobs.Remove(this.childHiveJobs.Last()); 175 } 172 176 } 173 177 } … … 224 228 private void batchRun_OptimizerChanged(object sender, EventArgs e) { 225 229 if (syncJobsWithOptimizers) { 226 this.childHiveJobs.Clear();227 230 UpdateChildHiveJobs(); 228 231 } … … 277 280 private void OptimizerJob_ComputeInParallelChanged(object sender, EventArgs e) { 278 281 if (OptimizerJob != null && syncJobsWithOptimizers) { 279 if (OptimizerJob.ComputeInParallel) { 280 // child-hive jobs are not yet created, so create them according to the child-optimizers 281 this.UpdateChildHiveJobs(); 282 } else { 283 // child-hive jobs need to be deleted 284 this.childHiveJobs.Clear(); 285 } 282 this.UpdateChildHiveJobs(); 286 283 } 287 284 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj
r5638 r5718 96 96 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> 97 97 <HintPath>..\..\..\..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 98 </Reference>99 <Reference Include="HeuristicLab.Tracing-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">100 <SpecificVersion>False</SpecificVersion>101 <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Tracing-3.3.dll</HintPath>102 98 </Reference> 103 99 <Reference Include="System" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveItem.cs
r5676 r5718 30 30 public partial class HiveItem : IItem { 31 31 32 public HiveItem() { 33 } 34 32 public HiveItem() { } 35 33 36 34 protected HiveItem(HiveItem original, Cloner cloner) { 35 cloner.RegisterClonedObject(original, this); 37 36 this.Id = original.Id; 38 37 } 39 38 40 public IDeepCloneable Clone(Cloner cloner) {39 public virtual IDeepCloneable Clone(Cloner cloner) { 41 40 return new HiveItem(this, cloner); 42 41 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/Job.cs
r5614 r5718 30 30 public Job() { } 31 31 32 public void SetState(JobState state) {33 this.State = state;34 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now });35 }36 37 public void SetState(JobState state, Guid userId) {38 this.State = state;39 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, UserId = userId });40 }41 42 public void SetState(JobState state, Guid slaveId, string exception) {43 this.State = state;44 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, SlaveId = slaveId, Exception = exception });45 }46 47 32 protected Job(Job original, Cloner cloner) { 48 33 this.Priority = original.Priority; … … 60 45 } 61 46 62 public IDeepCloneable Clone(Cloner cloner) {47 public override IDeepCloneable Clone(Cloner cloner) { 63 48 return new Job(this, cloner); 64 49 } 65 50 66 public object Clone() {67 return Clone(new Cloner());68 }69 70 51 public override string ToString() { 71 return string.Format("State: {0}, SlaveId: {1}, DateCreated: {2}, DateCalculated: {3}, CoresNeeded: {4}, MemoryNeeded: {5}", State, CurrentStateLog.SlaveId, DateCreated , CoresNeeded, MemoryNeeded);52 return string.Format("State: {0}, SlaveId: {1}, DateCreated: {2}, DateCalculated: {3}, CoresNeeded: {4}, MemoryNeeded: {5}", State, CurrentStateLog.SlaveId, DateCreated.HasValue ? DateCreated.ToString() : "-", CoresNeeded, MemoryNeeded); 72 53 } 73 54 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/LightweightJob.cs
r5614 r5718 28 28 29 29 public partial class LightweightJob : IDeepCloneable, IContent { 30 public StateLog CurrentStateLog { get { return StateLog.LastOrDefault(); } } 31 public DateTime? DateCreated { get { return StateLog.Count > 0 ? new DateTime?(StateLog.First().DateTime) : null; } } 32 public DateTime? DateFinished { get { return (StateLog.Count > 0 && CurrentStateLog.State == JobState.Finished) ? new DateTime?(CurrentStateLog.DateTime) : null; } } 30 33 31 34 public LightweightJob() { … … 48 51 this.Id = original.Id; 49 52 } 50 public IDeepCloneable Clone(Cloner cloner) {53 public override IDeepCloneable Clone(Cloner cloner) { 51 54 return new LightweightJob(this, cloner); 52 }53 54 public object Clone() {55 return Clone(new Cloner());56 }57 58 public StateLog CurrentStateLog { get { return StateLog.Last(); } }59 public DateTime DateCreated { get { return StateLog.First().DateTime; } }60 public DateTime? DateFinished { get { return CurrentStateLog.State == JobState.Finished ? new DateTime?(CurrentStateLog.DateTime) : null; } }61 62 public void SetState(JobState state) {63 this.State = state;64 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now });65 }66 67 public void SetState(JobState state, Guid userId) {68 this.State = state;69 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, UserId = userId });70 }71 72 public void SetState(JobState state, Guid slaveId, string exception) {73 this.State = state;74 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, SlaveId = slaveId, Exception = exception });75 55 } 76 56 }
Note: See TracChangeset
for help on using the changeset viewer.