Changeset 17445


Ignore:
Timestamp:
02/19/20 13:50:24 (5 weeks ago)
Author:
jkarder
Message:

#3060: catch unhandled exceptions thrown by IOptimizer.StartAsync()

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/CrossValidationView.cs

    r17180 r17445  
    223223
    224224    private async void startButton_Click(object sender, EventArgs e) {
    225       await Content.StartAsync();
     225      try {
     226        await Content.StartAsync();
     227      } catch (Exception ex) {
     228        ErrorHandling.ShowErrorDialog(this, ex);
     229      }
    226230    }
    227231    private void pauseButton_Click(object sender, EventArgs e) {
  • trunk/HeuristicLab.Clients.Hive.Slave/3.3/Executor.cs

    r17180 r17445  
    4646    public bool IsStopping { get; set; }
    4747    public bool IsPausing { get; set; }
     48    public bool HasFailed { get; set; }
    4849
    4950    public Exception CurrentException;
     
    8485
    8586        task.Start();
    86         if (!startTaskSem.WaitOne(Settings.Default.ExecutorSemTimeouts)) {
     87        if (!startTaskSem.WaitOne(Settings.Default.ExecutorSemTimeouts) && !HasFailed) {
    8788          throw new TimeoutException("Timeout when starting the task. TaskStarted event was not fired.");
    8889        }
     
    159160    #region Task Events
    160161    private void Task_TaskFailed(object sender, EventArgs e) {
     162      HasFailed = true;
    161163      IsStopping = true;
    162164      EventArgs<Exception> ex = (EventArgs<Exception>)e;
    163165      CurrentException = ex.Value;
    164166      executorQueue.AddMessage(ExecutorMessageType.TaskFailed);
     167      startTaskSem.Set(); // cancel waiting for startup
    165168    }
    166169
  • trunk/HeuristicLab.Clients.Hive/3.3/Tasks/EngineTask.cs

    r17180 r17445  
    8080
    8181    public override async void Start() {
    82       Item.Prepare(initialOperation);
    83       await Item.StartAsync();
     82      try {
     83        Item.Prepare(initialOperation);
     84        await Item.StartAsync();
     85      } catch (Exception e) {
     86        engine_ExceptionOccurred(Item, new EventArgs<Exception>(e));
     87      }
    8488    }
    8589
  • trunk/HeuristicLab.Clients.Hive/3.3/Tasks/OptimizerTask.cs

    r17180 r17445  
    101101        OnTaskStopped();
    102102      } else {
    103         await Item.StartAsync();
     103        try {
     104          await Item.StartAsync();
     105        } catch (Exception e) {
     106          optimizer_ExceptionOccurred(Item, new EventArgs<Exception>(e));
     107        }
    104108      }
    105109    }
  • trunk/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBAlgorithmView.cs

    r17180 r17445  
    325325    }
    326326    private async void startButton_Click(object sender, EventArgs e) {
    327       await Content.StartAsync();
     327      try {
     328        await Content.StartAsync();
     329      } catch (Exception ex) {
     330        ErrorHandling.ShowErrorDialog(this, ex);
     331      }
    328332    }
    329333    private void pauseButton_Click(object sender, EventArgs e) {
  • trunk/HeuristicLab.Optimization.Views/3.3/IOptimizerView.cs

    r17180 r17445  
    137137    #region Control events
    138138    protected virtual async void startButton_Click(object sender, EventArgs e) {
    139       await Content.StartAsync();
     139      try {
     140        await Content.StartAsync();
     141      } catch (Exception ex) {
     142        ErrorHandling.ShowErrorDialog(this, ex);
     143      }
    140144    }
    141145    protected virtual void pauseButton_Click(object sender, EventArgs e) {
Note: See TracChangeset for help on using the changeset viewer.