Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/12/12 11:04:23 (11 years ago)
Author:
ascheibe
Message:

#1994 Calculating/Waiting Tasks are now calculated for the selected resource

Location:
trunk/sources/HeuristicLab.Services.Hive/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Services.Hive/3.3/HiveDao.cs

    r9025 r9033  
    843843    }
    844844
     845    public Dictionary<Guid, int> GetWaitingTasksByUserForResources(List<Guid> resourceIds) {
     846      using (var db = CreateContext()) {
     847        var waitingTasksByUser = from task in db.Tasks
     848                                 where task.State == TaskState.Waiting && task.AssignedResources.Any(x => resourceIds.Contains(x.ResourceId))
     849                                 group task by task.Job.OwnerUserId into g
     850                                 select new { UserId = g.Key, UsedCores = g.Count() };
     851        return waitingTasksByUser.ToDictionary(x => x.UserId, x => x.UsedCores);
     852      }
     853    }
     854
    845855    public Dictionary<Guid, int> GetCalculatingTasksByUser() {
    846856      using (var db = CreateContext()) {
    847857        var calculatingTasksByUser = from task in db.Tasks
    848858                                     where task.State == TaskState.Calculating
     859                                     group task by task.Job.OwnerUserId into g
     860                                     select new { UserId = g.Key, UsedCores = g.Count() };
     861        return calculatingTasksByUser.ToDictionary(x => x.UserId, x => x.UsedCores);
     862      }
     863    }
     864
     865    public Dictionary<Guid, int> GetCalculatingTasksByUserForResources(List<Guid> resourceIds) {
     866      using (var db = CreateContext()) {
     867        var calculatingTasksByUser = from task in db.Tasks
     868                                     where task.State == TaskState.Calculating && task.AssignedResources.Any(x => resourceIds.Contains(x.ResourceId))
    849869                                     group task by task.Job.OwnerUserId into g
    850870                                     select new { UserId = g.Key, UsedCores = g.Count() };
  • trunk/sources/HeuristicLab.Services.Hive/3.3/Interfaces/IHiveDao.cs

    r9022 r9033  
    148148    #region Statistics Methods
    149149    Dictionary<Guid, int> GetWaitingTasksByUser();
     150    Dictionary<Guid, int> GetWaitingTasksByUserForResources(List<Guid> resourceIds);
    150151    Dictionary<Guid, int> GetCalculatingTasksByUser();
     152    Dictionary<Guid, int> GetCalculatingTasksByUserForResources(List<Guid> resourceIds);
    151153    DT.Statistics GetStatistic(Guid id);
    152154    IEnumerable<DT.Statistics> GetStatistics(Expression<Func<Statistics, bool>> predicate);
Note: See TracChangeset for help on using the changeset viewer.