Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/16/11 00:06:54 (13 years ago)
Author:
cneumuel
Message:

#1233

  • created events when statelog changed
  • fixed memory leak in hiveengine
  • extended timeout for long running transactions and database contexts (when jobdata is stored)
  • replaced random guids in database with sequential guids for performance reasons
  • minor fixes and cleanups
File:
1 edited

Legend:

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

    r6381 r6419  
    196196          //} else if (coll.Parallel) {
    197197          if (coll.Parallel) {
    198             // clone the parent scope here and reuse it for each operation. otherwise for each job the whole scope-tree first needs to be copied and then cleaned, which causes a lot of work for the Garbage Collector
    199             IScope parentScopeClone = (IScope)((IAtomicOperation)coll.First()).Scope.Parent.Clone();
    200             parentScopeClone.SubScopes.Clear();
    201             parentScopeClone.ClearParentScopes();
    202 
    203             EngineJob[] jobs = new EngineJob[coll.Count];
    204             for (int i = 0; i < coll.Count; i++) {
    205               jobs[i] = new EngineJob(coll[i], new SequentialEngine.SequentialEngine());
     198            try {
     199              // clone the parent scope here and reuse it for each operation. otherwise for each job the whole scope-tree first needs to be copied and then cleaned, which causes a lot of work for the Garbage Collector
     200              IScope parentScopeClone = (IScope)((IAtomicOperation)coll.First()).Scope.Parent.Clone();
     201              parentScopeClone.SubScopes.Clear();
     202              parentScopeClone.ClearParentScopes();
     203
     204              EngineJob[] jobs = new EngineJob[coll.Count];
     205              for (int i = 0; i < coll.Count; i++) {
     206                jobs[i] = new EngineJob(coll[i], new SequentialEngine.SequentialEngine());
     207              }
     208
     209              var experiment = CreateHiveExperiment();
     210              IScope[] scopes = ExecuteOnHive(experiment, jobs, parentScopeClone, cancellationToken);
     211
     212              for (int i = 0; i < coll.Count; i++) {
     213                if (coll[i] is IAtomicOperation) {
     214                  ExchangeScope(scopes[i], ((IAtomicOperation)coll[i]).Scope);
     215                } else if (coll[i] is OperationCollection) {
     216                  // todo ??
     217                }
     218              }
    206219            }
    207 
    208             var experiment = CreateHiveExperiment();
    209             IScope[] scopes = ExecuteOnHive(experiment, jobs, parentScopeClone, cancellationToken);
    210             DisposeHiveExperiment(experiment);
    211 
    212             for (int i = 0; i < coll.Count; i++) {
    213               if (coll[i] is IAtomicOperation) {
    214                 ExchangeScope(scopes[i], ((IAtomicOperation)coll[i]).Scope);
    215               } else if (coll[i] is OperationCollection) {
    216                 // todo ??
    217               }
     220            catch {
     221              executionStack.Push(coll); throw;
    218222            }
    219223          } else {
     
    305309
    306310        var failedJobs = hiveExperiment.HiveJobs.Where(x => x.Job.State == JobState.Failed);
    307         if(failedJobs.Count() > 0) {
     311        if (failedJobs.Count() > 0) {
    308312          throw new HiveEngineException("Job failed: " + failedJobs.First().Job.StateLog.Last().Exception);
    309313        }
     
    318322      }
    319323      catch (OperationCanceledException e) {
    320         lock (locker) {
    321           DeleteHiveExperiment(hiveExperiment.Id);
    322         }
    323324        throw e;
    324325      }
    325326      catch (Exception e) {
    326         lock (locker) {
    327           DeleteHiveExperiment(hiveExperiment.Id);
    328         }
    329327        LogException(e);
    330328        throw e;
     329      }
     330      finally {
     331        DisposeHiveExperiment(refreshableHiveExperiment);
    331332      }
    332333    }
Note: See TracChangeset for help on using the changeset viewer.