- Timestamp:
- 06/16/11 00:06:54 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HiveEngine.cs
r6381 r6419 196 196 //} else if (coll.Parallel) { 197 197 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 } 206 219 } 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; 218 222 } 219 223 } else { … … 305 309 306 310 var failedJobs = hiveExperiment.HiveJobs.Where(x => x.Job.State == JobState.Failed); 307 if (failedJobs.Count() > 0) {311 if (failedJobs.Count() > 0) { 308 312 throw new HiveEngineException("Job failed: " + failedJobs.First().Job.StateLog.Last().Exception); 309 313 } … … 318 322 } 319 323 catch (OperationCanceledException e) { 320 lock (locker) {321 DeleteHiveExperiment(hiveExperiment.Id);322 }323 324 throw e; 324 325 } 325 326 catch (Exception e) { 326 lock (locker) {327 DeleteHiveExperiment(hiveExperiment.Id);328 }329 327 LogException(e); 330 328 throw e; 329 } 330 finally { 331 DisposeHiveExperiment(refreshableHiveExperiment); 331 332 } 332 333 }
Note: See TracChangeset
for help on using the changeset viewer.