Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/20/11 11:45:18 (13 years ago)
Author:
gkronber
Message:

#1081 merged r7103:7209 from trunk into time series branch

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  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.Linq;
    2524using HeuristicLab.Common;
    2625using HeuristicLab.Core;
     
    5554      IEnumerable<Type> usedTypes;
    5655
    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);
    6861
    6962      PluginUtil.CollectDeclaringPlugins(plugins, usedTypes);
    70      
    7163      return jobData;
    7264    }
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Clients.Hive/3.3/HiveJobs/HiveTask.cs

    r6994 r7213  
    4040    protected ReaderWriterLockSlim childHiveTasksLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
    4141
     42    public static new Image StaticItemImage {
     43      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     44    }
    4245    public override Image ItemImage {
    4346      get {
     
    5255          else if (task.State == TaskState.Failed) return HeuristicLab.Common.Resources.VSImageLibrary.Error;
    5356          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;
    5558        }
    5659      }
     
    7174          OnItemImageChanged();
    7275        }
    73 
    7476      }
    7577    }
     
    145147
    146148    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      }
    148154    }
    149155
     
    157163
    158164    public HiveTask() {
    159       this.Task = new Task() { CoresNeeded = 1, MemoryNeeded = 0 };
     165      this.Task = new Task() { CoresNeeded = 1, MemoryNeeded = 128 };
    160166      task.State = TaskState.Offline;
    161167      this.childHiveTasks = new ItemList<HiveTask>();
     
    238244    }
    239245
    240     public virtual void AddChildHiveJob(HiveTask hiveJob) {
     246    public virtual void AddChildHiveTask(HiveTask hiveTask) {
    241247      childHiveTasksLock.EnterWriteLock();
    242248      try {
    243         this.childHiveTasks.Add(hiveJob);
     249        this.childHiveTasks.Add(hiveTask);
    244250      }
    245251      finally { childHiveTasksLock.ExitWriteLock(); }
     
    339345      if (e.PropertyName == "State") {
    340346        IsFinishedTaskDownloaded = false;
     347      }
     348      if (e.PropertyName == "Priority" && Task != null) {
     349        foreach (var task in childHiveTasks) {
     350          task.Task.Priority = Task.Priority;
     351        }
    341352      }
    342353    }
     
    456467        try {
    457468          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));
    459470          }
    460471        }
    461472        finally { childHiveTasksLock.ExitReadLock(); }
    462473      } else {
    463         ServiceLocator.Instance.CallHiveService(s => s.PauseTask(this.task.Id));
     474        HiveServiceLocator.Instance.CallHiveService(s => s.PauseTask(this.task.Id));
    464475      }
    465476    }
     
    470481        try {
    471482          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));
    473484          }
    474485        }
    475486        finally { childHiveTasksLock.ExitReadLock(); }
    476487      } else {
    477         ServiceLocator.Instance.CallHiveService(s => s.StopTask(this.task.Id));
     488        HiveServiceLocator.Instance.CallHiveService(s => s.StopTask(this.task.Id));
    478489      }
    479490    }
    480491
    481492    public void Restart() {
    482       ServiceLocator.Instance.CallHiveService(service => {
     493      HiveServiceLocator.Instance.CallHiveService(service => {
    483494        TaskData taskData = new TaskData();
    484495        taskData.TaskId = this.task.Id;
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Clients.Hive/3.3/HiveJobs/OptimizerHiveTask.cs

    r6976 r7213  
    6565            Optimization.Experiment experiment = (Optimization.Experiment)ItemTask.Item;
    6666            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);
    6870            }
    6971          } else if (ItemTask.Item is Optimization.BatchRun) {
     
    7173            if (batchRun.Optimizer != null) {
    7274              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);
    7478              }
    7579              while (this.childHiveTasks.Count > batchRun.Repetitions) {
     
    136140            }
    137141          }
    138         }
    139         finally { childHiveTasksLock.ExitWriteLock(); }
     142        } finally { childHiveTasksLock.ExitWriteLock(); }
    140143      }
    141144    }
     
    152155            }
    153156          }
    154         }
    155         finally { childHiveTasksLock.ExitWriteLock(); }
     157        } finally { childHiveTasksLock.ExitWriteLock(); }
    156158      }
    157159    }
     
    163165            this.childHiveTasks.Remove(this.GetChildByOptimizer(item.Value));
    164166          }
    165         }
    166         finally { childHiveTasksLock.ExitWriteLock(); }
     167        } finally { childHiveTasksLock.ExitWriteLock(); }
    167168      }
    168169    }
     
    174175            this.childHiveTasks.Remove(this.GetChildByOptimizer(item.Value));
    175176          }
    176         }
    177         finally { childHiveTasksLock.ExitWriteLock(); }
     177        } finally { childHiveTasksLock.ExitWriteLock(); }
    178178      }
    179179    }
     
    205205          child.syncTasksWithOptimizers = true;
    206206        }
    207       }
    208       finally { childHiveTasksLock.ExitReadLock(); }
     207      } finally { childHiveTasksLock.ExitReadLock(); }
    209208      syncTasksWithOptimizers = true;
    210209    }
     
    268267          child.SetIndexInParentOptimizerList(this);
    269268        }
    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;
    277275      syncTasksWithOptimizers = false;
    278276      if (this.ItemTask != null && optimizerHiveJob.ItemTask != null) {
     
    339337        }
    340338        return null;
    341       }
    342       finally { childHiveTasksLock.ExitReadLock(); }
     339      } finally { childHiveTasksLock.ExitReadLock(); }
    343340    }
    344341
     
    351348        }
    352349        return null;
    353       }
    354       finally { childHiveTasksLock.ExitReadLock(); }
     350      } finally { childHiveTasksLock.ExitReadLock(); }
    355351    }
    356352
     
    362358      int idx = run.Name.IndexOf("Run ") + 4;
    363359
    364       if (idx == -1 || runs.Count == 0)
     360      if (idx == 3 || runs.Count == 0)
    365361        return run.Name;
    366362
     
    379375    private static int GetRunNumber(string runName) {
    380376      int idx = runName.IndexOf("Run ") + 4;
    381       if (idx == -1) {
     377      if (idx == 3) {
    382378        return 0;
    383379      } else {
Note: See TracChangeset for help on using the changeset viewer.