Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15393 for stable


Ignore:
Timestamp:
10/03/17 09:27:05 (5 years ago)
Author:
jkarder
Message:

#2831: merged r15368 and r15376 into stable

Location:
stable
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.DebugEngine/3.3/DebugEngine.cs

    r15384 r15393  
    308308          CurrentOperation = null;
    309309        } catch (Exception ex) {
    310           if (ex is OperationCanceledException) throw ex;
     310          if (ex is OperationCanceledException) throw;
    311311          else throw new OperatorExecutionException(operation.Operator, ex);
    312312        }
  • stable/HeuristicLab.ParallelEngine/3.3/ParallelEngine.cs

    r14186 r15393  
    101101            try {
    102102              Parallel.ForEach(stacks, parallelOptions, Run);
    103             }
    104             catch (OperationCanceledException ex) {
    105               OperationCollection remaining = new OperationCollection() { Parallel = true };
    106               for (int i = 0; i < stacks.Length; i++) {
    107                 if (stacks[i].Count == 1)
    108                   remaining.Add(stacks[i].Pop());
    109                 if (stacks[i].Count > 1) {
    110                   OperationCollection ops = new OperationCollection();
    111                   while (stacks[i].Count > 0)
    112                     ops.Add(stacks[i].Pop());
    113                   remaining.Add(ops);
    114                 }
    115               }
    116               if (remaining.Count > 0) executionStack.Push(remaining);
    117               throw ex;
     103            } catch (OperationCanceledException) {
     104              RepairStack(executionStack, stacks);
     105              throw;
     106            } catch (AggregateException) {
     107              RepairStack(executionStack, stacks);
     108              throw;
    118109            }
    119110          } else {
     
    128119          catch (Exception ex) {
    129120            executionStack.Push(operation);
    130             if (ex is OperationCanceledException) throw ex;
     121            if (ex is OperationCanceledException) throw;
    131122            else throw new OperatorExecutionException(operation.Operator, ex);
    132123          }
    133124          if (next != null) executionStack.Push(next);
    134 
    135           if (operation.Operator.Breakpoint) {
    136             string message = string.Format("Breakpoint: {0}", operation.Operator.Name != string.Empty ? operation.Operator.Name : operation.Operator.ItemName);
    137             Log.LogMessage(message);
    138             throw new OperationCanceledException(message);
    139           }
    140125        }
    141126      }
    142127    }
     128
     129    private static void RepairStack(Stack<IOperation> executionStack, Stack<IOperation>[] parallelExecutionStacks) {
     130      OperationCollection remaining = new OperationCollection() { Parallel = true };
     131      for (int i = 0; i < parallelExecutionStacks.Length; i++) {
     132        if (parallelExecutionStacks[i].Count == 1)
     133          remaining.Add(parallelExecutionStacks[i].Pop());
     134        if (parallelExecutionStacks[i].Count > 1) {
     135          OperationCollection ops = new OperationCollection();
     136          while (parallelExecutionStacks[i].Count > 0)
     137            ops.Add(parallelExecutionStacks[i].Pop());
     138          remaining.Add(ops);
     139        }
     140      }
     141      if (remaining.Count > 0) executionStack.Push(remaining);
     142    }
    143143  }
    144144}
  • stable/HeuristicLab.SequentialEngine/3.3/SequentialEngine.cs

    r14186 r15393  
    6262          catch (Exception ex) {
    6363            ExecutionStack.Push(operation);
    64             if (ex is OperationCanceledException) throw ex;
     64            if (ex is OperationCanceledException) throw;
    6565            else throw new OperatorExecutionException(operation.Operator, ex);
    6666          }
    6767          if (next != null) ExecutionStack.Push(next);
    68 
    69           if (operation.Operator.Breakpoint) {
    70             Log.LogMessage(string.Format("Breakpoint: {0}", operation.Operator.Name != string.Empty ? operation.Operator.Name : operation.Operator.ItemName));
    71             Pause();
    72           }
    7368        }
    7469      }
Note: See TracChangeset for help on using the changeset viewer.