Skip to content

Commit

Permalink
Restore node utilization statistics (#1431)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtpalmer authored Aug 26, 2020
1 parent 89466b8 commit 7b8c58a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 68 deletions.
24 changes: 24 additions & 0 deletions configuration/datawarehouse.d/include/Jobs-node-util-agg.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
100.0 * (
COALESCE(
SUM(agg.node_time)
/
(
SELECT
SUM(ra.percent * inner_days.hours * rs.q_nodes / 100.0)
FROM
modw.resourcespecs rs,
modw.resource_allocated ra,
modw.days inner_days
WHERE
inner_days.id BETWEEN YEAR(FROM_UNIXTIME(ra.start_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(ra.start_date_ts)) AND COALESCE(YEAR(FROM_UNIXTIME(ra.end_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(ra.end_date_ts)), 999999999)
AND inner_days.id BETWEEN YEAR(FROM_UNIXTIME(rs.start_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(rs.start_date_ts)) AND COALESCE(YEAR(FROM_UNIXTIME(rs.end_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(rs.end_date_ts)), 999999999)
AND inner_days.id BETWEEN YEAR(FROM_UNIXTIME(${START_DATE_TS})) * 100000 + DAYOFYEAR(FROM_UNIXTIME(${START_DATE_TS})) AND YEAR(FROM_UNIXTIME(${END_DATE_TS})) * 100000 + DAYOFYEAR(FROM_UNIXTIME(${END_DATE_TS}))
AND ra.resource_id = rs.resource_id
AND FIND_IN_SET(
rs.resource_id,
GROUP_CONCAT(DISTINCT agg.task_resource_id)
) <> 0
),
0
) / 3600.0
)
24 changes: 24 additions & 0 deletions configuration/datawarehouse.d/include/Jobs-node-util-time.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
100.0 * (
COALESCE(
SUM(agg.node_time)
/
(
SELECT
SUM(ra.percent * inner_days.hours * rs.q_nodes / 100.0)
FROM
modw.resourcespecs rs,
modw.resource_allocated ra,
modw.days inner_days
WHERE
inner_days.id BETWEEN YEAR(FROM_UNIXTIME(ra.start_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(ra.start_date_ts)) AND COALESCE(YEAR(FROM_UNIXTIME(ra.end_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(ra.end_date_ts)), 999999999)
AND inner_days.id BETWEEN YEAR(FROM_UNIXTIME(rs.start_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(rs.start_date_ts)) AND COALESCE(YEAR(FROM_UNIXTIME(rs.end_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(rs.end_date_ts)), 999999999)
AND inner_days.id BETWEEN YEAR(FROM_UNIXTIME(duration.${AGGREGATION_UNIT}_start_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(duration.${AGGREGATION_UNIT}_start_ts)) AND YEAR(FROM_UNIXTIME(duration.${AGGREGATION_UNIT}_end_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(duration.${AGGREGATION_UNIT}_end_ts))
AND ra.resource_id = rs.resource_id
AND FIND_IN_SET(
rs.resource_id,
GROUP_CONCAT(DISTINCT agg.task_resource_id)
) <> 0
),
0
) / 3600.0
)
70 changes: 2 additions & 68 deletions docs/howto-node-utilization.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,73 +8,7 @@ it is not appropriate for all resource configurations. Specifically, if
your resource allows node sharing, this statistic will not be accurate.
All nodes are assumed to be exclusive when this statistic is calculated.

First, add the SQL queries used by the statistic.

`/etc/xdmod/datawarehouse.d/include/Jobs-node-util-agg.sql`:

```sql
100.0 * (
COALESCE(
SUM(agg.node_time)
/
(
SELECT
SUM(ra.percent * inner_days.hours * rs.q_nodes / 100.0)
FROM
modw.resourcespecs rs,
modw.resource_allocated ra,
modw.days inner_days
WHERE
inner_days.id BETWEEN YEAR(FROM_UNIXTIME(ra.start_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(ra.start_date_ts))
AND COALESCE(YEAR(FROM_UNIXTIME(ra.end_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(ra.end_date_ts)), 999999999)
AND inner_days.id BETWEEN YEAR(FROM_UNIXTIME(rs.start_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(rs.start_date_ts))
AND COALESCE(YEAR(FROM_UNIXTIME(rs.end_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(rs.end_date_ts)), 999999999)
AND inner_days.id BETWEEN YEAR(FROM_UNIXTIME(${START_DATE_TS})) * 100000 + DAYOFYEAR(FROM_UNIXTIME(${START_DATE_TS}))
AND YEAR(FROM_UNIXTIME(${END_DATE_TS})) * 100000 + DAYOFYEAR(FROM_UNIXTIME(${END_DATE_TS}))
AND ra.resource_id = rs.resource_id
AND FIND_IN_SET(
rs.resource_id,
GROUP_CONCAT(DISTINCT agg.task_resource_id)
) <> 0
),
0
) / 3600.0
)
```

`/etc/xdmod/datawarehouse.d/include/Jobs-node-util-time.sql`:

```sql
100.0 * (
COALESCE(
SUM(agg.node_time)
/
(
SELECT
SUM(ra.percent * inner_days.hours * rs.q_nodes / 100.0)
FROM
modw.resourcespecs rs,
modw.resource_allocated ra,
modw.days inner_days
WHERE
inner_days.id BETWEEN YEAR(FROM_UNIXTIME(ra.start_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(ra.start_date_ts))
AND COALESCE(YEAR(FROM_UNIXTIME(ra.end_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(ra.end_date_ts)), 999999999)
AND inner_days.id BETWEEN YEAR(FROM_UNIXTIME(rs.start_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(rs.start_date_ts))
AND COALESCE(YEAR(FROM_UNIXTIME(rs.end_date_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(rs.end_date_ts)), 999999999)
AND inner_days.id BETWEEN YEAR(FROM_UNIXTIME(duration.${AGGREGATION_UNIT}_start_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(duration.${AGGREGATION_UNIT}_start_ts))
AND YEAR(FROM_UNIXTIME(duration.${AGGREGATION_UNIT}_end_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(duration.${AGGREGATION_UNIT}_end_ts))
AND ra.resource_id = rs.resource_id
AND FIND_IN_SET(
rs.resource_id,
GROUP_CONCAT(DISTINCT agg.task_resource_id)
) <> 0
),
0
) / 3600.0
)
```

Then add the statistic to the Jobs realm statistics configuration.
First add the statistic to the Jobs realm statistics configuration.

`/etc/xdmod/datawarehouse.d/ref/Jobs-statistics.json`:

Expand All @@ -96,7 +30,7 @@ Then add the statistic to the Jobs realm statistics configuration.
}
```

Last, run `acl-config` and restart your web server.
Next, run `acl-config` and restart your web server.

Reload the portal and the "Node Utilization" statistic will appear in the list
of Job statistics.

0 comments on commit 7b8c58a

Please sign in to comment.