Files
ilkerandClaude Opus 5 d67af5d6c3 hpcod: projects, and what a cluster cost
"How much did the protein run use" is a question about a piece of
work, not about c003-15. A tenant asks for clusters over months;
individually each one is an address, some hardware and a lease, and
nothing joined them up.

A project groups them, and is optional throughout. Somebody who wants
one cluster for an afternoon should not have to invent a project to
get it, and requiring one would mean every tenant carrying a
"default" that means nothing. The form does not even ask when there
are none: a field whose only option is "none" is a question with one
answer.

The cost side needed no new columns. The cluster record already said
when it was created and destroyed, and cluster_vm said how many cores
and how much memory it held; what was missing was anything that read
them. cluster_usage is that, and it is a view rather than a table
because a derived number stored is a number that can disagree with
what it was derived from. It works retroactively - every cluster this
estate has ever built now has a line.

Core-hours are reserved, not executed, and the view says so. That is
the honest unit for an on-demand cluster: the hardware was yours and
nobody else could have it, whether or not a job ran. What was
actually executed is a Slurm accounting question and there is no
slurmdbd.

The project is attached inside the allocating transaction, for the
same reason the placement and the applications are, and it is checked
there to be the tenant's own and still open - a cluster filed against
somebody else's project leaks what they are working on. Closing keeps
history and stops it being offered. There is no delete: the reference
from cluster is RESTRICT, because a project removed from under its
clusters leaves their cost attributed to nothing, and afterwards is
when the question gets asked.

A release now writes manifest.json beside home.tgz: the nodes, the
wall time, the core-hours. The database knows all of it and outlives
the cluster, but the tarball can be moved off this host and the
description travels with it. Not fatal if it fails - the data is
already safe by then, and holding hardware because a note could not
be written is the wrong trade.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 13:05:35 +02:00

48 lines
1.9 KiB
HTML

{{define "usage.html"}}<!doctype html>
<html lang="en"><head>{{template "head" .}}<title>Usage · HPC on Demand</title></head>
<body>
{{template "nav" .}}
<main>
<h1>Usage</h1>
<p class="deck">What each cluster held and for how long, including the ones that are
gone — the record outlives the machines, which is the point of keeping it.
Core-hours are <em>reserved</em>, not executed: the hardware was yours whether or
not a job ran on it.</p>
{{if .Err}}<div class="note crit"><p>{{.Err}}</p></div>{{end}}
{{if .Usage}}
<div class="card">
<div class="card-h"><span class="card-t">Clusters</span>
<span class="age">{{len .Usage}} row(s), newest first</span></div>
<table>
<thead><tr>
<th>Cluster</th><th>Tenant</th><th>Project</th><th>Nodes</th>
<th>Cores</th><th>Memory</th><th>Wall</th>
<th>Core-hours</th><th>GB-hours</th><th>State</th>
</tr></thead>
<tbody>
{{range .Usage}}
<tr>
<td><code>{{.AccountingName}}</code><br>
<span class="age">{{.CreatedAt.Format "2006-01-02 15:04"}}</span></td>
<td>{{.TenantName}}</td>
<td>{{if .ProjectName}}{{.ProjectName}}{{else}}<span class="age">—</span>{{end}}</td>
<td class="num">{{.VMs}}</td>
<td class="num">{{.Cores}}</td>
<td class="num">{{.MemoryGB}} GiB</td>
<td class="num">{{shortdur .Wall}}</td>
<td class="num">{{printf "%.2f" .CoreHours}}</td>
<td class="num">{{printf "%.1f" .GBHours}}</td>
<td><span class="pill {{if eq .State "ready"}}ok{{else if eq .State "deleted"}}muted{{else if eq .State "failed"}}crit{{else}}warn{{end}}">{{.State}}</span></td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{else if not .Err}}
<div class="note"><p>Nothing recorded yet.</p></div>
{{end}}
</main></body></html>
{{end}}