HPC console for cluster status, Slurm jobs, workload history, and file browsing.
1.0K
HPC Console is a web app for viewing HPC cluster status, monitoring Slurm jobs, reviewing workload history, and browsing account folders. The web app and API run together in one container.
HPC_CONSOLE_RUN_REPORT_DIR to the folder that holds them. See Run reports.Without an HPC connection, the app uses sample data. With an HPC connection, it reads cluster and job information over SSH using read-only Slurm commands.
Install and start Docker, then use the Docker Hub account newbe36524 that publishes the image:
docker run --rm -p 8000:8000 newbe36524/hpc-console:latest
Docker downloads the image if it is not already on your machine. If the repository is private, run docker login first.
Open http://localhost:8000. The image starts in demo mode without HPC credentials. The API documentation is at http://localhost:8000/docs.
Settings come from environment variables or from a .env file. Environment variables take precedence over the .env file. A blank value counts as unset. Create your .env from the tracked template:
cp .env.example .env
.env is git-ignored and never copied into the image. .env.example lists every setting with a comment. These are the ones to set first:
| Variable | Default | Purpose |
|---|---|---|
HPC_CONSOLE_HPC_HOST | blank | Login node host name. Compose requires it |
HPC_CONSOLE_HPC_USER | blank | HPC account name. Compose requires it |
HPC_CONSOLE_HPC_PORT | 22 | SSH port of the login node |
HPC_CONSOLE_HOST_KEY | ~/.ssh/id_ed25519 | Host path of the unencrypted private key, mounted read-only |
HPC_CONSOLE_HOST_KNOWN_HOSTS | ~/.ssh/known_hosts | Host path of the known-hosts file, mounted read-only |
HPC_CONSOLE_UID / HPC_CONSOLE_GID | 1000 / 1000 | User and group the container runs as. Set them from id -u and id -g so the key stays readable and the data folders stay writable |
HPC_CONSOLE_PUBLISHED_PORT | 8000 | Host port for the console, bound to 127.0.0.1 only |
HPC_CONSOLE_RUN_REPORT_DIR | blank | Absolute folder of the run report CSVs. Read over SSH when an HPC is connected, otherwise from this host. Blank means no reports |
Without an HPC connection, docker run starts the console in demo mode with sample data. Compose always connects to the HPC, so it stops before starting when HPC_CONSOLE_HPC_HOST or HPC_CONSOLE_HPC_USER is blank.
The Compose file in this repository, docker-compose.yml, uses the Compose Specification. It has no top-level version: key, so do not add one. Use Docker Compose v2 (docker compose). The file was checked with Docker Compose v5.6.1.
From the repository root:
cp .env.example .env # then set HPC_CONSOLE_HPC_HOST and HPC_CONSOLE_HPC_USER
mkdir -p hpc-cache hpc-history # create the data folders yourself, so your user owns them
docker compose config --quiet # check the file and the .env values
docker compose up -d --build
Open http://127.0.0.1:8000, or the port set by HPC_CONSOLE_PUBLISHED_PORT. The container always listens on port 8000 inside. The console serves only after the startup connection check to the HPC passes. Read the logs with docker compose logs -f if it does not start. The service uses restart: unless-stopped, so it starts again after a reboot or a crash, and a stop from docker compose stop is kept.
The operator skill writes one CSV report per tracked HPC job, named <job_id>.csv, into the folder set by HPC_CONSOLE_RUN_REPORT_DIR. The console reads that folder in one of four ways, and the Run Reports API shows which one applies in its source field:
| Setting | Reports are read from | source |
|---|---|---|
| Directory set, HPC connected | The folder on the HPC, listed and read with fixed ls and cat over the existing SSH session | hpc_directory |
| Directory set, no HPC | A folder on this host, for example a mounted folder | local_directory |
| No directory, HPC connected | Nothing. The list is empty and no report is read | no_directory_configured |
| No directory, no HPC | Canned demo reports, marked simulated | simulated |
<job_id>.csv are read. Other files, subfolders and symbolic links are ignored, and a job id containing a separator or .. is refused with HTTP 422.GET /api/v1/runs lists the runs submitted in the window (1d, 7d by default, 30d or 90d), newest first, with an optional exact partition. It reads at most 100 of the newest files in the window. truncated is true when more exist.GET /api/v1/runs/{job_id} returns the samples in time order with a summary. GET /api/v1/runs/{job_id}/csv returns the stored file as text/csv.complete when its final row came from scheduler history, samples_only when it was closed from retained samples, and in_progress while the job has no final row. A report whose schema_version the console does not know is listed as unreadable.skipped_rows. A figure that cannot be computed is null, never 0.HPC_CONSOLE_RUN_REPORT_DIR. It never returns an empty list in that case.The column list, the value rules and the schema version are defined in the run-report contract of hpc-core. The console depends on the hpc-core package, which holds that contract and the shared metric formulas, so a change to the report format is made once, in hpc-core.
The console keeps one database, a SQLite file, and one cache file. Compose maps both folders from the repository root into the container:
| Host folder | Container folder | Variable (set by Compose) | Holds |
|---|---|---|---|
./hpc-history | /var/lib/hpc-console/history | HPC_CONSOLE_HISTORY_DIR | workload-history.sqlite3, the workload history database. It is the long-lived record, so keep it |
./hpc-cache | /var/cache/hpc-console | HPC_CONSOLE_CACHE_DIR | physical.json, the cached hardware layout. It is disposable: deleting it only causes a fetch from the HPC |
HPC_CONSOLE_*_DIR variables, so leave them blank in .env. To store the data elsewhere, change the host side of the volumes entries in docker-compose.yml, and keep the container side.HPC_CONSOLE_UID and HPC_CONSOLE_GID. If the history folder is not writable, or Docker creates it as root, the history stays in memory with a warning and is lost on restart.workload-history.sqlite3. You can also copy it while the container runs with sqlite3 workload-history.sqlite3 ".backup copy.sqlite3". Copy the history file on its own, not the whole cache folder.Requirements: Python 3.12 or newer, and Node.js 24 or newer. pnpm is not needed up front: Corepack, which ships with Node.js 24, runs the version pinned in frontend/package.json.
From the repository root:
cd backend
uv sync --extra dev
uv run python -m app
The API listens on http://127.0.0.1:8000. The backend's Python dependencies are managed with uv: uv sync --extra dev creates the environment and uv run runs a command in it, so no activation is needed. Run the backend tests with uv run pytest. To run against a local checkout of hpc-core instead of the pinned release, see Use a local hpc-core checkout.
The backend depends on a pinned release of hpc-core (hpc-core==... in backend/pyproject.toml, locked in uv.lock). To develop against a checkout at repos/hpc-core, beside repos/hpc-console in the monorepo, run the sync script from backend/:
cd backend
python3 scripts/sync_core.py
uv run --no-sync pytest
HPC_CONSOLE_CORE_SOURCE chooses the source. auto (the default) uses the checkout when it is there and the pinned release otherwise. local requires the checkout and fails without it. release always uses the pinned release, even when the checkout is there. The script installs the checkout editable, without dependencies, and prints the source and version in use. It never edits pyproject.toml or uv.lock.
uv sync and a plain uv run both sync the environment back to the pinned release, so run commands after the script with uv run --no-sync, for example uv run --no-sync python -m app. The Docker image and release builds install the pinned release from uv.lock and do not use the script.
In a second terminal, from the repository root:
cd frontend
corepack enable
pnpm install --frozen-lockfile
pnpm run dev
Open http://localhost:5173. Vite forwards API requests to the backend on port 8000. Interactive API documentation is available at http://127.0.0.1:8000/docs.
To preview the frontend without a Vite server on the host, run it in the node-dev-host container. The container builds frontend/ in a private copy and rebuilds on every save. It never writes to the project folder. Requests to /api and /health go to the hpc-console service on the same Compose network.
docker compose --profile dev-host up -d --build
Open http://127.0.0.1:43100, or the port set by HPC_CONSOLE_DEV_HOST_PORT. Check the last build with docker compose exec frontend-dev-host dev-host status, or read docker compose logs -f frontend-dev-host. The preview is for development only and is not a production server.
The preview uses the Caddy configuration in dev-host/Caddyfile. Its listen port must match HTTP_PORT in docker-compose.yml.
Both services use simulated data by default. To connect the backend to Slurm, create backend/.env with HPC_CONSOLE_HPC_HOST, HPC_CONSOLE_HPC_USER, and HPC_CONSOLE_HPC_KEY_PATH. Set all three together and provide a trusted host key with HPC_CONSOLE_HPC_KNOWN_HOSTS_PATH if it is not in the system known-hosts files. The key must be unencrypted. The backend checks the SSH connection at startup.
The Team page lists the profiles and nodes that share one team folder: which nodes are online, stale or offline, and how much of each profile's concurrency limit is in use. The page refreshes at the team's heartbeat interval and stops when you leave it. Run check inspects the shared folder and lists each result with its code and a hint. Activity shows the most recent team events, newest first.
The page is read-only. To join a team, set the HPC_CONSOLE_CLUSTER_* variables for the team's shared folder. Without them the page says that team coordination is not set up, and the rest of the console is unchanged.
| Variable | Default | Purpose |
|---|---|---|
HPC_CONSOLE_CLUSTER_ROOT | blank (off) | Absolute path of the team's shared area. The _cluster/ folder is created inside it. For the command store this is a path on the HPC; for the local store, a path on this host |
HPC_CONSOLE_CLUSTER_PROFILE | the HPC account | The profile this console belongs to: one person's HPC identity and its concurrency limit |
HPC_CONSOLE_CLUSTER_NODE_ID | generated at each start | Fixed node id. A generated id is the profile, console and eight random hex digits |
HPC_CONSOLE_CLUSTER_HEARTBEAT_SECONDS | 60 | Heartbeat interval, from 30 to 86400. A node is online within three intervals and stale within twenty |
HPC_CONSOLE_CLUSTER_CONCURRENCY_LIMIT | 1 | The profile's limit when the profile is first created, from 1 to 1024. An existing limit is kept |
HPC_CONSOLE_CLUSTER_STORE | command | command reaches the folder through the console's own HPC connection, so it needs the HPC settings. local reads a folder on this host and needs no HPC connection |
HPC_CONSOLE_CLUSTER_SHARE_QUEUE | blank (the account default) | This node's per-accelerator quota as type=number pairs, such as h200=1,h100=0. Setting it pins the node's profile and the Team page shows it as locked. A value above the account quota stops the console at startup. In multi mode it pins the first entry only |
HPC_CONSOLE_CLUSTER_ADVERTISED_URL | blank (none) | The page address this node advertises, such as http://127.0.0.1:43121. Each node writes it to _cluster/endpoints/ in the team folder, and the Team page lists every node's address as a link. The address is taken as written; reachability is not checked. |
HPC_CONSOLE_CLUSTER_PROFILE_MODE | blank (the saved choice, else single) | single or multi. Setting it locks the mode: the Team page and the API cannot change it, and a change answers 409. multi needs entries from HPC_CONSOLE_CLUSTER_PROFILES_FILE or from a saved choice |
HPC_CONSOLE_CLUSTER_PROFILES_FILE | blank | Absolute path of a JSON profile set: a mode and a profiles list. Setting it locks the mode and the entries. A mode setting that disagrees with the file stops startup |
The console refuses to start on an invalid value, and the error names the setting. A blank value counts as unset.
A node's profile is its share of the account's accelerator quota. The account quota is set by the team's operator. This node can ask for less: one row per accelerator type on the Team page sets its explicit quota, and the effective limit is the smaller of the node's quota and the account quota. A type the node does not list takes the account value.
PUT /api/v1/team/profile takes a JSON object such as {"h200": 1}. A value above the account quota is refused with status 422, and the error names the type. A refused request changes nothing.DELETE /api/v1/team/profile resets the node to the account default.HPC_CONSOLE_HISTORY_DIR, so it survives a restart. The first node keeps team-profile.json, and each other node keeps team-profile-<node id>.json. Without that directory it is kept in memory only. The file is never written to the team folder.pending, and the next heartbeat publishes it.HPC_CONSOLE_CLUSTER_SHARE_QUEUE pins the profile. A pinned profile is read-only in the API and the Team page, and PUT and DELETE return status 409.multi mode, GET, PUT and DELETE on /api/v1/team/profile take ?node_id= to choose one of the console's nodes. Without it the request addresses the first enabled node. A node this console does not run is answered with 404, and nothing changes.A console runs one team node in single mode, the default and the behaviour before profile sets existed. In multi mode it runs one node for each enabled entry of its profile set, up to 16 entries. An entry is one profile: its node id, display name, explicit node quota (share_queue), concurrency limit and an enabled flag. The nodes share one connection to the team folder, one lock and one heartbeat round. Each node registers and leaves on its own, and a failure in one node is reported in that node's state only.
GET /api/v1/team/profile-mode answers enabled, mode, locked, locked_by and profiles, one row per entry with profile_id, node_id, display_name, enabled, concurrency_limit, node_quota, source (default or explicit), state and locked. The state is starting, ok, unreachable, conflict, or disabled for an entry that runs no node. With team coordination off it answers 200 with enabled false.PUT /api/v1/team/profile-mode takes {"mode": "single"} or {"mode": "multi", "profiles": [...]}. An entry has a profile_id and may have node_id, display_name, share_queue (h200=1), concurrency_limit and enabled. An entry without a node_id gets a generated one, so send the ids back on later changes: a new id is a new node with no saved adjustment. single without a list keeps the first entry as the console's one node, and removes the other nodes.PUT /api/v1/team/profile-mode/entries/{node_id} takes {"enabled": true} or {"enabled": false} and goes through the same change path. A disabled entry keeps its quota and saved adjustment, its record leaves the team, and enabling it again registers it again. Disabling the last enabled entry is refused with 409, the switch is refused with 409 in single mode, and an unknown node id is 404.GET /api/v1/team/nodes adds self_node_ids, every node the console runs, and profile_mode. self_node_id stays the first node, and is_self is true for every node in self_node_ids.team-profile-mode.json in HPC_CONSOLE_HISTORY_DIR, never in the team folder, and is read back on restart. An unreadable file is ignored with a warning, and the console starts in single mode.single.multi with no entries, a profiles file that cannot be read or is refused, a mode setting that disagrees with the file, and an entry above the account quota when the account can be read.For testing team behaviour on one machine: three console nodes (hpc-console-a, hpc-console-b, hpc-console-c) run as three profiles (sim-a, sim-b, sim-c) on one HPC account. Each profile has its own data and its own share of the accelerator quota. The default single instance is unchanged, and docker compose up never starts the simulation.
Turn it on. Set HPC_CONSOLE_LOCAL_SIMULATION=three-profile in .env, or in the environment, which wins. A blank value or any other value keeps the simulation off, and every command then refuses without changing anything.
Commands. Run them from backend/, for example uv run python scripts/local_sim.py plan.
| Command | What it does |
|---|---|
plan | Reads the account quota and prints each profile's node quota. Writes nothing, to the team folder or to disk |
prepare | Reads the account quota, sets each profile's account record to it (only when it differs), copies the data for each profile and writes local-sim/pins.env |
up | Refuses while the default hpc-console service runs or a port is taken. Otherwise prepares and starts the three services |
down | Stops the three services and keeps every data copy |
status | One row per profile: node id, port, container state and node quota |
Data layout. prepare copies ./hpc-cache into local-sim/<profile>/cache, and workload-history.sqlite3 into local-sim/<profile>/history with SQLite's online backup from a read-only connection, so changes still in the write-ahead log are included. An existing copy is never replaced, and the originals are only read. local-sim/ is git-ignored and is not sent to the image build.
Quota rule. For h100 and h200 that the account holds, with quota N, sim-a and sim-b each pin floor(N/2) and sim-c pins the remainder N - 2*floor(N/2). For l40s, sim-c pins the whole quota and sim-a and sim-b pin none. A type the account lacks is not listed, and smaller types keep the account default. The pins go to HPC_CONSOLE_CLUSTER_SHARE_QUEUE of each service.
Ports and labels. HPC_CONSOLE_SIM_PORT_BASE (default 43121) gives three loopback ports, 43121 to 43123 by default. They must stay inside 43100-43299. Each service carries the node-dev-host.port and node-dev-host.name labels, so the ND Console control node lists three console nodes. HPC_CONSOLE_SIM_PREFIX (default sim) changes the profile id prefix.
Return to the single instance. Run local_sim.py down, unset the flag, then docker compose up -d. The local-sim/ copies stay on disk until you delete them.
Account records. The console checks a pin against its own profile's account quota at startup, so each simulated profile's record must hold the account quota. prepare sets sim-a, sim-b and sim-c to the account's quota with hpc-core's own record writer, and leaves a record alone when it already holds that quota. The record keeps its concurrency limit. A record that cannot be read is not overwritten, and nothing is started.
Reading the quota. The account quota is read with the console's own connection settings (HPC_CONSOLE_HPC_*, HPC_CONSOLE_HOST_KEY, HPC_CONSOLE_HOST_KNOWN_HOSTS) and the team folder named by HPC_CONSOLE_CLUSTER_ROOT. Reading never registers a node. With HPC_CONSOLE_CLUSTER_STORE=local the folder is read from this host.
Current limits.
HPC_CONSOLE_CLUSTER_ROOT must be set. Setting it in .env also turns it on for the default single console, so pass it on the command line for the simulation when the default console should stay off.Content type
Image
Digest
sha256:0158332de…
Size
56.8 MB
Last updated
27 days ago
docker pull newbe36524/hpc-console