Changeset 16257


Ignore:
Timestamp:
10/25/18 12:48:50 (19 months ago)
Author:
jkarder
Message:

#2839: worked on hive project management

  • fixed GetAvailabilityStatsPerProjectQueryString
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/ProjectDao.cs

    r16117 r16257  
    4141    public void DeleteByIds(IEnumerable<Guid> ids) {
    4242      string paramProjectIds = string.Join(",", ids.ToList().Select(x => string.Format("'{0}'", x)));
    43       if(!string.IsNullOrWhiteSpace(paramProjectIds)) {
     43      if (!string.IsNullOrWhiteSpace(paramProjectIds)) {
    4444        string queryString = string.Format(DeleteByIdsQueryString, paramProjectIds);
    4545        DataContext.ExecuteCommand(queryString);
     
    117117      WITH rtree AS
    118118      (
    119         SELECT ResourceId, ParentResourceId
    120         FROM [Resource]
    121         UNION ALL
    122         SELECT rt.ResourceId, r.ParentResourceId
    123         FROM [Resource] r
    124         JOIN rtree rt ON rt.ParentResourceId = r.ResourceId
    125       )
    126       SELECT apr.ProjectId, SUM(res.Cores) AS Cores, SUM(res.Memory) AS Memory
    127       FROM rtree, [AssignedProjectResource] apr, [Resource] res
    128       WHERE rtree.ResourceId = res.ResourceId
    129       AND res.ResourceType = 'Slave'
    130       AND (res.SlaveState = 'Idle' OR SlaveState = 'Calculating')
    131       AND rtree.ParentResourceId = apr.ResourceId
    132       GROUP BY apr.ProjectId
    133       UNION
    134       SELECT apr.ProjectId, SUM(res.Cores) AS Cores, SUM(res.Memory) AS Memory
    135       FROM [AssignedProjectResource] apr, [Resource] res
    136       WHERE apr.ResourceId = res.ResourceId
    137       AND res.ResourceType = 'Slave'
    138       AND (res.SlaveState = 'Idle' OR SlaveState = 'Calculating')
    139       GROUP BY apr.ProjectId
     119        SELECT ResourceId, ParentResourceId
     120        FROM [Resource]
     121        UNION ALL
     122        SELECT rt.ResourceId, r.ParentResourceId
     123        FROM [Resource] r
     124        JOIN rtree rt ON rt.ParentResourceId = r.ResourceId
     125      )
     126      SELECT [union].ProjectId, SUM([union].Cores), SUM([union].Memory)
     127      FROM
     128      (
     129        SELECT apr.ProjectId, res.Cores, res.Memory
     130        FROM rtree, [AssignedProjectResource] apr, [Resource] res
     131        WHERE rtree.ResourceId = res.ResourceId
     132        AND res.ResourceType = 'Slave'
     133        AND (res.SlaveState = 'Idle' OR SlaveState = 'Calculating')
     134        AND rtree.ParentResourceId = apr.ResourceId
     135        UNION ALL
     136        SELECT apr.ProjectId, res.Cores, res.Memory
     137        FROM [AssignedProjectResource] apr, [Resource] res
     138        WHERE apr.ResourceId = res.ResourceId
     139        AND res.ResourceType = 'Slave'
     140        AND (res.SlaveState = 'Idle' OR SlaveState = 'Calculating')
     141      ) AS [union]
     142      GROUP BY [union].ProjectId
    140143    ";
    141144
Note: See TracChangeset for help on using the changeset viewer.