Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/04/12 16:34:49 (10 years ago)
Author:
ascheibe
Message:

#1712 removed unnecessary query because scheduling is now serialized

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveTaskScheduler/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs

    r8995 r8997  
    7979              if (availableJobs.Any()) {
    8080                var job = availableJobs.First();
    81                 if (AssignJob(slave, job))
    82                   actions.Add(new MessageContainer(MessageContainer.MessageType.CalculateTask, job.Id));
     81                AssignJob(slave, job);
     82                actions.Add(new MessageContainer(MessageContainer.MessageType.CalculateTask, job.Id));
    8383              }
    8484            }
     
    9595    }
    9696
    97     // returns true if assignment was successful
    98     private bool AssignJob(Slave slave, Task task) {
    99       // load task again and check if it is still available (this is an attempt to reduce the race condition which causes multiple heartbeats to get the same task assigned)
    100       if (dao.GetTask(task.Id).State != TaskState.Waiting) return false;
    101 
     97    private void AssignJob(Slave slave, Task task) {
    10298      task = dao.UpdateTaskState(task.Id, DataAccess.TaskState.Transferring, slave.Id, null, null);
    10399
     
    105101      task.LastHeartbeat = DateTime.Now;
    106102      dao.UpdateTask(task);
    107       return true;
    108103    }
    109104
Note: See TracChangeset for help on using the changeset viewer.