Free cookie consent management tool by TermsFeed Policy Generator

Changeset 281


Ignore:
Timestamp:
06/02/08 10:32:04 (16 years ago)
Author:
gkronber
Message:

ticket #155
operations that failed at a grid-client are pushed back onto the stack again to force local execution. If they fail locally as well the user will get the usual error dialog and can fix the bug (and save/load the engine as usual).

Location:
trunk/sources/HeuristicLab.DistributedEngine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DistributedEngine/DistributedEngine.cs

    r268 r281  
    9999            // 4) for each parallel job attach only the sub-scope that this operation uses
    100100            // 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);
    102102            List<IList<IScope>> prunedScopes = new List<IList<IScope>>();
    103103            PruneToParentScope(GlobalScope, parentScope, prunedScopes);
     
    130130            // retrieve results and merge into scope-tree
    131131            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              }
    134146            }
    135147          } catch(Exception e) {
     
    181193    }
    182194
    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;
    186197      foreach(IScope subScope in currentScope.SubScopes) {
    187         IScope result = FindParentScope(subScope, compositeOperation);
     198        IScope result = FindParentScope(subScope, childScope);
    188199        if(result != null) return result;
    189200      }
  • trunk/sources/HeuristicLab.DistributedEngine/JobManager.cs

    r268 r281  
    125125    }
    126126
    127     public IScope EndExecuteOperation(AtomicOperation operation) {
     127    public ProcessingEngine EndExecuteOperation(AtomicOperation operation) {
    128128      byte[] zippedResult = null;
    129129      lock(dictionaryLock) {
     
    133133      // restore the engine
    134134      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);
    137136      }     
    138137    }
Note: See TracChangeset for help on using the changeset viewer.