Changeset 7434


Ignore:
Timestamp:
01/31/12 22:22:42 (9 years ago)
Author:
ascheibe
Message:

#1722 When setting timed-out slaves offline the tasks on these slaves shouldn't be set to waiting as this leads to performance problems and deadlocks with big statelog tables. Setting tasks to waiting is done by another method of the cleanup process more efficiently.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Services.Hive/3.3/Manager/EventManager.cs

    r7259 r7434  
    4545    }
    4646
    47     public void Cleanup() { 
     47    public void Cleanup() {
    4848      trans.UseTransaction(() => {
    4949        SetTimeoutSlavesOffline();
     
    8989        if (!slave.LastHeartbeat.HasValue || (DateTime.Now - slave.LastHeartbeat.Value) > HeuristicLab.Services.Hive.Properties.Settings.Default.SlaveHeartbeatTimeout) {
    9090          slave.SlaveState = DT.SlaveState.Offline;
    91           SetTasksWaiting(slave.Id);
    9291          dao.UpdateSlave(slave);
    9392        }
     
    102101      foreach (var task in parentTasksToFinish) {
    103102        dao.UpdateTaskState(task.Id, TaskState.Finished, null, null, string.Empty);
    104       }
    105     }
    106 
    107     private void SetTasksWaiting(Guid slaveId) {
    108       var tasks = dao.GetTasks(x => x.State == TaskState.Calculating).Where(x => x.StateLog.Last().SlaveId == slaveId);
    109       foreach (var j in tasks) {
    110         DT.Task task = dao.UpdateTaskState(j.Id, TaskState.Waiting, slaveId, null, "Slave timed out.");
    111         task.Command = null;
    112         dao.UpdateTask(task);
    113103      }
    114104    }
Note: See TracChangeset for help on using the changeset viewer.