Merge branch 'dev' into sample_resolution_select

This commit is contained in:
Christoph Kluge 2024-08-22 17:33:16 +02:00
commit d629a58712
3 changed files with 40 additions and 27 deletions

View File

@ -22,11 +22,21 @@ SVELTE_COMPONENTS = status \
header header
SVELTE_TARGETS = $(addprefix $(FRONTEND)/public/build/,$(addsuffix .js, $(SVELTE_COMPONENTS))) SVELTE_TARGETS = $(addprefix $(FRONTEND)/public/build/,$(addsuffix .js, $(SVELTE_COMPONENTS)))
SVELTE_SRC = $(wildcard $(FRONTEND)/src/*.svelte) \ SVELTE_SRC = $(wildcard $(FRONTEND)/src/*.svelte) \
$(wildcard $(FRONTEND)/src/*.js) \ $(wildcard $(FRONTEND)/src/*.js) \
$(wildcard $(FRONTEND)/src/filters/*.svelte) \ $(wildcard $(FRONTEND)/src/analysis/*.svelte) \
$(wildcard $(FRONTEND)/src/plots/*.svelte) \ $(wildcard $(FRONTEND)/src/config/*.svelte) \
$(wildcard $(FRONTEND)/src/joblist/*.svelte) $(wildcard $(FRONTEND)/src/config/admin/*.svelte) \
$(wildcard $(FRONTEND)/src/config/user/*.svelte) \
$(wildcard $(FRONTEND)/src/generic/*.js) \
$(wildcard $(FRONTEND)/src/generic/*.svelte) \
$(wildcard $(FRONTEND)/src/generic/filters/*.svelte) \
$(wildcard $(FRONTEND)/src/generic/plots/*.svelte) \
$(wildcard $(FRONTEND)/src/generic/joblist/*.svelte) \
$(wildcard $(FRONTEND)/src/generic/helper/*.svelte) \
$(wildcard $(FRONTEND)/src/generic/select/*.svelte) \
$(wildcard $(FRONTEND)/src/header/*.svelte) \
$(wildcard $(FRONTEND)/src/job/*.svelte)
.PHONY: clean distclean test tags frontend swagger graphql $(TARGET) .PHONY: clean distclean test tags frontend swagger graphql $(TARGET)

View File

@ -1,8 +1,12 @@
CREATE INDEX IF NOT EXISTS job_by_project ON job (project);
CREATE INDEX IF NOT EXISTS job_list_projects ON job (project, job_state);
ALTER TABLE job ADD COLUMN energy REAL NOT NULL DEFAULT 0.0; ALTER TABLE job ADD COLUMN energy REAL NOT NULL DEFAULT 0.0;
ALTER TABLE job ADD COLUMN energy_footprint TEXT DEFAULT NULL; ALTER TABLE job ADD COLUMN energy_footprint TEXT DEFAULT NULL;
ALTER TABLE job ADD COLUMN footprint TEXT DEFAULT NULL; ALTER TABLE job ADD COLUMN footprint TEXT DEFAULT NULL;
UPDATE job SET footprint = '{"flops_any_avg": 0.0}'; UPDATE job SET footprint = '{"flops_any_avg": 0.0}';
UPDATE job SET footprint = json_replace(footprint, '$.flops_any_avg', job.flops_any_avg); UPDATE job SET footprint = json_replace(footprint, '$.flops_any_avg', job.flops_any_avg);
UPDATE job SET footprint = json_insert(footprint, '$.mem_bw_avg', job.mem_bw_avg); UPDATE job SET footprint = json_insert(footprint, '$.mem_bw_avg', job.mem_bw_avg);
UPDATE job SET footprint = json_insert(footprint, '$.mem_used_max', job.mem_used_max); UPDATE job SET footprint = json_insert(footprint, '$.mem_used_max', job.mem_used_max);

View File

@ -301,7 +301,7 @@ export function stickyHeader(datatableHeaderSelector, updatePading) {
onDestroy(() => document.removeEventListener("scroll", onscroll)); onDestroy(() => document.removeEventListener("scroll", onscroll));
} }
export function checkMetricDisabled(m, c, s) { //[m]etric, [c]luster, [s]ubcluster export function checkMetricDisabled(m, c, s) { // [m]etric, [c]luster, [s]ubcluster
const metrics = getContext("globalMetrics"); const metrics = getContext("globalMetrics");
const result = metrics?.find((gm) => gm.name === m)?.availability?.find((av) => av.cluster === c)?.subClusters?.includes(s) const result = metrics?.find((gm) => gm.name === m)?.availability?.find((av) => av.cluster === c)?.subClusters?.includes(s)
return !result return !result
@ -309,23 +309,22 @@ export function checkMetricDisabled(m, c, s) { //[m]etric, [c]luster, [s]ubclust
export function getStatsItems() { export function getStatsItems() {
// console.time('stats') // console.time('stats')
// console.log('getStatsItems ...')
const globalMetrics = getContext("globalMetrics") const globalMetrics = getContext("globalMetrics")
const result = globalMetrics.map((gm) => { const result = globalMetrics.map((gm) => {
if (gm?.footprint) { if (gm?.footprint) {
// Footprint contains suffix naming the used stat-type
// console.time('deep') // console.time('deep')
// console.log('Deep Config for', gm.name)
const mc = getMetricConfigDeep(gm.name, null, null) const mc = getMetricConfigDeep(gm.name, null, null)
// console.timeEnd('deep') // console.timeEnd('deep')
return { if (mc) {
field: gm.name + '_' + gm.footprint, return {
text: gm.name + ' (' + gm.footprint + ')', field: gm.name + '_' + gm.footprint,
metric: gm.name, text: gm.name + ' (' + gm.footprint + ')',
from: 0, metric: gm.name,
to: mc.peak, from: 0,
peak: mc.peak, to: mc.peak,
enabled: false peak: mc.peak,
enabled: false
}
} }
} }
return null return null
@ -336,11 +335,9 @@ export function getStatsItems() {
export function getSortItems() { export function getSortItems() {
//console.time('sort') //console.time('sort')
//console.log('getSortItems ...')
const globalMetrics = getContext("globalMetrics") const globalMetrics = getContext("globalMetrics")
const result = globalMetrics.map((gm) => { const result = globalMetrics.map((gm) => {
if (gm?.footprint) { if (gm?.footprint) {
// Footprint contains suffix naming the used stat-type
return { return {
field: gm.name + '_' + gm.footprint, field: gm.name + '_' + gm.footprint,
type: 'foot', type: 'foot',
@ -357,21 +354,22 @@ export function getSortItems() {
function getMetricConfigDeep(metric, cluster, subCluster) { function getMetricConfigDeep(metric, cluster, subCluster) {
const clusters = getContext("clusters"); const clusters = getContext("clusters");
if (cluster != null) { if (cluster != null) {
let c = clusters.find((c) => c.name == cluster); const c = clusters.find((c) => c.name == cluster);
if (subCluster != null) { if (subCluster != null) {
let sc = c.subClusters.find((sc) => sc.name == subCluster); const sc = c.subClusters.find((sc) => sc.name == subCluster);
return sc.metricConfig.find((mc) => mc.name == metric) return sc.metricConfig.find((mc) => mc.name == metric)
} else { } else {
let result; let result;
for (let sc of c.subClusters) { for (let sc of c.subClusters) {
const mc = sc.metricConfig.find((mc) => mc.name == metric) const mc = sc.metricConfig.find((mc) => mc.name == metric)
if (result) { // If lowerIsBetter: Peak is still maximum value, no special case required if (result && mc) { // update result; If lowerIsBetter: Peak is still maximum value, no special case required
result.alert = (mc.alert > result.alert) ? mc.alert : result.alert result.alert = (mc.alert > result.alert) ? mc.alert : result.alert
result.caution = (mc.caution > result.caution) ? mc.caution : result.caution result.caution = (mc.caution > result.caution) ? mc.caution : result.caution
result.normal = (mc.normal > result.normal) ? mc.normal : result.normal result.normal = (mc.normal > result.normal) ? mc.normal : result.normal
result.peak = (mc.peak > result.peak) ? mc.peak : result.peak result.peak = (mc.peak > result.peak) ? mc.peak : result.peak
} else { } else if (mc) {
if (mc) result = {...mc}; // start new result
result = {...mc};
} }
} }
return result return result
@ -381,13 +379,14 @@ function getMetricConfigDeep(metric, cluster, subCluster) {
for (let c of clusters) { for (let c of clusters) {
for (let sc of c.subClusters) { for (let sc of c.subClusters) {
const mc = sc.metricConfig.find((mc) => mc.name == metric) const mc = sc.metricConfig.find((mc) => mc.name == metric)
if (result) { // If lowerIsBetter: Peak is still maximum value, no special case required if (result && mc) { // update result; If lowerIsBetter: Peak is still maximum value, no special case required
result.alert = (mc.alert > result.alert) ? mc.alert : result.alert result.alert = (mc.alert > result.alert) ? mc.alert : result.alert
result.caution = (mc.caution > result.caution) ? mc.caution : result.caution result.caution = (mc.caution > result.caution) ? mc.caution : result.caution
result.normal = (mc.normal > result.normal) ? mc.normal : result.normal result.normal = (mc.normal > result.normal) ? mc.normal : result.normal
result.peak = (mc.peak > result.peak) ? mc.peak : result.peak result.peak = (mc.peak > result.peak) ? mc.peak : result.peak
} else { } else if (mc) {
if (mc) result = {...mc}; // Start new result
result = {...mc};
} }
} }
} }