Changeset 9219 for trunk/sources/HeuristicLab.Services.Hive/3.3/HiveDao.cs
- Timestamp:
- 02/18/13 10:34:23 (11 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
/branches/UnloadJobs (added) merged: 9168-9170,9173-9174,9183-9184,9187-9188,9193,9201-9202
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Services.Hive
- Property svn:mergeinfo changed
/branches/UnloadJobs/HeuristicLab.Services.Hive (added) merged: 9202
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Services.Hive/3.3/HiveDao.cs
r9123 r9219 71 71 } 72 72 73 public IEnumerable<DT.LightweightTask> GetLightweightTasksWithoutStateLog(Expression<Func<Task, bool>> predicate) { 74 List<DT.LightweightTask> tasks = new List<DT.LightweightTask>(); 75 76 using (var db = CreateContext()) { 77 var tasksQuery = db.Tasks.Where(predicate).Select(task => new { task.TaskId, task.ExecutionTimeMs, task.ParentTaskId, task.State, task.Command }); 78 var taskDatasQuery = db.Tasks.Where(predicate).Where(task => task.JobData != null).Select(task => new { task.TaskId, task.JobData.LastUpdate }); 79 80 foreach (var task in tasksQuery) { 81 DT.LightweightTask t = new DT.LightweightTask(); 82 t.Id = task.TaskId; 83 t.ExecutionTime = TimeSpan.FromMilliseconds(task.ExecutionTimeMs); 84 t.ParentTaskId = task.ParentTaskId; 85 t.StateLog = new List<DT.StateLog>(); 86 t.State = DataTransfer.Convert.ToDto(task.State); 87 t.Command = DataTransfer.Convert.ToDto(task.Command); 88 t.LastTaskDataUpdate = taskDatasQuery.Where(x => x.TaskId == task.TaskId).Count() > 0 ? taskDatasQuery.Select(x => x.LastUpdate).First() : DateTime.MinValue; 89 tasks.Add(t); 90 } 91 } 92 return tasks; 93 } 94 73 95 public Guid AddTask(DT.Task dto) { 74 96 using (var db = CreateContext()) {
Note: See TracChangeset
for help on using the changeset viewer.