Changeset 413
- Timestamp:
- 07/31/08 10:07:09 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DistributedEngine/DistributedEngine.cs
r412 r413 127 127 } 128 128 } 129 130 CompositeOperation canceledOperations = new CompositeOperation(); 131 canceledOperations.ExecuteInParallel = true; 129 132 // retrieve results and merge into scope-tree 130 133 foreach(AtomicOperation parOperation in compositeOperation.Operations) { 131 134 ProcessingEngine resultEngine = jobManager.EndExecuteOperation(parOperation); 132 135 if(resultEngine.Canceled) { 133 // When the engine was canceled because of a problem at the client we can try to execute the steps locally. 134 // If they also fail the (local) distributued-engine will be aborted and we will see an error-message. 135 // so just push the original parallel operation back on the stack to force local execution. 136 ExecutionStack.Push(parOperation); 136 ThreadPool.QueueUserWorkItem(delegate(object state) { OnExceptionOccurred(new JobExecutionException(resultEngine.ErrorMessage)); }); 137 canceledOperations.AddOperation(parOperation); 137 138 } else { 138 139 // if everything went fine we can merge the results into our local scope-tree 139 140 MergeScope(parOperation.Scope, resultEngine.InitialOperation.Scope); 140 141 } 142 } 143 144 if(canceledOperations.Operations.Count > 0) { 145 myExecutionStack.Push(canceledOperations); 146 Abort(); 141 147 } 142 148 } catch(Exception e) { -
trunk/sources/HeuristicLab.Grid/ProcessingEngine.cs
r412 r413 36 36 } 37 37 38 private string errorMessage; 39 public string ErrorMessage { 40 get { return errorMessage; } 41 } 42 38 43 public ProcessingEngine() 39 44 : base() { … … 51 56 canceledAttr.Value = Canceled.ToString(); 52 57 node.Attributes.Append(canceledAttr); 58 if(errorMessage != null) { 59 XmlAttribute errorMessageAttr = document.CreateAttribute("ErrorMessage"); 60 errorMessageAttr.Value = ErrorMessage; 61 node.Attributes.Append(errorMessageAttr); 62 } 53 63 node.AppendChild(PersistenceManager.Persist("InitialOperation", initialOperation, document, persistedObjects)); 54 64 return node; … … 58 68 base.Populate(node, restoredObjects); 59 69 myCanceled = bool.Parse(node.Attributes["Canceled"].Value); 70 if(node.Attributes["ErrorMessage"] != null) errorMessage = node.Attributes["ErrorMessage"].Value; 60 71 initialOperation = (AtomicOperation)PersistenceManager.Restore(node.SelectSingleNode("InitialOperation"), restoredObjects); 61 72 } … … 69 80 next = atomicOperation.Operator.Execute(atomicOperation.Scope); 70 81 } catch(Exception ex) { 71 Trace.TraceWarning("Exception while executing an engine.\n" + ex.Message + "\n" + ex.StackTrace); 82 errorMessage = CreateErrorMessage(ex); 83 Trace.TraceWarning(errorMessage); 72 84 // push operation on stack again 73 85 myExecutionStack.Push(atomicOperation); … … 83 95 } 84 96 } 97 98 private string CreateErrorMessage(Exception ex) { 99 StringBuilder sb = new StringBuilder(); 100 sb.Append("Sorry, but something went wrong!\n\n" + ex.Message + "\n\n" + ex.StackTrace); 101 102 while(ex.InnerException != null) { 103 ex = ex.InnerException; 104 sb.Append("\n\n-----\n\n" + ex.Message + "\n\n" + ex.StackTrace); 105 } 106 return sb.ToString(); 107 } 85 108 } 86 109 }
Note: See TracChangeset
for help on using the changeset viewer.