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 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/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.