mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 05:19:05 +01:00
Resolve pullrequest comments
This commit is contained in:
parent
175a88f1c4
commit
6818d1de62
@ -52,10 +52,10 @@ type Job struct {
|
|||||||
BaseJob
|
BaseJob
|
||||||
StartTimeUnix int64 `json:"-" db:"start_time" example:"1649723812"` // Start epoch time stamp in seconds
|
StartTimeUnix int64 `json:"-" db:"start_time" example:"1649723812"` // Start epoch time stamp in seconds
|
||||||
StartTime time.Time `json:"startTime"` // Start time as 'time.Time' data type
|
StartTime time.Time `json:"startTime"` // Start time as 'time.Time' data type
|
||||||
MemUsedMax float64 `json:"memUsedMax" db:"mem_used_max"` // MemUsedMax as Float64
|
MemUsedMax float64 `json:"-" db:"mem_used_max"` // MemUsedMax as Float64
|
||||||
FlopsAnyAvg float64 `json:"flopsAnyAvg" db:"flops_any_avg"` // FlopsAnyAvg as Float64
|
FlopsAnyAvg float64 `json:"-" db:"flops_any_avg"` // FlopsAnyAvg as Float64
|
||||||
MemBwAvg float64 `json:"memBwAvg" db:"mem_bw_avg"` // MemBwAvg as Float64
|
MemBwAvg float64 `json:"-" db:"mem_bw_avg"` // MemBwAvg as Float64
|
||||||
LoadAvg float64 `json:"loadAvg" db:"load_avg"` // LoadAvg as Float64
|
LoadAvg float64 `json:"-" db:"load_avg"` // LoadAvg as Float64
|
||||||
NetBwAvg float64 `json:"-" db:"net_bw_avg"` // NetBwAvg as Float64
|
NetBwAvg float64 `json:"-" db:"net_bw_avg"` // NetBwAvg as Float64
|
||||||
NetDataVolTotal float64 `json:"-" db:"net_data_vol_total"` // NetDataVolTotal as Float64
|
NetDataVolTotal float64 `json:"-" db:"net_data_vol_total"` // NetDataVolTotal as Float64
|
||||||
FileBwAvg float64 `json:"-" db:"file_bw_avg"` // FileBwAvg as Float64
|
FileBwAvg float64 `json:"-" db:"file_bw_avg"` // FileBwAvg as Float64
|
||||||
|
@ -50,137 +50,78 @@
|
|||||||
|
|
||||||
// Unit
|
// Unit
|
||||||
const fmc = getContext('metrics')(job.cluster, fm)
|
const fmc = getContext('metrics')(job.cluster, fm)
|
||||||
let unit = null
|
let unit = ''
|
||||||
if (fmc?.unit?.base) {
|
if (fmc?.unit?.base) unit = fmc.unit.prefix + fmc.unit.base
|
||||||
unit = fmc.unit.prefix + fmc.unit.base
|
|
||||||
} else {
|
|
||||||
unit = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
// Threshold / -Differences
|
// Threshold / -Differences
|
||||||
const fmt = findJobThresholds(job, fmc, subclusterConfig)
|
const fmt = findJobThresholds(job, fmc, subclusterConfig)
|
||||||
const levelPeak = fm === 'flops_any' ? round((fmt.peak * 0.85), 0) - mv : fmt.peak - mv // Scale flops_any down
|
if (fm === 'flops_any') fmt.peak = round((fmt.peak * 0.85), 0)
|
||||||
const levelNormal = fmt.normal - mv
|
|
||||||
const levelCaution = fmt.caution - mv
|
|
||||||
const levelAlert = fmt.alert - mv
|
|
||||||
|
|
||||||
// Define basic data
|
// Define basic data
|
||||||
const fmBase = {
|
const fmBase = {
|
||||||
name: fm,
|
name: fm,
|
||||||
unit: unit,
|
unit: unit,
|
||||||
avg: mv,
|
avg: mv,
|
||||||
max: fm === 'flops_any' ? round((fmt.peak * 0.85), 0) : fmt.peak
|
max: fmt.peak
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect
|
if (evalFootprint(fm, mv, fmt, 'alert')) {
|
||||||
if (fm !== 'mem_used') { // Alert if usage is low, peak as maxmimum possible (scaled down for flops_any)
|
return {
|
||||||
if (levelAlert > 0) {
|
...fmBase,
|
||||||
return {
|
color: 'danger',
|
||||||
...fmBase,
|
message:`Metric average way ${fm === 'mem_used' ? 'above' : 'below' } expected normal thresholds.`,
|
||||||
color: 'danger',
|
impact: 3
|
||||||
message: 'Metric strongly below common levels!',
|
|
||||||
impact: 3
|
|
||||||
}
|
|
||||||
} else if (levelCaution > 0) {
|
|
||||||
return {
|
|
||||||
...fmBase,
|
|
||||||
color: 'warning',
|
|
||||||
message: 'Metric below common levels',
|
|
||||||
impact: 2
|
|
||||||
}
|
|
||||||
} else if (levelNormal > 0) {
|
|
||||||
return {
|
|
||||||
...fmBase,
|
|
||||||
color: 'success',
|
|
||||||
message: 'Metric within common levels',
|
|
||||||
impact: 1
|
|
||||||
}
|
|
||||||
} else if (levelPeak > 0) {
|
|
||||||
return {
|
|
||||||
...fmBase,
|
|
||||||
color: 'info',
|
|
||||||
message: 'Metric performs better than common levels',
|
|
||||||
impact: 0
|
|
||||||
}
|
|
||||||
} else { // Possible artifacts - <5% Margin OK, >5% warning, > 50% danger
|
|
||||||
if (fmBase.avg >= (1.5 * fmBase.max)) {
|
|
||||||
return {
|
|
||||||
...fmBase,
|
|
||||||
color: 'secondary',
|
|
||||||
message: 'Metric average at least 50% above common peak value: Check data for artifacts!',
|
|
||||||
impact: -2
|
|
||||||
}
|
|
||||||
} else if (fmBase.avg >= (1.05 * fmBase.max)) {
|
|
||||||
return {
|
|
||||||
...fmBase,
|
|
||||||
color: 'secondary',
|
|
||||||
message: 'Metric average at least 5% above common peak value: Check data for artifacts',
|
|
||||||
impact: -1
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
...fmBase,
|
|
||||||
color: 'info',
|
|
||||||
message: 'Metric performs better than common levels',
|
|
||||||
impact: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else { // Inverse Logic: Alert if usage is high, Peak is bad and limits execution
|
} else if (evalFootprint(fm, mv, fmt, 'caution')) {
|
||||||
if (levelPeak <= 0 && levelAlert <= 0 && levelCaution <= 0 && levelNormal <= 0) { // Possible artifacts - <5% Margin OK, >5% warning, > 50% danger
|
return {
|
||||||
if (fmBase.avg >= (1.5 * fmBase.max)) {
|
...fmBase,
|
||||||
return {
|
color: 'warning',
|
||||||
...fmBase,
|
message: `Metric average ${fm === 'mem_used' ? 'above' : 'below' } expected normal thresholds.`,
|
||||||
color: 'secondary',
|
impact: 2
|
||||||
message: 'Memory usage at least 50% above possible maximum value: Check data for artifacts!',
|
}
|
||||||
impact: -2
|
} else if (evalFootprint(fm, mv, fmt, 'normal')) {
|
||||||
}
|
return {
|
||||||
} else if (fmBase.avg >= (1.05 * fmBase.max)) {
|
...fmBase,
|
||||||
return {
|
color: 'success',
|
||||||
...fmBase,
|
message: 'Metric average within expected thresholds.',
|
||||||
color: 'secondary',
|
impact: 1
|
||||||
message: 'Memory usage at least 5% above possible maximum value: Check data for artifacts!',
|
}
|
||||||
impact: -1
|
} else if (evalFootprint(fm, mv, fmt, 'peak')) {
|
||||||
}
|
return {
|
||||||
} else {
|
...fmBase,
|
||||||
return {
|
color: 'info',
|
||||||
...fmBase,
|
message: 'Metric average above expected normal thresholds: Check for artifacts recommended.',
|
||||||
color: 'danger',
|
impact: 0
|
||||||
message: 'Memory usage extremely above common levels!',
|
}
|
||||||
impact: 4
|
} else {
|
||||||
}
|
return {
|
||||||
}
|
...fmBase,
|
||||||
} else if (levelAlert <= 0 && levelCaution <= 0 && levelNormal <= 0) {
|
color: 'secondary',
|
||||||
return {
|
message: 'Metric average above expected peak threshold: Check for artifacts!',
|
||||||
...fmBase,
|
impact: -1
|
||||||
color: 'danger',
|
|
||||||
message: 'Memory usage extremely above common levels!',
|
|
||||||
impact: 4
|
|
||||||
}
|
|
||||||
} else if (levelAlert > 0 && (levelCaution <= 0 && levelNormal <= 0)) {
|
|
||||||
return {
|
|
||||||
...fmBase,
|
|
||||||
color: 'danger',
|
|
||||||
message: 'Memory usage strongly above common levels!',
|
|
||||||
impact: 3
|
|
||||||
}
|
|
||||||
} else if (levelCaution > 0 && levelNormal <= 0) {
|
|
||||||
return {
|
|
||||||
...fmBase,
|
|
||||||
color: 'warning',
|
|
||||||
message: 'Memory usage above common levels',
|
|
||||||
impact: 2
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
...fmBase,
|
|
||||||
color: 'success',
|
|
||||||
message: 'Memory usage within common levels',
|
|
||||||
impact: 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function evalFootprint(metric, mean, thresholds, level) {
|
||||||
|
// mem_used has inverse logic regarding threshold levels
|
||||||
|
switch (level) {
|
||||||
|
case 'peak':
|
||||||
|
if (metric === 'mem_used') return (mean <= thresholds.peak && mean > thresholds.alert)
|
||||||
|
else return (mean <= thresholds.peak && mean > thresholds.normal)
|
||||||
|
case 'alert':
|
||||||
|
if (metric === 'mem_used') return (mean <= thresholds.alert && mean > thresholds.caution)
|
||||||
|
else return (mean <= thresholds.alert && mean > 0)
|
||||||
|
case 'caution':
|
||||||
|
if (metric === 'mem_used') return (mean <= thresholds.caution && mean > thresholds.normal)
|
||||||
|
else return (mean <= thresholds.caution && mean > thresholds.alert)
|
||||||
|
case 'normal':
|
||||||
|
if (metric === 'mem_used') return (mean <= thresholds.normal && mean > 0)
|
||||||
|
else return (mean <= thresholds.normal && mean > thresholds.caution)
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script context="module">
|
<script context="module">
|
||||||
@ -242,19 +183,13 @@
|
|||||||
<div class="cursor-help d-inline-flex" id={`footprint-${job.jobId}-${index}`}>
|
<div class="cursor-help d-inline-flex" id={`footprint-${job.jobId}-${index}`}>
|
||||||
<div class="mx-1">
|
<div class="mx-1">
|
||||||
<!-- Alerts Only -->
|
<!-- Alerts Only -->
|
||||||
{#if fpd.impact === 3}
|
{#if fpd.impact === 3 || fpd.impact === -1}
|
||||||
<Icon name="exclamation-triangle-fill" class="text-danger"/>
|
<Icon name="exclamation-triangle-fill" class="text-danger"/>
|
||||||
{:else if fpd.impact === 2}
|
{:else if fpd.impact === 2}
|
||||||
<Icon name="exclamation-triangle" class="text-warning"/>
|
<Icon name="exclamation-triangle" class="text-warning"/>
|
||||||
{:else if fpd.impact === -1}
|
|
||||||
<Icon name="exclamation-triangle" class="text-warning"/>
|
|
||||||
{:else if fpd.impact === -2}
|
|
||||||
<Icon name="exclamation-triangle-fill" class="text-danger"/>
|
|
||||||
{/if}
|
{/if}
|
||||||
<!-- Emoji for all states-->
|
<!-- Emoji for all states-->
|
||||||
{#if fpd.impact === 4}
|
{#if fpd.impact === 3}
|
||||||
<Icon name="emoji-angry" class="text-danger"/>
|
|
||||||
{:else if fpd.impact === 3}
|
|
||||||
<Icon name="emoji-frown" class="text-danger"/>
|
<Icon name="emoji-frown" class="text-danger"/>
|
||||||
{:else if fpd.impact === 2}
|
{:else if fpd.impact === 2}
|
||||||
<Icon name="emoji-neutral" class="text-warning"/>
|
<Icon name="emoji-neutral" class="text-warning"/>
|
||||||
@ -263,14 +198,12 @@
|
|||||||
{:else if fpd.impact === 0}
|
{:else if fpd.impact === 0}
|
||||||
<Icon name="emoji-laughing" class="text-info"/>
|
<Icon name="emoji-laughing" class="text-info"/>
|
||||||
{:else if fpd.impact === -1}
|
{:else if fpd.impact === -1}
|
||||||
<Icon name="emoji-dizzy" class="text-warning"/>
|
|
||||||
{:else if fpd.impact === -2}
|
|
||||||
<Icon name="emoji-dizzy" class="text-danger"/>
|
<Icon name="emoji-dizzy" class="text-danger"/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<!-- Print Values -->
|
<!-- Print Values -->
|
||||||
{fpd.avg} / {fpd.max} {fpd.unit} <!-- To increase margin to tooltip: No other way manageable ...-->
|
{fpd.avg} / {fpd.max} {fpd.unit} <!-- To increase margin to tooltip: No other way manageable ... -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Tooltip target={`footprint-${job.jobId}-${index}`} placement="right" offset={[0, 20]}>{fpd.message}</Tooltip>
|
<Tooltip target={`footprint-${job.jobId}-${index}`} placement="right" offset={[0, 20]}>{fpd.message}</Tooltip>
|
||||||
|
Loading…
Reference in New Issue
Block a user