diff --git a/internal/repository/stats.go b/internal/repository/stats.go index 3ac3ffd..8084553 100644 --- a/internal/repository/stats.go +++ b/internal/repository/stats.go @@ -70,28 +70,30 @@ func (r *JobRepository) buildStatsQuery( var query sq.SelectBuilder castType := r.getCastType() + // fmt.Sprintf(`CAST(ROUND((CASE WHEN job.job_state = "running" THEN %d - job.start_time ELSE job.duration END) / 3600) as %s) as value`, time.Now().Unix(), castType) + if col != "" { // Scan columns: id, totalJobs, totalWalltime, totalNodes, totalNodeHours, totalCores, totalCoreHours, totalAccs, totalAccHours query = sq.Select(col, "COUNT(job.id) as totalJobs", - fmt.Sprintf("CAST(ROUND(SUM(job.duration) / 3600) as %s) as totalWalltime", castType), - fmt.Sprintf("CAST(SUM(job.num_nodes) as %s) as totalNodes", castType), - fmt.Sprintf("CAST(ROUND(SUM(job.duration * job.num_nodes) / 3600) as %s) as totalNodeHours", castType), - fmt.Sprintf("CAST(SUM(job.num_hwthreads) as %s) as totalCores", castType), - fmt.Sprintf("CAST(ROUND(SUM(job.duration * job.num_hwthreads) / 3600) as %s) as totalCoreHours", castType), - fmt.Sprintf("CAST(SUM(job.num_acc) as %s) as totalAccs", castType), - fmt.Sprintf("CAST(ROUND(SUM(job.duration * job.num_acc) / 3600) as %s) as totalAccHours", castType), + fmt.Sprintf(`CAST(ROUND(SUM((CASE WHEN job.job_state = "running" THEN %d - job.start_time ELSE job.duration END)) / 3600) as %s) as totalWalltime`, time.Now().Unix(), castType), + fmt.Sprintf(`CAST(SUM(job.num_nodes) as %s) as totalNodes`, castType), + fmt.Sprintf(`CAST(ROUND(SUM((CASE WHEN job.job_state = "running" THEN %d - job.start_time ELSE job.duration END) * job.num_nodes) / 3600) as %s) as totalNodeHours`, time.Now().Unix(), castType), + fmt.Sprintf(`CAST(SUM(job.num_hwthreads) as %s) as totalCores`, castType), + fmt.Sprintf(`CAST(ROUND(SUM((CASE WHEN job.job_state = "running" THEN %d - job.start_time ELSE job.duration END) * job.num_hwthreads) / 3600) as %s) as totalCoreHours`, time.Now().Unix(), castType), + fmt.Sprintf(`CAST(SUM(job.num_acc) as %s) as totalAccs`, castType), + fmt.Sprintf(`CAST(ROUND(SUM((CASE WHEN job.job_state = "running" THEN %d - job.start_time ELSE job.duration END) * job.num_acc) / 3600) as %s) as totalAccHours`, time.Now().Unix(), castType), ).From("job").GroupBy(col) } else { // Scan columns: totalJobs, totalWalltime, totalNodes, totalNodeHours, totalCores, totalCoreHours, totalAccs, totalAccHours query = sq.Select("COUNT(job.id)", - fmt.Sprintf("CAST(ROUND(SUM(job.duration) / 3600) as %s)", castType), - fmt.Sprintf("CAST(SUM(job.num_nodes) as %s)", castType), - fmt.Sprintf("CAST(ROUND(SUM(job.duration * job.num_nodes) / 3600) as %s)", castType), - fmt.Sprintf("CAST(SUM(job.num_hwthreads) as %s)", castType), - fmt.Sprintf("CAST(ROUND(SUM(job.duration * job.num_hwthreads) / 3600) as %s)", castType), - fmt.Sprintf("CAST(SUM(job.num_acc) as %s)", castType), - fmt.Sprintf("CAST(ROUND(SUM(job.duration * job.num_acc) / 3600) as %s)", castType), + fmt.Sprintf(`CAST(ROUND(SUM((CASE WHEN job.job_state = "running" THEN %d - job.start_time ELSE job.duration END)) / 3600) as %s)`, time.Now().Unix(), castType), + fmt.Sprintf(`CAST(SUM(job.num_nodes) as %s)`, castType), + fmt.Sprintf(`CAST(ROUND(SUM((CASE WHEN job.job_state = "running" THEN %d - job.start_time ELSE job.duration END) * job.num_nodes) / 3600) as %s)`, time.Now().Unix(), castType), + fmt.Sprintf(`CAST(SUM(job.num_hwthreads) as %s)`, castType), + fmt.Sprintf(`CAST(ROUND(SUM((CASE WHEN job.job_state = "running" THEN %d - job.start_time ELSE job.duration END) * job.num_hwthreads) / 3600) as %s)`, time.Now().Unix(), castType), + fmt.Sprintf(`CAST(SUM(job.num_acc) as %s)`, castType), + fmt.Sprintf(`CAST(ROUND(SUM((CASE WHEN job.job_state = "running" THEN %d - job.start_time ELSE job.duration END) * job.num_acc) / 3600) as %s)`, time.Now().Unix(), castType), ).From("job") } diff --git a/web/frontend/package-lock.json b/web/frontend/package-lock.json index eb80726..1ca3349 100644 --- a/web/frontend/package-lock.json +++ b/web/frontend/package-lock.json @@ -22,6 +22,7 @@ "@rollup/plugin-commonjs": "^24.1.0", "@rollup/plugin-node-resolve": "^15.0.2", "@rollup/plugin-terser": "^0.4.1", + "@timohausmann/quadtree-js": "^1.2.5", "rollup": "^3.21.0", "rollup-plugin-css-only": "^4.3.0", "rollup-plugin-svelte": "^7.1.4", @@ -225,6 +226,12 @@ } } }, + "node_modules/@timohausmann/quadtree-js": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@timohausmann/quadtree-js/-/quadtree-js-1.2.5.tgz", + "integrity": "sha512-WcH3pouYtpyLjTCRvNP0WuSV4m7mRyYhLzW44egveFryT7pJhpDsdIJASEe37iCFNA0vmEpqTYGoG0siyXEthA==", + "dev": true + }, "node_modules/@types/estree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", diff --git a/web/frontend/package.json b/web/frontend/package.json index b0bb5af..3e77474 100644 --- a/web/frontend/package.json +++ b/web/frontend/package.json @@ -10,6 +10,7 @@ "@rollup/plugin-commonjs": "^24.1.0", "@rollup/plugin-node-resolve": "^15.0.2", "@rollup/plugin-terser": "^0.4.1", + "@timohausmann/quadtree-js": "^1.2.5", "rollup": "^3.21.0", "rollup-plugin-css-only": "^4.3.0", "rollup-plugin-svelte": "^7.1.4", diff --git a/web/frontend/src/Analysis.root.svelte b/web/frontend/src/Analysis.root.svelte index 67cc652..aa4ae37 100644 --- a/web/frontend/src/Analysis.root.svelte +++ b/web/frontend/src/Analysis.root.svelte @@ -10,7 +10,7 @@ import { binsFromFootprint } from './utils.js' import ScatterPlot from './plots/Scatter.svelte' import PlotTable from './PlotTable.svelte' - import Roofline from './plots/Roofline.svelte' + import RooflineHeatmap from './plots/RooflineHeatmap.svelte' const { query: initq } = init() @@ -293,7 +293,7 @@ {#each $topQuery.data.topList as te, i} - {#if groupSelection.key == 'User'} + {#if groupSelection.key == 'user'} {te.id} {:else} {te.id} @@ -315,7 +315,7 @@ {:else if $rooflineQuery.data && cluster}
{#key $rooflineQuery.data} - -
{#if $initq.error} @@ -245,7 +244,6 @@ {/if} c.name == $initq.data.job.cluster) .subClusters.find( (sc) => sc.name == $initq.data.job.subCluster )} - flopsAny={$jobMetrics.data.jobMetrics.find( - (m) => m.name == "flops_any" && m.scope == "node" - )} - memBw={$jobMetrics.data.jobMetrics.find( - (m) => m.name == "mem_bw" && m.scope == "node" - )} + data={ + transformDataForRoofline ( + $jobMetrics.data.jobMetrics.find((m) => m.name == "flops_any" && m.scope == "node").metric, + $jobMetrics.data.jobMetrics.find((m) => m.name == "mem_bw" && m.scope == "node").metric + ) + } /> {:else} @@ -275,8 +272,7 @@ {/if} -
- + {#if $initq.data} @@ -293,7 +289,6 @@ --> -
{#if $jobMetrics.error} @@ -340,8 +335,7 @@ {/if} -
- + {#if $initq.data} diff --git a/web/frontend/src/Status.root.svelte b/web/frontend/src/Status.root.svelte index f1d8e05..fffbfde 100644 --- a/web/frontend/src/Status.root.svelte +++ b/web/frontend/src/Status.root.svelte @@ -1,7 +1,7 @@
- +