Files
ilkerandClaude Opus 5 9ad16290bf hpcod: oversubscription is a policy you can change, not a line in a file
It was enabled - 168 cores offered from 28, 655 GiB from 504 - but only
because I edited sites.yaml on the server and restarted the service. So
changing it needed a shell, an editor and a restart, which means it needed
whoever had those rather than whoever had the judgement. It is a judgement
about how much of the hardware to promise, it moves with load, and it
belongs where the person making it can reach it.

It is now a row per site, set from the Sites page by an administrator, and
it takes effect on the next discovery sweep rather than the next restart.

The ratio is applied after discovery instead of inside the provider, which
is what makes that possible - and because it recomputes from the physical
core and memory counts rather than from whatever Cores already held,
applying it twice gives the same answer as applying it once. Without that
the provider's own default would compound with it.

The file stays as the default. A site with no row shows what the catalogue
gave it, read back from the numbers rather than claimed, and says so: "from
the site catalogue - nobody has set this" against "set by ilker". One
authority at a time, and the page says which.

The rules the config loader already enforced are enforced here too, in the
database rather than in the handler: a policy that reads as off cannot
still multiply, and turning it off resets the ratios instead of leaving
numbers behind that would take effect again for whoever turns it back on.
Memory is capped at 8x where CPU is capped at 64x, because oversubscribed
cores make jobs slow and oversubscribed memory makes them die.

Also fixed a test that was crying wolf: the public-page leak check matched
bare substrings, so adding a "label" rule to the stylesheet looked like the
tenant name "lab" appearing on the front door. It matches word boundaries
now - a test that raises false alarms gets weakened until it stops catching
anything.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 12:54:24 +02:00

105 lines
4.7 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html><html lang="en"><head><title>Sites · HPC on Demand</title>{{template "head" .}}</head>
<body>{{template "nav" .}}
<main>
<h1>Backing clouds</h1>
<p class="deck">What the portal can place tenants on. Discovery is read-only and runs on a timer;
nothing here provisions anything.</p>
{{range .Sites}}
<div class="card">
<div class="card-h">
<span class="card-t">{{.ID}}</span>
<span class="pill muted">{{.Kind}}</span>
{{if not .Reachable}}<span class="pill crit">unreachable</span>
{{else if not .Healthy}}<span class="pill warn">not quorate</span>
{{else}}<span class="pill ok">ok</span>{{end}}
<span class="spacer"></span>
<span class="age">{{.Name}}</span>
</div>
<div class="card-b">
{{if .Error}}<div class="note crit"><p class="mono">{{.Error}}</p></div>{{end}}
{{if .Reachable}}
<p style="margin:0 0 12px">
<strong>{{.TotalFreeCores}}</strong> free cores ·
<strong>{{gib .TotalFreeMemBytes}}</strong> free memory ·
schedulable: {{$c := caps .Capabilities}}{{if $c}}{{range $c}}<span class="pill ok">{{.}}</span> {{end}}{{else}}<span class="pill muted">none</span>{{end}}
{{$u := unconfirmed .}}{{if $u}}<br>
<span style="color:var(--warn)">withheld:</span> {{range $u}}<span class="pill warn">{{.}}</span> {{end}}
<span class="age">— present but not verified by a node agent, so not schedulable</span>
{{end}}
</p>
<table>
<thead><tr><th>Node</th><th>Cores</th><th>Memory</th><th>CPU</th><th>Devices</th></tr></thead>
<tbody>
{{range .Nodes}}
<tr>
<td><strong>{{.Name}}</strong>{{if not .Online}} <span class="pill crit">offline</span>{{end}}</td>
<td class="num">{{freecores .}} / {{.Cores}}</td>
<td class="num">{{gib (freemem .)}} / {{gib .MemBytes}}</td>
<td class="age">{{.CPUModel}}</td>
<td>
{{range .Devices}}
<div style="margin-bottom:3px">
{{if trusted .}}<span class="pill ok">{{.Capability}}</span>
{{else}}<span class="pill warn">{{.Capability}}</span>{{end}}
<code>{{.NativeID}}</code>
<span class="age">{{.Model}}</span>
{{if not .Passthrough}}<span class="pill crit">shared IOMMU</span>{{end}}
<span class="age">via {{.Confidence}}</span>
</div>
{{else}}<span class="age">—</span>{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
{{end}}
</div>
</div>
{{end}}
<h2>Oversubscription</h2>
<p class="deck">How much of each site may be promised beyond what it has.
Oversubscribed cores make jobs slow; oversubscribed memory makes them die,
which is why the two are capped differently.</p>
{{range .Policies}}
<div class="card">
<div class="card-h">
<span class="card-t">{{.Site}}</span>
{{if .Enabled}}<span class="pill warn">oversubscribed</span>
{{else}}<span class="pill ok">strict</span>{{end}}
<span class="spacer"></span>
<span class="age">{{if .FromFile}}from the site catalogue — nobody has set this
{{else}}set by {{.UpdatedBy}}{{end}}</span>
</div>
<div class="card-b">
<table><thead><tr><th></th><th>Hardware</th><th>Offered</th><th>Ratio</th></tr></thead>
<tbody>
<tr><td>Cores</td><td class="num">{{.PhysicalCores}}</td>
<td class="num">{{.OfferedCores}}</td><td class="num">×{{printf "%.2f" .CPU}}</td></tr>
<tr><td>Memory</td><td class="num">{{.PhysicalMemGB}} GiB</td>
<td class="num">{{.OfferedMemGB}} GiB</td><td class="num">×{{printf "%.2f" .Mem}}</td></tr>
</tbody>
</table>
{{if $.IsAdmin}}
<form method="post" action="/admin/site-policy" style="margin-top:12px">
<input type="hidden" name="site" value="{{.Site}}">
<label class="check"><input type="checkbox" name="enabled" {{if .Enabled}}checked{{end}}> Allow oversubscription</label>
<label class="ratio">CPU ×<input type="number" name="cpu" step="0.1" min="1" max="64" value="{{printf "%.2f" .CPU}}"></label>
<label class="ratio">Memory ×<input type="number" name="mem" step="0.1" min="1" max="8" value="{{printf "%.2f" .Mem}}"></label>
<button type="submit" class="small">Apply</button>
</form>
<p class="age" style="margin:8px 0 0">Takes effect immediately; the numbers
above update on the next discovery sweep.</p>
{{else}}
<p class="age" style="margin:8px 0 0">Only an administrator can change this.</p>
{{end}}
</div>
</div>
{{end}}
</main></body></html>