diff --git a/public/api/resource-groups/1/queue-metrics.json b/public/api/resource-groups/1/queue-metrics/30.json similarity index 60% rename from public/api/resource-groups/1/queue-metrics.json rename to public/api/resource-groups/1/queue-metrics/30.json index 61f5fac..f52753d 100644 --- a/public/api/resource-groups/1/queue-metrics.json +++ b/public/api/resource-groups/1/queue-metrics/30.json @@ -4,27 +4,27 @@ "resourceId": 1, "name": "Bridges-2 Regular Memory", "resourceRepositoryKey": 2900, - "waitTime": 5.909166, - "wallTime": 2.007403, - "expansionFactor": 5.3611, + "waitTime": 11.97372, + "wallTime": 3.080251, + "expansionFactor": 5.794, "order": 1 }, { "resourceId": 2, "name": "Bridges-2 Extreme Memory", "resourceRepositoryKey": 2903, - "waitTime": 5.233983, - "wallTime": 6.61043, - "expansionFactor": 1.7911, + "waitTime": 4.266471, + "wallTime": 5.40701, + "expansionFactor": 1.7939, "order": 2 }, { "resourceId": 3, "name": "Bridges-2 GPU", "resourceRepositoryKey": 2902, - "waitTime": 19.670669, - "wallTime": 2.072165, - "expansionFactor": 10.4929, + "waitTime": 57.526596, + "wallTime": 2.376414, + "expansionFactor": 25.0903, "order": 3 } ] diff --git a/public/api/resource-groups/1/queue-metrics/365.json b/public/api/resource-groups/1/queue-metrics/365.json new file mode 100644 index 0000000..b5afd83 --- /dev/null +++ b/public/api/resource-groups/1/queue-metrics/365.json @@ -0,0 +1,31 @@ +{ + "queueMetrics": [ + { + "resourceId": 1, + "name": "Bridges-2 Regular Memory", + "resourceRepositoryKey": 2900, + "waitTime": 7.820775, + "wallTime": 1.699045, + "expansionFactor": 6.1959, + "order": 1 + }, + { + "resourceId": 2, + "name": "Bridges-2 Extreme Memory", + "resourceRepositoryKey": 2903, + "waitTime": 9.848182, + "wallTime": 6.751228, + "expansionFactor": 2.4567, + "order": 2 + }, + { + "resourceId": 3, + "name": "Bridges-2 GPU", + "resourceRepositoryKey": 2902, + "waitTime": 14.737766, + "wallTime": 2.025538, + "expansionFactor": 8.2869, + "order": 3 + } + ] +} diff --git a/public/api/resource-groups/1/queue-metrics/90.json b/public/api/resource-groups/1/queue-metrics/90.json new file mode 100644 index 0000000..d844ed1 --- /dev/null +++ b/public/api/resource-groups/1/queue-metrics/90.json @@ -0,0 +1,31 @@ +{ + "queueMetrics": [ + { + "resourceId": 1, + "name": "Bridges-2 Regular Memory", + "resourceRepositoryKey": 2900, + "waitTime": 12.564133, + "wallTime": 2.7384, + "expansionFactor": 7.684, + "order": 1 + }, + { + "resourceId": 2, + "name": "Bridges-2 Extreme Memory", + "resourceRepositoryKey": 2903, + "waitTime": 5.413989, + "wallTime": 6.426771, + "expansionFactor": 1.839, + "order": 2 + }, + { + "resourceId": 3, + "name": "Bridges-2 GPU", + "resourceRepositoryKey": 2902, + "waitTime": 44.75172, + "wallTime": 2.512934, + "expansionFactor": 18.7756, + "order": 3 + } + ] +} diff --git a/src/content.css b/src/content.css index 0066acd..f77affa 100644 --- a/src/content.css +++ b/src/content.css @@ -107,10 +107,19 @@ p { .table tbody th { text-align: right; } -input { +input, +select { border: 1px solid var(--contrast-8); border-radius: 0; color: var(--contrast); font-size: 1rem; padding: 6px 12px; } +select { + appearance: none; + background-color: white; + background-image: url("data:image/svg+xml,"); + background-position: right 12px center; + background-repeat: no-repeat; + padding: 6px 36px 6px 12px; +} diff --git a/src/resource-group-queue-metrics.jsx b/src/resource-group-queue-metrics.jsx index ecfa25b..3eee503 100644 --- a/src/resource-group-queue-metrics.jsx +++ b/src/resource-group-queue-metrics.jsx @@ -1,3 +1,4 @@ +import { useState } from "preact/hooks"; import { useJSON } from "./utils"; import Grid from "./grid"; @@ -25,8 +26,9 @@ export default function ResourceGroupQueueMetrics({ baseUri, resourceGroupId, }) { + const [days, setDays] = useState(30); const data = useJSON( - `${baseUri}/api/resource-groups/${resourceGroupId}/queue-metrics.json`, + `${baseUri}/api/resource-groups/${resourceGroupId}/queue-metrics/${days}.json`, null ); if (!data || data.error) return; @@ -55,7 +57,8 @@ export default function ResourceGroupQueueMetrics({ { key: "expansionFactor", name: "Expansion Factor", - format: (value) => value.toFixed(2), + format: (_value, row) => + ((row.waitTime + row.wallTime) / row.wallTime).toFixed(2), formatHeader: formatHeaderTip( 'Expansion factor is the ratio of the total time (wait time and wall time) to the wall time. It measures how much waiting in the queue "expands" the total time taken to complete a job relative to its length.' ), @@ -64,10 +67,20 @@ export default function ResourceGroupQueueMetrics({ return ( <> -