Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/11/11 15:32:27 (13 years ago)
Author:
cneumuel
Message:

#1233

  • added GetPlugin service method
  • fixed minor issues with double plugins in database
  • worked on HiveEngine
  • fixed wrong role name for Hive User
  • fixed bug in group assignment of slaves
Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4

    • Property svn:ignore set to
      bin
      obj
      HeuristicLab.HiveEngine-3.4.csproj.vs10x
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/EngineJob.cs

    r5958 r6000  
    3333      this.initialOperation = initialOperation;
    3434      this.engine = engine;
    35       this.engine.Prepare(initialOperation);
    3635      RegisterEngineEvents();
    3736    }
     
    4241      : base(original, cloner) {
    4342      this.engine = cloner.Clone(original.engine);
     43      this.initialOperation = cloner.Clone(original.initialOperation);
    4444      RegisterEngineEvents();
    4545    }
     
    6060
    6161    public override void Start() {
     62      engine.Prepare(initialOperation);
    6263      engine.Start();
    6364    }
    6465   
    6566    public override void Pause() {
    66       throw new NotImplementedException();
     67      engine.Pause();
    6768    }
    6869
     
    8081    }
    8182
    82     void engine_ExceptionOccurred(object sender, EventArgs<Exception> e) {
     83    private void engine_ExceptionOccurred(object sender, EventArgs<Exception> e) {
    8384      OnJobFailed(e);
    8485    }
    8586
    86     void engine_Stopped(object sender, EventArgs e) {
     87    private void engine_Stopped(object sender, EventArgs e) {
    8788      OnJobStopped();
    8889    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HiveEngine.cs

    r5958 r6000  
    4646    }
    4747
    48     private IEnumerable<Plugin> onlinePlugins;
    49     public IEnumerable<Plugin> OnlinePlugins {
     48    private List<Plugin> onlinePlugins;
     49    public List<Plugin> OnlinePlugins {
    5050      get { return onlinePlugins; }
    5151      set { onlinePlugins = value; }
    5252    }
    53    
     53
    5454    private List<Plugin> alreadyUploadedPlugins;
    5555    public List<Plugin> AlreadyUploadedPlugins {
     
    102102      TaskScheduler.UnobservedTaskException += new EventHandler<UnobservedTaskExceptionEventArgs>(TaskScheduler_UnobservedTaskException);
    103103
    104       this.OnlinePlugins = ServiceLocator.Instance.CallHiveService(s => s.GetPlugins());
     104      this.OnlinePlugins = ServiceLocator.Instance.CallHiveService(s => s.GetPlugins()).Where(x => x.IsLocal == false).ToList();
    105105      this.AlreadyUploadedPlugins = new List<Plugin>();
    106106
     
    123123
    124124            IScope[] scopes = ExecuteOnHive(jobs, parentScopeClone, cancellationToken);
    125 
     125            //IScope[] scopes = ExecuteLocally(jobs, parentScopeClone, cancellationToken);
     126           
    126127            for (int i = 0; i < coll.Count; i++) {
    127128              if (coll[i] is IAtomicOperation) {
     
    183184      target.SubScopes.AddRange(source.SubScopes);
    184185      // TODO: validate if parent scopes match - otherwise source is invalid
     186    }
     187
     188    private IScope[] ExecuteLocally(EngineJob[] jobs, IScope parentScopeClone, CancellationToken cancellationToken) {
     189      IScope[] scopes = new Scope[jobs.Length];
     190
     191      for (int i = 0; i < jobs.Length; i++) {
     192        var job = (EngineJob)jobs[i].Clone();
     193        job.Start();
     194        while (job.ExecutionState != ExecutionState.Stopped) {
     195          Thread.Sleep(100);
     196        }
     197        scopes[i] = ((IAtomicOperation)job.InitialOperation).Scope;
     198      }
     199
     200      return scopes;
    185201    }
    186202
     
    444460    /// </summary>
    445461    private static void TryAndRepeat(Action action, int repetitions, string errorMessage) {
    446       while (repetitions > 0) {
    447         try { action(); }
    448         catch (Exception e) {
    449           repetitions--;
    450           if (repetitions == 0) {
    451             throw new HiveEngineException(errorMessage, e);
    452           }
    453         }
    454       }
    455     }
    456 
    457     private static void TryAndRepeat(Action action) {
    458       TryAndRepeat(action, -1, string.Empty);
     462      try { action(); }
     463      catch (Exception e) {
     464        repetitions--;
     465        if (repetitions <= 0)
     466          throw new HiveEngineException(errorMessage, e);
     467        TryAndRepeat(action, repetitions, errorMessage);
     468      }
    459469    }
    460470  }
Note: See TracChangeset for help on using the changeset viewer.