mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 05:19:05 +01:00
move shared routine to utils.js, remove flop peak reduction
This commit is contained in:
parent
aa915d639d
commit
7c9182e0b0
@ -8,40 +8,6 @@
|
|||||||
- `height String?`: Height of the card [Default: '310px']
|
- `height String?`: Height of the card [Default: '310px']
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<script context="module">
|
|
||||||
function findJobThresholds(job, stat, metricConfig) {
|
|
||||||
if (!job || !metricConfig || !stat) {
|
|
||||||
console.warn("Argument missing for findJobThresholds!");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// metricConfig is on subCluster-Level
|
|
||||||
const defaultThresholds = {
|
|
||||||
peak: metricConfig.peak,
|
|
||||||
normal: metricConfig.normal,
|
|
||||||
caution: metricConfig.caution,
|
|
||||||
alert: metricConfig.alert
|
|
||||||
};
|
|
||||||
/*
|
|
||||||
Footprints should be comparable:
|
|
||||||
Always use unchanged single node thresholds for exclusive jobs and "avg" Footprints.
|
|
||||||
For shared jobs, scale thresholds by the fraction of the job's HWThreads to the node's HWThreads.
|
|
||||||
'stat' is one of: avg, min, max
|
|
||||||
*/
|
|
||||||
if (job.exclusive === 1 || stat === "avg") {
|
|
||||||
return defaultThresholds
|
|
||||||
} else {
|
|
||||||
const topol = getContext("getHardwareTopology")(job.cluster, job.subCluster)
|
|
||||||
const jobFraction = job.numHWThreads / topol.node.length;
|
|
||||||
return {
|
|
||||||
peak: round(defaultThresholds.peak * jobFraction, 0),
|
|
||||||
normal: round(defaultThresholds.normal * jobFraction, 0),
|
|
||||||
caution: round(defaultThresholds.caution * jobFraction, 0),
|
|
||||||
alert: round(defaultThresholds.alert * jobFraction, 0),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import {
|
import {
|
||||||
@ -55,7 +21,7 @@
|
|||||||
Row,
|
Row,
|
||||||
Col
|
Col
|
||||||
} from "@sveltestrap/sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
import { round } from "mathjs";
|
import { findJobFootprintThresholds } from "../utils.js";
|
||||||
|
|
||||||
export let job;
|
export let job;
|
||||||
export let displayTitle = true;
|
export let displayTitle = true;
|
||||||
@ -69,8 +35,7 @@
|
|||||||
const unit = (fmc?.unit?.prefix ? fmc.unit.prefix : "") + (fmc?.unit?.base ? fmc.unit.base : "")
|
const unit = (fmc?.unit?.prefix ? fmc.unit.prefix : "") + (fmc?.unit?.base ? fmc.unit.base : "")
|
||||||
|
|
||||||
// Threshold / -Differences
|
// Threshold / -Differences
|
||||||
const fmt = findJobThresholds(job, jf.stat, fmc);
|
const fmt = findJobFootprintThresholds(job, jf.stat, fmc);
|
||||||
if (jf.name === "flops_any") fmt.peak = round(fmt.peak * 0.85, 0);
|
|
||||||
|
|
||||||
// Define basic data -> Value: Use as Provided
|
// Define basic data -> Value: Use as Provided
|
||||||
const fmBase = {
|
const fmBase = {
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
} from "@urql/svelte";
|
} from "@urql/svelte";
|
||||||
import { setContext, getContext, hasContext, onDestroy, tick } from "svelte";
|
import { setContext, getContext, hasContext, onDestroy, tick } from "svelte";
|
||||||
import { readable } from "svelte/store";
|
import { readable } from "svelte/store";
|
||||||
|
import { round } from "mathjs";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call this function only at component initialization time!
|
* Call this function only at component initialization time!
|
||||||
@ -344,6 +345,38 @@ export function getStatsItems(presetStats = []) {
|
|||||||
return [...result];
|
return [...result];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function findJobFootprintThresholds(job, stat, metricConfig) {
|
||||||
|
if (!job || !metricConfig || !stat) {
|
||||||
|
console.warn("Argument missing for findJobThresholds!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// metricConfig is on subCluster-Level
|
||||||
|
const defaultThresholds = {
|
||||||
|
peak: metricConfig.peak,
|
||||||
|
normal: metricConfig.normal,
|
||||||
|
caution: metricConfig.caution,
|
||||||
|
alert: metricConfig.alert
|
||||||
|
};
|
||||||
|
/*
|
||||||
|
Footprints should be comparable:
|
||||||
|
Always use unchanged single node thresholds for exclusive jobs and "avg" Footprints.
|
||||||
|
For shared jobs, scale thresholds by the fraction of the job's HWThreads to the node's HWThreads.
|
||||||
|
'stat' is one of: avg, min, max
|
||||||
|
*/
|
||||||
|
if (job.exclusive === 1 || stat === "avg") {
|
||||||
|
return defaultThresholds
|
||||||
|
} else {
|
||||||
|
const topol = getContext("getHardwareTopology")(job.cluster, job.subCluster)
|
||||||
|
const jobFraction = job.numHWThreads / topol.node.length;
|
||||||
|
return {
|
||||||
|
peak: round(defaultThresholds.peak * jobFraction, 0),
|
||||||
|
normal: round(defaultThresholds.normal * jobFraction, 0),
|
||||||
|
caution: round(defaultThresholds.caution * jobFraction, 0),
|
||||||
|
alert: round(defaultThresholds.alert * jobFraction, 0),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function getSortItems() {
|
export function getSortItems() {
|
||||||
//console.time('sort')
|
//console.time('sort')
|
||||||
const globalMetrics = getContext("globalMetrics")
|
const globalMetrics = getContext("globalMetrics")
|
||||||
|
@ -8,64 +8,6 @@
|
|||||||
- `height String?`: Height of the card [Default: '310px']
|
- `height String?`: Height of the card [Default: '310px']
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<script context="module">
|
|
||||||
function findJobThresholds(job, metricConfig) {
|
|
||||||
if (!job || !metricConfig) {
|
|
||||||
console.warn("Argument missing for findJobThresholds!");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// metricConfig is on subCluster-Level
|
|
||||||
const defaultThresholds = {
|
|
||||||
peak: metricConfig.peak,
|
|
||||||
normal: metricConfig.normal,
|
|
||||||
caution: metricConfig.caution,
|
|
||||||
alert: metricConfig.alert
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
NEW: Footprints should be comparable: Always use Unchanged Single Node Thresholds, except for shared jobs.
|
|
||||||
HW Clocks, HW Temperatures and File/Net IO Thresholds will be scaled down too, even if they are independent.
|
|
||||||
'jf.stats' is one of: avg, min, max -> Always relative to one nodes' thresholds as configured.
|
|
||||||
*/
|
|
||||||
if (job.exclusive === 1) {
|
|
||||||
return defaultThresholds
|
|
||||||
} else {
|
|
||||||
const topol = getContext("getHardwareTopology")(job.cluster, job.subCluster)
|
|
||||||
const jobFraction = job.numHWThreads / topol.node.length;
|
|
||||||
return {
|
|
||||||
peak: round(defaultThresholds.peak * jobFraction, 0),
|
|
||||||
normal: round(defaultThresholds.normal * jobFraction, 0),
|
|
||||||
caution: round(defaultThresholds.caution * jobFraction, 0),
|
|
||||||
alert: round(defaultThresholds.alert * jobFraction, 0),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/* OLD: Based on Metric Aggregation Setting
|
|
||||||
// Job_Exclusivity does not matter, only aggregation
|
|
||||||
if (metricConfig.aggregation === "avg") {
|
|
||||||
return defaultThresholds;
|
|
||||||
} else if (metricConfig.aggregation === "sum") {
|
|
||||||
const topol = getContext("getHardwareTopology")(job.cluster, job.subCluster)
|
|
||||||
const jobFraction = job.numHWThreads / topol.node.length;
|
|
||||||
|
|
||||||
return {
|
|
||||||
peak: round(defaultThresholds.peak * jobFraction, 0),
|
|
||||||
normal: round(defaultThresholds.normal * jobFraction, 0),
|
|
||||||
caution: round(defaultThresholds.caution * jobFraction, 0),
|
|
||||||
alert: round(defaultThresholds.alert * jobFraction, 0),
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
console.warn(
|
|
||||||
"Missing or unkown aggregation mode (sum/avg) for metric:",
|
|
||||||
metricConfig,
|
|
||||||
);
|
|
||||||
return defaultThresholds;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import {
|
import {
|
||||||
@ -80,7 +22,7 @@
|
|||||||
TabPane
|
TabPane
|
||||||
} from "@sveltestrap/sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
import Polar from "../generic/plots/Polar.svelte";
|
import Polar from "../generic/plots/Polar.svelte";
|
||||||
import { round } from "mathjs";
|
import { findJobFootprintThresholds } from "../generic/utils.js";
|
||||||
|
|
||||||
export let job;
|
export let job;
|
||||||
export let jobMetrics;
|
export let jobMetrics;
|
||||||
@ -97,8 +39,7 @@
|
|||||||
const unit = (fmc?.unit?.prefix ? fmc.unit.prefix : "") + (fmc?.unit?.base ? fmc.unit.base : "")
|
const unit = (fmc?.unit?.prefix ? fmc.unit.prefix : "") + (fmc?.unit?.base ? fmc.unit.base : "")
|
||||||
|
|
||||||
// Threshold / -Differences
|
// Threshold / -Differences
|
||||||
const fmt = findJobThresholds(job, fmc);
|
const fmt = findJobFootprintThresholds(job, jf.stat, fmc);
|
||||||
if (jf.name === "flops_any") fmt.peak = round(fmt.peak * 0.85, 0);
|
|
||||||
|
|
||||||
// Define basic data -> Value: Use as Provided
|
// Define basic data -> Value: Use as Provided
|
||||||
const fmBase = {
|
const fmBase = {
|
||||||
|
Loading…
Reference in New Issue
Block a user