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

75 lines
3.1 KiB
HTML

{{define "projects.html"}}<!doctype html>
<html lang="en"><head>{{template "head" .}}<title>Projects · HPC on Demand</title></head>
<body>
{{template "nav" .}}
<main>
<h1>Projects</h1>
<p class="deck">A project is the piece of work a cluster was for. Clusters can be
filed against one, and then the cost of a month's work is one number instead of
a list of names nobody remembers. Attaching one is never required.</p>
{{if .Err}}<div class="note crit"><p>{{.Err}}</p></div>{{end}}
<div class="card">
<div class="card-h"><span class="card-t">New project</span></div>
<div class="card-b">
<form method="post" action="/projects">
<input type="hidden" name="do" value="create">
<div class="fields">
<label class="f"><span>Name</span>
<input name="name" required autocomplete="off" placeholder="protein-folding"></label>
<label class="f"><span>What it is</span>
<input name="description" autocomplete="off"
placeholder="optional, for whoever reads this in six months"></label>
</div>
<button type="submit">Create</button>
</form>
</div>
</div>
{{if .Projects}}
<div class="card">
<div class="card-h"><span class="card-t">Yours</span>
<span class="age">{{len .Projects}} project(s)</span></div>
<table>
<thead><tr>
<th>Project</th><th>Tenant</th><th>Clusters</th><th>Core-hours</th>
<th>Opened</th><th>State</th><th>Actions</th>
</tr></thead>
<tbody>
{{range .Projects}}
<tr>
<td><strong>{{.Name}}</strong>
{{if .Description}}<br><span class="age">{{.Description}}</span>{{end}}</td>
<td>{{.TenantName}}</td>
<td class="num">{{.Clusters}}</td>
<td class="num">{{printf "%.1f" .CoreHours}}</td>
<td><span class="age">{{.CreatedAt.Format "2006-01-02"}} by {{.CreatedBy}}</span></td>
<td>{{if .Open}}<span class="pill ok">open</span>
{{else}}<span class="pill muted">closed</span>{{end}}</td>
<td>
{{if .Open}}
<form method="post" action="/projects" class="inline"
onsubmit="return confirm('Close {{.Name}}? Its history is kept; it stops being offered for new clusters.')">
<input type="hidden" name="do" value="close">
<input type="hidden" name="project" value="{{.ID}}">
<button type="submit" class="small">Close</button>
</form>
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
<div class="note"><p>Closing keeps everything a project holds and stops it being
offered for new clusters. There is no delete: a project with clusters against it
cannot go without taking their attribution with it, and that is the one thing
this record exists to keep.</p></div>
{{else if not .Err}}
<div class="note"><p>No projects yet. Clusters work perfectly well without one —
this is for when you want to know what a month of them added up to.</p></div>
{{end}}
</main></body></html>
{{end}}