Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15384


Ignore:
Timestamp:
09/28/17 08:04:05 (7 years ago)
Author:
jkarder
Message:

#2830: merged r15367 into stable

Location:
stable
Files:
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Algorithms.Benchmarks/3.3/BenchmarkAlgorithm.cs

    r15292 r15384  
    312312      } catch (OperationCanceledException) {
    313313      } catch (AggregateException ae) {
    314         OnExceptionOccurred(ae.InnerExceptions.SingleOrDefault() ?? ae);
     314        ae.FlattenAndHandle(new[] { typeof(OperationCanceledException) }, e => OnExceptionOccurred(e));
    315315      } catch (Exception e) {
    316316        OnExceptionOccurred(e);
  • stable/HeuristicLab.Algorithms.DataAnalysis

  • stable/HeuristicLab.Algorithms.DataAnalysis.Views

  • stable/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/CrossValidationView.cs

    r15292 r15384  
    222222    }
    223223
    224     private void startButton_Click(object sender, EventArgs e) {
    225       Content.StartAsync();
     224    private async void startButton_Click(object sender, EventArgs e) {
     225      await Content.StartAsync();
    226226    }
    227227    private void pauseButton_Click(object sender, EventArgs e) {
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs

    r15292 r15384  
    352352      allAlgorithmsFinished = new ManualResetEventSlim(false);
    353353
     354      var startedTasks = new List<Task>(clonedAlgorithms.Count);
     355
    354356      //start prepared or paused cloned algorithms
    355357      foreach (IAlgorithm clonedAlgorithm in clonedAlgorithms) {
     
    360362          lock (locker) {
    361363            if (pausePending || stopPending || ExecutionState != ExecutionState.Started) break;
    362             clonedAlgorithm.StartAsync(cancellationToken);
     364            var task = clonedAlgorithm.StartAsync(cancellationToken);
     365            startedTasks.Add(task);
    363366          }
    364367        }
     
    366369
    367370      allAlgorithmsFinished.Wait();
     371
     372      Task.WaitAll(startedTasks.ToArray()); // to get exceptions not handled within the tasks
    368373    }
    369374
  • stable/HeuristicLab.Clients.Hive/3.3/Tasks/EngineTask.cs

    r15292 r15384  
    7979    public override void Prepare() { }
    8080
    81     public override void Start() {
     81    public override async void Start() {
    8282      Item.Prepare(initialOperation);
    83       Item.StartAsync();
     83      await Item.StartAsync();
    8484    }
    8585
  • stable/HeuristicLab.Clients.Hive/3.3/Tasks/OptimizerTask.cs

    r15292 r15384  
    9696    }
    9797
    98     public override void Start() {
     98    public override async void Start() {
    9999      if ((Item is Experiment && OptimizerAsExperiment.Optimizers.Count == 0) || // experiment would not fire OnStopped if it has 0 optimizers
    100100          (Item is BatchRun && OptimizerAsBatchRun.Optimizer == null)) { // batchrun would not fire OnStopped if algorithm == null
    101101        OnTaskStopped();
    102102      } else {
    103         Item.StartAsync();
     103        await Item.StartAsync();
    104104      }
    105105    }
  • stable/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBAlgorithmView.cs

    r15292 r15384  
    324324      if (Content != null) Content.StoreAlgorithmInEachRun = storeAlgorithmInEachRunCheckBox.Checked;
    325325    }
    326     private void startButton_Click(object sender, EventArgs e) {
    327       Content.StartAsync();
     326    private async void startButton_Click(object sender, EventArgs e) {
     327      await Content.StartAsync();
    328328    }
    329329    private void pauseButton_Click(object sender, EventArgs e) {
  • stable/HeuristicLab.Common/3.3/AsyncHelper.cs

    r15292 r15384  
    2121
    2222using System;
    23 using System.Linq;
    2423using System.Runtime.ExceptionServices;
    2524using System.Threading;
     
    3837      } catch (OperationCanceledException) {
    3938      } catch (AggregateException ae) {
    40         var e = ae.InnerExceptions.SingleOrDefault() ?? ae;
    41         ExceptionDispatchInfo.Capture(e).Throw();
     39        ae.FlattenAndHandle(new[] { typeof(OperationCanceledException) }, e => ExceptionDispatchInfo.Capture(e).Throw());
    4240      }
    4341    }
  • stable/HeuristicLab.Common/3.3/HeuristicLab.Common-3.3.csproj

    r15292 r15384  
    132132    <Compile Include="Constants.cs" />
    133133    <Compile Include="ArrayExtensions.cs" />
     134    <Compile Include="ExceptionExtensions.cs" />
    134135    <Compile Include="Statistics\EmpiricalCumulativeDistributionFunction.cs" />
    135136    <Compile Include="ListExtensions.cs" />
  • stable/HeuristicLab.Core

  • stable/HeuristicLab.Core/3.3/Engine.cs

    r15292 r15384  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.Linq;
    2524using System.Threading;
    2625using HeuristicLab.Common;
     
    9190      } catch (OperationCanceledException) {
    9291      } catch (AggregateException ae) {
    93         OnExceptionOccurred(ae.InnerExceptions.SingleOrDefault() ?? ae);
     92        ae.FlattenAndHandle(new[] { typeof(OperationCanceledException) }, e => OnExceptionOccurred(e));
    9493      } catch (Exception e) {
    9594        OnExceptionOccurred(e);
  • stable/HeuristicLab.DebugEngine/3.3/DebugEngine.cs

    r15292 r15384  
    181181      } catch (OperationCanceledException) {
    182182      } catch (AggregateException ae) {
    183         OnExceptionOccurred(ae.InnerExceptions.SingleOrDefault() ?? ae);
     183        ae.FlattenAndHandle(new[] { typeof(OperationCanceledException) }, e => OnExceptionOccurred(e));
    184184      } catch (Exception e) {
    185185        OnExceptionOccurred(e);
  • stable/HeuristicLab.Optimization

  • stable/HeuristicLab.Optimization.Views

  • stable/HeuristicLab.Optimization.Views/3.3/IOptimizerView.cs

    r15292 r15384  
    136136
    137137    #region Control events
    138     protected virtual void startButton_Click(object sender, EventArgs e) {
    139       Content.StartAsync();
     138    protected virtual async void startButton_Click(object sender, EventArgs e) {
     139      await Content.StartAsync();
    140140    }
    141141    protected virtual void pauseButton_Click(object sender, EventArgs e) {
  • stable/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs

    r15317 r15384  
    8484      }
    8585      catch (AggregateException ae) {
    86         OnExceptionOccurred(ae.InnerExceptions.SingleOrDefault() ?? ae);
     86        ae.FlattenAndHandle(new[] { typeof(OperationCanceledException) }, e => OnExceptionOccurred(e));
    8787      }
    8888      catch (Exception e) {
Note: See TracChangeset for help on using the changeset viewer.