Changeset 7320


Ignore:
Timestamp:
01/12/12 17:14:36 (8 years ago)
Author:
ascheibe
Message:

#1744 fixed a bug in the job scheduler for hive engine tasks

Location:
branches/HiveHiveEngine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveHiveEngine/HeuristicLab.HiveEngine/3.3/HiveEngine.cs

    r7287 r7320  
    370370      var failedJobs = allHiveTasks.Where(x => x.Task.State != TaskState.Finished);
    371371      if (failedJobs.Count() > 0) {
    372         throw new HiveEngineException("Task failed: " + failedJobs.First().Task.StateLog.Last().Exception);
     372        throw new HiveEngineException("Task (" + failedJobs.First().Task.Id + ") failed: " + failedJobs.First().Task.StateLog.Last().Exception);
    373373      }
    374374
  • branches/HiveHiveEngine/HeuristicLab.Services.Hive/3.3/HiveDao.cs

    r7287 r7320  
    112112    /// this is for the hive engine
    113113    /// </summary>   
    114     private IEnumerable<DT.Task> GetPausedParentTasks(IEnumerable<Guid> resourceIds, int count) {
    115       using (var db = CreateContext()) {
     114    private IEnumerable<DT.Task> GetHiveEngineParentTasks(IEnumerable<Guid> resourceIds, int count) {
     115      using (var db = CreateContext()) {
     116        //query for waiting parent hive engine tasks or parent hive engine tasks where all childrens are finished
    116117        var query = from ar in db.AssignedResources
    117118                    where resourceIds.Contains(ar.ResourceId)
    118                        && ar.Task.State == TaskState.Paused
     119                       && ar.Task.State == TaskState.Waiting
    119120                       && ar.Task.IsParentTask
    120121                       && !ar.Task.FinishWhenChildJobsFinished
     
    122123                           where child.ParentTaskId == ar.Task.TaskId
    123124                           select child).All(x => x.State == TaskState.Finished)
    124                        && (from child in db.Tasks // avoid returning WaitForChildTasks task where no child-task exist (yet)
    125                            where child.ParentTaskId == ar.Task.TaskId
    126                            select child).Count() > 0
    127125                    orderby ar.Task.Priority descending, db.Random()
    128126                    select DT.Convert.ToDto(ar.Task);
     
    135133        var resourceIds = GetParentResources(slave.Id).Select(r => r.Id);
    136134
    137         //check for freshly uploaded hive engine tasks
    138         var waitingParentJobs = GetParentTasks(resourceIds, count, false);
    139         if (count > 0 && waitingParentJobs.Count() >= count) return waitingParentJobs.Take(count).ToArray();
    140 
    141         //check if there are hive engine tasks which have finished childs
    142         waitingParentJobs = GetPausedParentTasks(resourceIds, count);
     135        //check if there are hive engine tasks to calculate
     136        var waitingParentJobs = GetHiveEngineParentTasks(resourceIds, count);
    143137        if (count > 0 && waitingParentJobs.Count() >= count) return waitingParentJobs.Take(count).ToArray();
    144138
    145139        var query = from ar in db.AssignedResources
    146140                    where resourceIds.Contains(ar.ResourceId)
    147                        && !(ar.Task.IsParentTask && ar.Task.FinishWhenChildJobsFinished)
     141                       && !ar.Task.IsParentTask
    148142                       && ar.Task.State == TaskState.Waiting
    149143                       && ar.Task.CoresNeeded <= slave.FreeCores
Note: See TracChangeset for help on using the changeset viewer.