diff --git a/configuration/datawarehouse.d/include/Jobs-node-util-agg.sql b/configuration/datawarehouse.d/include/Jobs-node-util-agg.sql new file mode 100644 index 0000000000..eb79f6797c --- /dev/null +++ b/configuration/datawarehouse.d/include/Jobs-node-util-agg.sql @@ -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 +) diff --git a/configuration/datawarehouse.d/include/Jobs-node-util-time.sql b/configuration/datawarehouse.d/include/Jobs-node-util-time.sql new file mode 100644 index 0000000000..fa2b15e79d --- /dev/null +++ b/configuration/datawarehouse.d/include/Jobs-node-util-time.sql @@ -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 +) diff --git a/docs/howto-node-utilization.md b/docs/howto-node-utilization.md index fbe8486b77..5fd26b2223 100644 --- a/docs/howto-node-utilization.md +++ b/docs/howto-node-utilization.md @@ -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`: @@ -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.