Changeset 15630 for branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/TaskDao.cs
- Timestamp:
- 01/18/18 15:08:25 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/TaskDao.cs
r15628 r15630 54 54 //Because there is at the moment no case where this makes sense (there don't exist parent tasks which need to be calculated), 55 55 //we skip this step because it's wasted runtime 56 return DataContext.ExecuteQuery<TaskPriorityInfo>(GetWaitingTasksQueryString, slave.ResourceId, Enum.GetName(typeof(TaskState), TaskState.Waiting), slave.FreeCores, slave.FreeMemory).ToList(); 56 return DataContext.ExecuteQuery<TaskPriorityInfo>(GetWaitingTasksQueryString, 57 slave.ResourceId, 58 Enum.GetName(typeof(TaskState), TaskState.Waiting), 59 slave.FreeCores, 60 slave.FreeMemory).ToList(); 57 61 } 58 62 … … 88 92 /// <param name="resourceIds">list of resourceids which for which the task should be valid</param> 89 93 /// <param name="count">maximum number of task to return</param> 90 /// <param name="finished">if true, all parent task which have FinishWhenChildJobsFinished=true are returned, otherwise only FinishWhenChildJobsFinished=false are returned</param>94 /// <param name="finished">if true, all parent tasks which have FinishWhenChildJobsFinished=true are returned, otherwise only FinishWhenChildJobsFinished=false are returned</param> 91 95 /// <returns></returns> 92 96 public IEnumerable<Task> GetParentTasks(IEnumerable<Guid> resourceIds, int count, bool finished) { … … 129 133 "; 130 134 private const string GetWaitingTasksQueryString = @" 135 WITH rbranch AS ( 136 SELECT ResourceId, ParentResourceId 137 FROM [Resource] 138 WHERE ResourceId = {0} 139 UNION ALL 140 SELECT r.ResourceId, r.ParentResourceId 141 FROM [Resource] r 142 JOIN rbranch rb ON rb.ParentResourceId = r.ResourceId 143 ) 144 SELECT DISTINCT t.TaskId, t.JobId, t.Priority 145 FROM [Task] t, [Job] j, [AssignedJobResource] ajr, rbranch 146 WHERE NOT (t.IsParentTask = 1 AND t.FinishWhenChildJobsFinished = 1) 147 AND t.TaskState = {1} 148 AND t.CoresNeeded <= {2} 149 AND t.MemoryNeeded <= {3} 150 AND t.JobId = j.JobId 151 AND j.JobState = 'Online' 152 AND j.JobId = ajr.JobId 153 AND ajr.ResourceId = rbranch.ResourceId 154 "; 155 private const string GetWaitingTasksQueryStringOld = @" 131 156 WITH pr AS ( 132 157 SELECT ResourceId, ParentResourceId
Note: See TracChangeset
for help on using the changeset viewer.