- Timestamp:
- 12/20/11 11:45:18 (13 years ago)
- Location:
- branches/HeuristicLab.TimeSeries
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Clients.Hive/3.3/HiveJobs/EngineHiveTask.cs
r6976 r7213 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq;25 24 using HeuristicLab.Common; 26 25 using HeuristicLab.Core; … … 55 54 IEnumerable<Type> usedTypes; 56 55 57 // clone operation and remove unnecessary scopes; don't do this earlier to avoid memory problems 58 //lock (locker) { 59 ((IAtomicOperation)ItemTask.InitialOperation).Scope.Parent = parentScopeClone; 60 ItemTask.InitialOperation = (IOperation)ItemTask.InitialOperation.Clone(); 61 ((IAtomicOperation)ItemTask.InitialOperation).Scope.ClearParentScopes(); 62 jobData.Data = PersistenceUtil.Serialize(ItemTask, out usedTypes); 63 //} 64 65 // add type objects from object graph to work around ticket #1527 66 var typeObjects = ItemTask.GetObjectGraphObjects().OfType<Type>(); 67 usedTypes = new List<Type>(usedTypes).Union(typeObjects); 56 // clone operation and remove unnecessary scopes; don't do this earlier to avoid memory problems 57 ((IAtomicOperation)ItemTask.InitialOperation).Scope.Parent = parentScopeClone; 58 ItemTask.InitialOperation = (IOperation)ItemTask.InitialOperation.Clone(); 59 ((IAtomicOperation)ItemTask.InitialOperation).Scope.ClearParentScopes(); 60 jobData.Data = PersistenceUtil.Serialize(ItemTask, out usedTypes); 68 61 69 62 PluginUtil.CollectDeclaringPlugins(plugins, usedTypes); 70 71 63 return jobData; 72 64 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Clients.Hive/3.3/HiveJobs/HiveTask.cs
r6994 r7213 40 40 protected ReaderWriterLockSlim childHiveTasksLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); 41 41 42 public static new Image StaticItemImage { 43 get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; } 44 } 42 45 public override Image ItemImage { 43 46 get { … … 52 55 else if (task.State == TaskState.Failed) return HeuristicLab.Common.Resources.VSImageLibrary.Error; 53 56 else if (task.State == TaskState.Finished) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped; 54 else return HeuristicLab.Common.Resources.VSImageLibrary.Event;57 else return base.ItemImage; 55 58 } 56 59 } … … 71 74 OnItemImageChanged(); 72 75 } 73 74 76 } 75 77 } … … 145 147 146 148 public StateLogList StateLog { 147 get { return new StateLogList(this.task.StateLog); } 149 get { 150 var list = new StateLogList(this.task.StateLog); 151 list.ForEach(s => { s.TaskName = itemTask.Name; }); 152 return list; 153 } 148 154 } 149 155 … … 157 163 158 164 public HiveTask() { 159 this.Task = new Task() { CoresNeeded = 1, MemoryNeeded = 0};165 this.Task = new Task() { CoresNeeded = 1, MemoryNeeded = 128 }; 160 166 task.State = TaskState.Offline; 161 167 this.childHiveTasks = new ItemList<HiveTask>(); … … 238 244 } 239 245 240 public virtual void AddChildHive Job(HiveTask hiveJob) {246 public virtual void AddChildHiveTask(HiveTask hiveTask) { 241 247 childHiveTasksLock.EnterWriteLock(); 242 248 try { 243 this.childHiveTasks.Add(hive Job);249 this.childHiveTasks.Add(hiveTask); 244 250 } 245 251 finally { childHiveTasksLock.ExitWriteLock(); } … … 339 345 if (e.PropertyName == "State") { 340 346 IsFinishedTaskDownloaded = false; 347 } 348 if (e.PropertyName == "Priority" && Task != null) { 349 foreach (var task in childHiveTasks) { 350 task.Task.Priority = Task.Priority; 351 } 341 352 } 342 353 } … … 456 467 try { 457 468 foreach (var child in childHiveTasks) { 458 ServiceLocator.Instance.CallHiveService(s => s.PauseTask(child.task.Id));469 HiveServiceLocator.Instance.CallHiveService(s => s.PauseTask(child.task.Id)); 459 470 } 460 471 } 461 472 finally { childHiveTasksLock.ExitReadLock(); } 462 473 } else { 463 ServiceLocator.Instance.CallHiveService(s => s.PauseTask(this.task.Id));474 HiveServiceLocator.Instance.CallHiveService(s => s.PauseTask(this.task.Id)); 464 475 } 465 476 } … … 470 481 try { 471 482 foreach (var child in childHiveTasks) { 472 ServiceLocator.Instance.CallHiveService(s => s.StopTask(child.task.Id));483 HiveServiceLocator.Instance.CallHiveService(s => s.StopTask(child.task.Id)); 473 484 } 474 485 } 475 486 finally { childHiveTasksLock.ExitReadLock(); } 476 487 } else { 477 ServiceLocator.Instance.CallHiveService(s => s.StopTask(this.task.Id));488 HiveServiceLocator.Instance.CallHiveService(s => s.StopTask(this.task.Id)); 478 489 } 479 490 } 480 491 481 492 public void Restart() { 482 ServiceLocator.Instance.CallHiveService(service => {493 HiveServiceLocator.Instance.CallHiveService(service => { 483 494 TaskData taskData = new TaskData(); 484 495 taskData.TaskId = this.task.Id; -
branches/HeuristicLab.TimeSeries/HeuristicLab.Clients.Hive/3.3/HiveJobs/OptimizerHiveTask.cs
r6976 r7213 65 65 Optimization.Experiment experiment = (Optimization.Experiment)ItemTask.Item; 66 66 foreach (IOptimizer childOpt in experiment.Optimizers) { 67 this.childHiveTasks.Add(new OptimizerHiveTask(childOpt)); 67 var optimizerHiveTask = new OptimizerHiveTask(childOpt); 68 optimizerHiveTask.Task.Priority = Task.Priority; //inherit priority from parent 69 this.childHiveTasks.Add(optimizerHiveTask); 68 70 } 69 71 } else if (ItemTask.Item is Optimization.BatchRun) { … … 71 73 if (batchRun.Optimizer != null) { 72 74 while (this.childHiveTasks.Count < batchRun.Repetitions) { 73 this.childHiveTasks.Add(new OptimizerHiveTask(batchRun.Optimizer)); 75 var optimizerHiveTask = new OptimizerHiveTask(batchRun.Optimizer); 76 optimizerHiveTask.Task.Priority = Task.Priority; 77 this.childHiveTasks.Add(optimizerHiveTask); 74 78 } 75 79 while (this.childHiveTasks.Count > batchRun.Repetitions) { … … 136 140 } 137 141 } 138 } 139 finally { childHiveTasksLock.ExitWriteLock(); } 142 } finally { childHiveTasksLock.ExitWriteLock(); } 140 143 } 141 144 } … … 152 155 } 153 156 } 154 } 155 finally { childHiveTasksLock.ExitWriteLock(); } 157 } finally { childHiveTasksLock.ExitWriteLock(); } 156 158 } 157 159 } … … 163 165 this.childHiveTasks.Remove(this.GetChildByOptimizer(item.Value)); 164 166 } 165 } 166 finally { childHiveTasksLock.ExitWriteLock(); } 167 } finally { childHiveTasksLock.ExitWriteLock(); } 167 168 } 168 169 } … … 174 175 this.childHiveTasks.Remove(this.GetChildByOptimizer(item.Value)); 175 176 } 176 } 177 finally { childHiveTasksLock.ExitWriteLock(); } 177 } finally { childHiveTasksLock.ExitWriteLock(); } 178 178 } 179 179 } … … 205 205 child.syncTasksWithOptimizers = true; 206 206 } 207 } 208 finally { childHiveTasksLock.ExitReadLock(); } 207 } finally { childHiveTasksLock.ExitReadLock(); } 209 208 syncTasksWithOptimizers = true; 210 209 } … … 268 267 child.SetIndexInParentOptimizerList(this); 269 268 } 270 } 271 finally { childHiveTasksLock.ExitReadLock(); } 272 } 273 274 public override void AddChildHiveJob(HiveTask hiveJob) { 275 base.AddChildHiveJob(hiveJob); 276 var optimizerHiveJob = (OptimizerHiveTask)hiveJob; 269 } finally { childHiveTasksLock.ExitReadLock(); } 270 } 271 272 public override void AddChildHiveTask(HiveTask hiveTask) { 273 base.AddChildHiveTask(hiveTask); 274 var optimizerHiveJob = (OptimizerHiveTask)hiveTask; 277 275 syncTasksWithOptimizers = false; 278 276 if (this.ItemTask != null && optimizerHiveJob.ItemTask != null) { … … 339 337 } 340 338 return null; 341 } 342 finally { childHiveTasksLock.ExitReadLock(); } 339 } finally { childHiveTasksLock.ExitReadLock(); } 343 340 } 344 341 … … 351 348 } 352 349 return null; 353 } 354 finally { childHiveTasksLock.ExitReadLock(); } 350 } finally { childHiveTasksLock.ExitReadLock(); } 355 351 } 356 352 … … 362 358 int idx = run.Name.IndexOf("Run ") + 4; 363 359 364 if (idx == -1|| runs.Count == 0)360 if (idx == 3 || runs.Count == 0) 365 361 return run.Name; 366 362 … … 379 375 private static int GetRunNumber(string runName) { 380 376 int idx = runName.IndexOf("Run ") + 4; 381 if (idx == -1) {377 if (idx == 3) { 382 378 return 0; 383 379 } else {
Note: See TracChangeset
for help on using the changeset viewer.