Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/03/13 16:17:44 (11 years ago)
Author:
ascheibe
Message:

#2005

  • add repeating of failed tasks and task datas
  • added an additional ws method that loads lightweight tasks without the statelogs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UnloadJobs/HeuristicLab.Services.Hive/3.3/HiveDao.cs

    r9123 r9202  
    7171    }
    7272
     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
    7395    public Guid AddTask(DT.Task dto) {
    7496      using (var db = CreateContext()) {
Note: See TracChangeset for help on using the changeset viewer.