Changeset 7287 for branches/HiveHiveEngine/HeuristicLab.Services.Hive/3.3
- Timestamp:
- 01/07/12 02:07:44 (13 years ago)
- Location:
- branches/HiveHiveEngine/HeuristicLab.Services.Hive/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveHiveEngine/HeuristicLab.Services.Hive/3.3/HiveDao.cs
r7259 r7287 103 103 || child.State == TaskState.Aborted 104 104 || child.State == TaskState.Failed).All(x => x) 105 orderby ar.Task.Priority descending, db.Random() 106 select DT.Convert.ToDto(ar.Task); 107 return count == 0 ? query.ToArray() : query.Take(count).ToArray(); 108 } 109 } 110 111 /// <summary> 112 /// this is for the hive engine 113 /// </summary> 114 private IEnumerable<DT.Task> GetPausedParentTasks(IEnumerable<Guid> resourceIds, int count) { 115 using (var db = CreateContext()) { 116 var query = from ar in db.AssignedResources 117 where resourceIds.Contains(ar.ResourceId) 118 && ar.Task.State == TaskState.Paused 119 && ar.Task.IsParentTask 120 && !ar.Task.FinishWhenChildJobsFinished 121 && (from child in db.Tasks 122 where child.ParentTaskId == ar.Task.TaskId 123 select child).All(x => x.State == TaskState.Finished) 105 124 && (from child in db.Tasks // avoid returning WaitForChildTasks task where no child-task exist (yet) 106 125 where child.ParentTaskId == ar.Task.TaskId … … 115 134 using (var db = CreateContext()) { 116 135 var resourceIds = GetParentResources(slave.Id).Select(r => r.Id); 117 //Originally we checked here if there are parent tasks which should be calculated (with GetParentTasks(resourceIds, count, false);). 118 //Because there is at the moment no case where this makes sense (there don't exist parent tasks which need to be calculated), 119 //we skip this step because it's wasted runtime 136 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); 143 if (count > 0 && waitingParentJobs.Count() >= count) return waitingParentJobs.Take(count).ToArray(); 120 144 121 145 var query = from ar in db.AssignedResources -
branches/HiveHiveEngine/HeuristicLab.Services.Hive/3.3/HiveService.cs
r7259 r7287 71 71 } 72 72 dao.AddTaskData(taskData); 73 dao.UpdateTaskState(task.Id, DA.TaskState.Waiting, null, userManager.CurrentUserId, null); 73 //TODO: hack!! change this 74 if (task.State != TaskState.Aborted) { 75 dao.UpdateTaskState(task.Id, DA.TaskState.Waiting, null, userManager.CurrentUserId, null); 76 } 74 77 return taskData.TaskId; 75 78 }, false, true);
Note: See TracChangeset
for help on using the changeset viewer.