- Timestamp:
- 01/23/18 16:04:24 (7 years ago)
- Location:
- branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos
- Files:
-
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/TaskDao.cs
r15630 r15644 27 27 namespace HeuristicLab.Services.Hive.DataAccess.Daos { 28 28 public class TaskDao : GenericDao<Guid, Task> { 29 private Table<AssignedTaskResource> AssignedTaskResourceTable {30 get { return DataContext.GetTable<AssignedTaskResource>(); }31 }32 33 29 public TaskDao(DataContext dataContext) : base(dataContext) { } 34 30 … … 59 55 slave.FreeCores, 60 56 slave.FreeMemory).ToList(); 61 }62 63 /// <summary>64 /// returns all parent tasks which are waiting for their child tasks to finish65 /// </summary>66 /// <param name="resourceIds">list of resourceids which for which the task should be valid</param>67 /// <param name="count">maximum number of task to return</param>68 /// <param name="finished">if true, all parent task which have FinishWhenChildJobsFinished=true are returned, otherwise only FinishWhenChildJobsFinished=false are returned</param>69 /// <returns></returns>70 public IEnumerable<Task> GetParentTasks_Old(IEnumerable<Guid> resourceIds, int count, bool finished) {71 var query = from ar in AssignedTaskResourceTable72 where resourceIds.Contains(ar.ResourceId)73 && ar.Task.State == TaskState.Waiting74 && ar.Task.IsParentTask75 && (finished ? ar.Task.FinishWhenChildJobsFinished : !ar.Task.FinishWhenChildJobsFinished)76 && (from child in Table77 where child.ParentTaskId == ar.Task.TaskId78 select child.State == TaskState.Finished79 || child.State == TaskState.Aborted80 || child.State == TaskState.Failed).All(x => x)81 && (from child in Table // avoid returning WaitForChildTasks task where no child-task exist (yet)82 where child.ParentTaskId == ar.Task.TaskId83 select child).Any()84 orderby ar.Task.Priority descending85 select ar.Task;86 return count == 0 ? query.ToArray() : query.Take(count).ToArray();87 57 } 88 58 … … 153 123 AND ajr.ResourceId = rbranch.ResourceId 154 124 "; 155 private const string GetWaitingTasksQueryStringOld = @"156 WITH pr AS (157 SELECT ResourceId, ParentResourceId158 FROM [Resource]159 WHERE ResourceId = {0}160 UNION ALL161 SELECT r.ResourceId, r.ParentResourceId162 FROM [Resource] r JOIN pr ON r.ResourceId = pr.ParentResourceId163 )164 SELECT DISTINCT t.TaskId, t.JobId, t.Priority165 FROM pr JOIN AssignedTaskResource ar ON ar.ResourceId = pr.ResourceId166 JOIN Task t ON t.TaskId = ar.TaskId167 WHERE NOT (t.IsParentTask = 1 AND t.FinishWhenChildJobsFinished = 1)168 AND t.TaskState = {1}169 AND t.CoresNeeded <= {2}170 AND t.MemoryNeeded <= {3}171 ";172 125 173 126 private const string UpdateExecutionTimeQuery = @"
Note: See TracChangeset
for help on using the changeset viewer.