Ignore:
Timestamp:
07/03/14 16:03:14 (5 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/Manager/TaskManager.cs

    r9456 r11082  
    7171      try {
    7272        if (slaveTasks.ContainsKey(task.Id)) {
    73           SlaveStatusInfo.IncrementExceptionOccured();
     73          SlaveStatusInfo.IncrementTasksFailed();
    7474          throw new TaskAlreadyRunningException(task.Id);
    7575        } else {
     
    185185      slaveTask.TaskStopped += new EventHandler<EventArgs<Guid>>(slaveTask_TaskStopped);
    186186      slaveTask.TaskFailed += new EventHandler<EventArgs<Guid, Exception>>(slaveTask_TaskFailed);
    187       slaveTask.ExceptionOccured += new EventHandler<EventArgs<Guid, Exception>>(slaveTask_ExceptionOccured);
    188187    }
    189188
     
    193192      slaveTask.TaskStopped -= new EventHandler<EventArgs<Guid>>(slaveTask_TaskStopped);
    194193      slaveTask.TaskFailed -= new EventHandler<EventArgs<Guid, Exception>>(slaveTask_TaskFailed);
    195       slaveTask.ExceptionOccured -= new EventHandler<EventArgs<Guid, Exception>>(slaveTask_ExceptionOccured);
    196194    }
    197195
     
    220218      try {
    221219        taskData = slaveTask.GetTaskData();
    222         if (taskData == null) throw new SerializationException();
    223220        SlaveStatusInfo.IncrementTasksFinished();
    224221        OnTaskPaused(slaveTask, taskData);
     
    243240      try {
    244241        taskData = slaveTask.GetTaskData();
    245         if (taskData == null) throw new SerializationException();
    246242        SlaveStatusInfo.IncrementTasksFinished();
    247243        OnTaskStopped(slaveTask, taskData);
     
    266262      try {
    267263        taskData = slaveTask.GetTaskData();
    268         if (taskData == null) throw new SerializationException();
    269264      }
    270265      catch { /* taskData will be null */ }
    271266      SlaveStatusInfo.IncrementTasksFailed();
    272267      OnTaskFailed(slaveTask, taskData, e.Value2);
    273     }
    274 
    275     private void slaveTask_ExceptionOccured(object sender, EventArgs<Guid, Exception> e) {
    276       SlaveTask slaveTask;
    277       slaveTasksLocker.EnterUpgradeableReadLock();
    278       try {
    279         slaveTask = slaveTasks[e.Value];
    280         RemoveSlaveTask(e.Value, slaveTask);
    281       }
    282       finally { slaveTasksLocker.ExitUpgradeableReadLock(); }
    283 
    284       SlaveStatusInfo.IncrementExceptionOccured();
    285       OnExceptionOccured(slaveTask, e.Value2);
    286268    }
    287269    #endregion
     
    312294    }
    313295
    314     public event EventHandler<EventArgs<SlaveTask, Exception>> ExceptionOccured;
    315     private void OnExceptionOccured(SlaveTask slaveTask, Exception exception) {
    316       var handler = ExceptionOccured;
    317       if (handler != null) handler(this, new EventArgs<SlaveTask, Exception>(slaveTask, exception));
    318     }
    319 
    320296    public event EventHandler<EventArgs<SlaveTask>> TaskAborted;
    321297    private void OnTaskAborted(SlaveTask slaveTask) {
Note: See TracChangeset for help on using the changeset viewer.