Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/03/14 16:03:14 (10 years ago)
Author:
ascheibe
Message:

#2153

  • added a new method HandleStartStopPauseError in Executor to handle error conditions in the same way
  • added timeouts for semaphores so that failed tasks or tasks with endless loops don't block the slave
  • removed ExceptionOccured events from Executor/SlaveTask/TaskManager and use TaskFailed instead
  • removed another ExcpetionOccured event in HeartbeatManager that was never used
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.Slave/3.3/SlaveTask.cs

    r9456 r11082  
    4343    public Guid TaskId { get; private set; }
    4444    public bool IsPrepared { get; private set; }
     45    private TaskData originalTaskData;
    4546
    4647    private int coresNeeded;
     
    7475      try {
    7576        this.TaskId = task.Id;
     77        originalTaskData = taskData;
    7678        Prepare(task);
    7779        StartTaskInAppDomain(taskData);
     
    143145        while (repeat > 0) {
    144146          try {
    145             waitForStartBeforeKillSem.WaitOne();
     147            waitForStartBeforeKillSem.WaitOne(Settings.Default.ExecutorSemTimeouts);
    146148            AppDomain.Unload(appDomain);
    147149            waitForStartBeforeKillSem.Dispose();
     
    164166    private void AppDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
    165167      DisposeAppDomain();
    166       OnExceptionOccured(new Exception("Unhandled exception: " + e.ExceptionObject.ToString()));
     168      OnTaskFailed(new Exception("Unhandled exception: " + e.ExceptionObject.ToString()));
    167169    }
    168170
     
    171173      try {
    172174        data = executor.GetTaskData();
     175        //this means that there was a problem executing the task
     176        if (data == null) return originalTaskData;
    173177      }
    174178      catch (Exception ex) {
     
    233237            executorMonitoringRun = false;
    234238            break;
    235 
    236           case ExecutorMessageType.ExceptionOccured:
    237             executorMonitoringRun = false;
    238             DisposeAppDomain();
    239             if (executor.CurrentException != null) {
    240               OnExceptionOccured(executor.CurrentException);
    241             } else {
    242               OnExceptionOccured(new Exception(string.Format("Unknow exception occured in Executor for task {0}", TaskId)));
    243             }
    244             break;
    245239        }
    246240      }
     
    277271      if (handler != null) handler(this, new EventArgs<Guid, Exception>(this.TaskId, exception));
    278272    }
    279 
    280     public event EventHandler<EventArgs<Guid, Exception>> ExceptionOccured;
    281     private void OnExceptionOccured(Exception exception) {
    282       var handler = ExceptionOccured;
    283       if (handler != null) handler(this, new EventArgs<Guid, Exception>(this.TaskId, exception));
    284     }
    285273  }
    286274}
Note: See TracChangeset for help on using the changeset viewer.