- Timestamp:
- 06/02/08 10:32:04 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.DistributedEngine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DistributedEngine/DistributedEngine.cs
r268 r281 99 99 // 4) for each parallel job attach only the sub-scope that this operation uses 100 100 // 5) after starting all parallel jobs restore the whole scope-tree 101 IScope parentScope = FindParentScope(GlobalScope, compositeOperation);101 IScope parentScope = FindParentScope(GlobalScope, ((AtomicOperation)compositeOperation.Operations[0]).Scope); 102 102 List<IList<IScope>> prunedScopes = new List<IList<IScope>>(); 103 103 PruneToParentScope(GlobalScope, parentScope, prunedScopes); … … 130 130 // retrieve results and merge into scope-tree 131 131 foreach(AtomicOperation parOperation in compositeOperation.Operations) { 132 IScope result = jobManager.EndExecuteOperation(parOperation); 133 MergeScope(parOperation.Scope, result); 132 ProcessingEngine resultEngine = jobManager.EndExecuteOperation(parOperation); 133 if(resultEngine.ExecutionStack.Count > 0) { 134 // when there are operations left in the execution stack it means that the engine has been aborted 135 // for unkown reason. Probably there was a problem at the client, so we can try to execute the steps locally. 136 // If they also fail the (local) distributued-engine will be aborted and we will see an error-message. 137 // Solution: We could push all waiting operations in the execution stack of the result engine into our own 138 // execution stack, but this is not easy because we have to change the operations to point to the 139 // original scopes instead of the new scopes (created while deserializing the processing engine). 140 // Instead just push the original parallel operation back on the stack to force local execution. 141 ExecutionStack.Push(parOperation); 142 } else { 143 // if everything went fine we can merge the results into our local scope-tree 144 MergeScope(parOperation.Scope, resultEngine.InitialOperation.Scope); 145 } 134 146 } 135 147 } catch(Exception e) { … … 181 193 } 182 194 183 private IScope FindParentScope(IScope currentScope, CompositeOperation compositeOperation) { 184 AtomicOperation currentOperation = (AtomicOperation)compositeOperation.Operations[0]; 185 if(currentScope.SubScopes.Contains(currentOperation.Scope)) return currentScope; 195 private IScope FindParentScope(IScope currentScope, IScope childScope) { 196 if(currentScope.SubScopes.Contains(childScope)) return currentScope; 186 197 foreach(IScope subScope in currentScope.SubScopes) { 187 IScope result = FindParentScope(subScope, c ompositeOperation);198 IScope result = FindParentScope(subScope, childScope); 188 199 if(result != null) return result; 189 200 } -
trunk/sources/HeuristicLab.DistributedEngine/JobManager.cs
r268 r281 125 125 } 126 126 127 public IScope EndExecuteOperation(AtomicOperation operation) {127 public ProcessingEngine EndExecuteOperation(AtomicOperation operation) { 128 128 byte[] zippedResult = null; 129 129 lock(dictionaryLock) { … … 133 133 // restore the engine 134 134 using(GZipStream stream = new GZipStream(new MemoryStream(zippedResult), CompressionMode.Decompress)) { 135 ProcessingEngine resultEngine = (ProcessingEngine)PersistenceManager.Load(stream); 136 return resultEngine.InitialOperation.Scope; 135 return (ProcessingEngine)PersistenceManager.Load(stream); 137 136 } 138 137 }
Note: See TracChangeset
for help on using the changeset viewer.