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
Location:
branches/UnloadJobs/HeuristicLab.Services.Hive/3.3
Files:
4 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()) {
  • branches/UnloadJobs/HeuristicLab.Services.Hive/3.3/HiveService.cs

    r9123 r9202  
    129129      return trans.UseTransaction(() => {
    130130        return dao.GetLightweightTasks(task => task.JobId == jobId).ToArray();
     131      }, false, true);
     132    }
     133
     134    public IEnumerable<LightweightTask> GetLightweightJobTasksWithoutStateLog(Guid jobId) {
     135      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
     136      author.AuthorizeForJob(jobId, Permission.Read);
     137
     138      return trans.UseTransaction(() => {
     139        return dao.GetLightweightTasksWithoutStateLog(task => task.JobId == jobId).ToArray();
    131140      }, false, false);
    132141    }
  • branches/UnloadJobs/HeuristicLab.Services.Hive/3.3/Interfaces/IHiveDao.cs

    r9123 r9202  
    3232    IEnumerable<DT.Task> GetTasks(Expression<Func<Task, bool>> predicate);
    3333    IEnumerable<DT.LightweightTask> GetLightweightTasks(Expression<Func<Task, bool>> predicate);
     34    IEnumerable<DT.LightweightTask> GetLightweightTasksWithoutStateLog(Expression<Func<Task, bool>> predicate);
    3435    Guid AddTask(DT.Task dto);
    3536    void UpdateTaskAndPlugins(DT.Task dto);
  • branches/UnloadJobs/HeuristicLab.Services.Hive/3.3/ServiceContracts/IHiveService.cs

    r9123 r9202  
    5353
    5454    [OperationContract]
     55    IEnumerable<LightweightTask> GetLightweightJobTasksWithoutStateLog(Guid jobId);
     56
     57    [OperationContract]
    5558    TaskData GetTaskData(Guid taskId);
    5659
Note: See TracChangeset for help on using the changeset viewer.