Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/plugin-ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,8 @@ jobs:

# The plugin's own transports, built from a cluster record as the reader
# builds them: the client commands through docker exec into slurmctld,
# and slurmrestd on loopback with the token file.
# and slurmrestd on loopback with the token file. It also checks parser
# discovery and, on 26.05, a conditional nodes read that answers 304.
- name: Collect a snapshot with the plugin's transports
run: php plugin/tests/slurm-live/collect.php "$GITHUB_WORKSPACE/plugin" "$RUNNER_TEMP/slurm-out" "$RUNNER_TEMP/hpcsched-tokens/live.token"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Out of scope: any scheduler write path (submit, cancel, hold, drain, resume), a
|---|---|
| Cacti | 1.2.31 or later, no core patches |
| PHP | 8.2 or later; `setup.php` stays parseable on 8.0 so an unsupported runtime gets a refusal instead of a broken Cacti UI |
| Slurm | Provisionally 25.05, 25.11, and 26.05 (decision #8 is open). The data parser is a setting: v0.0.43 by default, which SchedMD removes in 27.05, or v0.0.44 or v0.0.45 on releases that ship them |
| Slurm | 25.05, 25.11, and 26.05, the three latest releases ([ADR 0013](docs/decisions/0013-three-latest-slurm-releases.md)); 25.11 and 26.05 are tested against a live cluster, 25.05 against fixtures only. Client commands are the default transport ([ADR 0012](docs/decisions/0012-client-commands-default-transport.md)) and use the data parser setting: v0.0.43 by default, which SchedMD removes in 27.05, or v0.0.44 or v0.0.45 on releases that ship them. slurmrestd clusters discover the newest parser the daemon serves |
| Thold, Maint | No Thold change; Maint integration is a proposal that needs Maint maintainers' agreement |

## Design
Expand Down
16 changes: 8 additions & 8 deletions docs/PLAN.md

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions docs/decisions/0012-client-commands-default-transport.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 0012. Read Slurm through its client commands by default

Status: Accepted (2026-11-15). Decides [#7](https://github.com/somethingwithproof/plugin_hpcsched/issues/7).

## Context

The plugin reads Slurm through one of two transports that produce the same snapshot ([ADR 0004](0004-scheduler-backend-interface.md)): the client commands (`squeue`, `scontrol`, `sshare`) run on the poller host, or HTTP GET requests to `slurmrestd`. A new cluster record needs one of them as its default.

From milestone 1's source reading ([slurmrestd.md](../research/slurmrestd.md), [slurm-releases.md](../research/slurm-releases.md)):

- The client commands authenticate with the poller host's own munge or auth/slurm setup, so the plugin handles no credential. They need the Slurm client package and configuration on every poller that reads a cluster.
- `slurmrestd` needs a token, which the plugin reads from a file and never stores ([ADR 0009](0009-credentials-by-file-or-munge-never-minted.md)), and an exact path allowlist, because some GET paths change state (`reconfigure/`, and `job/{id}/requeue` on 26.05). Native TLS exists only from 25.05 and only when the build includes s2n. Many sites do not run `slurmrestd` at all.

Milestone 3's live job read 26.05.5 and 25.11.8 clusters through both transports with matching snapshots. It did not compare their load on the controller.

## Decision

Client commands are the default transport for a new cluster. `slurmrestd` stays a per-cluster choice for sites that run it, cannot install the client on the poller, or want to keep munge keys off it.

The data parser setting applies to client commands. A `slurmrestd` cluster discovers the newest parser its daemon serves among those the plugin supports (PLAN, Transports).

## Consequences

- A default cluster needs no token, TLS material, or allowlist review.
- The poller host must have a working Slurm client and configuration for each cluster read through client commands, and the documentation says so.
- Controller load from the two transports is unmeasured. If a site shows `slurmrestd` is cheaper, that changes the recommendation for large clusters, not this default.

## Alternatives rejected

- **`slurmrestd` by default.** It needs a token on the poller and a daemon many sites do not run, and its GET surface includes state-changing paths.
- **No default (require a choice).** Every new cluster would need a decision before it is read, with no difference in the snapshot to justify one.
34 changes: 34 additions & 0 deletions docs/decisions/0013-three-latest-slurm-releases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 0013. Support the three latest Slurm releases

Status: Accepted (2026-11-15). Decides [#8](https://github.com/somethingwithproof/plugin_hpcsched/issues/8).

## Context

Slurm releases every six months and SchedMD supports each for about 18 months ([upgrade guide](https://slurm.schedmd.com/upgrades.html)). The data parsers change with each release ([slurm-releases.md](../research/slurm-releases.md)):

| Release | Data parsers | End of support (SchedMD) |
|---|---|---|
| 25.05 | v0.0.40 to v0.0.43 | November 2026 |
| 25.11 | v0.0.41 to v0.0.44 | May 2027 |
| 26.05 | v0.0.42 to v0.0.45 | listed as November 2028, which contradicts the 18 month rule |

Milestone 3's live job runs a real cluster for 26.05.5 (published image) and 25.11.8 (built from source). No matching cluster configuration exists for 25.05, so it is covered by synthetic fixtures only.

## Decision

The plugin supports the three latest Slurm releases: 25.05, 25.11, and 26.05. It reads data parsers v0.0.43, v0.0.44, and v0.0.45, so every supported release has at least one parser the plugin reads, and v0.0.43 is common to all three.

- 26.05 and 25.11 are tested against a live cluster through both transports.
- 25.05 is tested against fixtures only, and the README says so.
- When a new release is published, support moves to the three latest: the oldest release leaves the set, and the parser list follows.

## Consequences

- A cluster on 24.11 or earlier is not read: its client commands do not accept the pinned parser, and discovery finds no supported parser on its `slurmrestd`. Each run fails with an error class, never with a shape the plugin does not know.
- 25.05 reaches SchedMD's end of support this month and leaves the set when 26.11 is released. Until then a 25.05 regression shows only as a fixture change.
- SchedMD removes v0.0.43 in 27.05, so the client command default (v0.0.43) must move before the plugin supports 27.05.

## Alternatives rejected

- **SchedMD's supported releases only.** It would drop 25.05 this month while sites still run it, and the date for 26.05 is not reliable.
- **Every release that ships a parser the plugin reads.** It ties support to parser lifetimes, which are longer than SchedMD's support and are not tested.
2 changes: 2 additions & 0 deletions docs/decisions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ Each record captures one architecture decision: its context, the decision, its c
| [0009](0009-credentials-by-file-or-munge-never-minted.md) | Read scheduler credentials from the host, never store or mint them | Accepted |
| [0010](0010-bound-series-cardinality.md) | Bound the number of RRD series the plugin creates | Accepted |
| [0011](0011-pending-reason-families-and-counting.md) | Group pending reasons into eleven fixed families and fix the counting rules | Accepted |
| [0012](0012-client-commands-default-transport.md) | Read Slurm through its client commands by default | Accepted |
| [0013](0013-three-latest-slurm-releases.md) | Support the three latest Slurm releases | Accepted |

Open decisions are tracked as issues labelled `type: decision`.
4 changes: 2 additions & 2 deletions docs/research/slurmrestd.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Research for [#17](https://github.com/somethingwithproof/plugin_hpcsched/issues/17), run 2026-11-15. Question: do the endpoints, headers, version discovery, and conditional queries behave as documented, and what can a minimally privileged account see?

**Result.** Every endpoint, header, and default in the plan's REST table was found in source, with two corrections and one finding that changes the security design. Correction one: the 304 response to `update_time` on `/nodes` exists only from 26.05. On 24.11, 25.05, and 25.11 the same query goes through the generic error path, so the plugin must not rely on it unless it has checked the release. Correction two: native TLS is 25.05 and later, and needs the s2n library at build time. The finding: "GET-only" is not a safe allowlist. `GET /slurm/{parser}/reconfigure/` asks `slurmctld` to reconfigure, and on 26.05 `GET /slurm/{parser}/job/{job_id}/requeue` requeues a job. The plugin needs an exact list of path and method pairs, not a method rule. Least-privilege visibility, token behavior for a user with no association, and failure modes are *live*.
**Result.** Every endpoint, header, and default in the plan's REST table was found in source, with two corrections and one finding that changes the security design. Correction one: the 304 response to `update_time` on `/nodes` is safe to use only from 26.05.3. The initial 26.05 releases also fail when partitions are unchanged (see Conditional queries below). On 24.11, 25.05, and 25.11 the same query goes through the generic error path, so the plugin must not rely on it unless it has checked the release. Correction two: native TLS is 25.05 and later, and needs the s2n library at build time. The finding: "GET-only" is not a safe allowlist. `GET /slurm/{parser}/reconfigure/` asks `slurmctld` to reconfigure, and on 26.05 `GET /slurm/{parser}/job/{job_id}/requeue` requeues a job. The plugin needs an exact list of path and method pairs, not a method rule. Least-privilege visibility, token behavior for a user with no association, and failure modes are *live*.

## Method

Expand Down Expand Up @@ -51,7 +51,7 @@ Final allowlist for the plugin (exact method and path, no pattern match): `GET /
| Fact | Evidence | Status |
|---|---|---|
| `update_time` is an accepted query parameter on jobs, partitions, nodes, reservations, and config | `add_parse(TIMESTAMP, update_time, ...)` at [v0.0.45 parsers.c lines 11273 to 11318](https://github.com/SchedMD/slurm/blob/599e8ac50eaff5547946f3f0687d9fe3bf44347f/src/plugins/data_parser/v0.0.45/parsers.c#L11273-L11318) | confirmed |
| `/nodes` returns 304 with an empty body when nothing changed | 26.05 [nodes.c lines 116 to 133](https://github.com/SchedMD/slurm/blob/599e8ac50eaff5547946f3f0687d9fe3bf44347f/src/slurmrestd/plugins/openapi/slurmctld/nodes.c#L116-L133) and [operations.c lines 362 to 377](https://github.com/SchedMD/slurm/blob/599e8ac50eaff5547946f3f0687d9fe3bf44347f/src/slurmrestd/operations.c#L362-L377); the 26.11 candidate has the same code | confirmed for 26.05 and later |
| `/nodes` returns 304 with an empty body when nothing changed | 26.05 [nodes.c lines 116 to 133](https://github.com/SchedMD/slurm/blob/599e8ac50eaff5547946f3f0687d9fe3bf44347f/src/slurmrestd/plugins/openapi/slurmctld/nodes.c#L116-L133) and [operations.c lines 362 to 377](https://github.com/SchedMD/slurm/blob/599e8ac50eaff5547946f3f0687d9fe3bf44347f/src/slurmrestd/operations.c#L362-L377); the 26.11 candidate has the same code | confirmed from 26.05.3; 26.05.0 to 26.05.2 send an unchanged answer to `resp_error` and pass `update_time` to the partition read too, an HTTP 500 when only partitions are unchanged ([26.05.3 changelog](https://github.com/SchedMD/slurm/blob/slurm-26-05-3-1/CHANGELOG/slurm-26.05.md)) |
| On 24.11, 25.05, and 25.11 the nodes handler has no such branch: a failed `slurm_load_node` goes to `resp_error` with `errno` | [25.11 nodes.c lines 116 to 122](https://github.com/SchedMD/slurm/blob/5f7be9109e151bc59099786d7e3faccbca105869/src/slurmrestd/plugins/openapi/slurmctld/nodes.c#L116-L122) | **differs** from the plan; what status code a client then sees is *live* |
| `/jobs/` returns 200 with a warning ("No job changes since update_time") when nothing changed | [26.05 jobs.c lines 131 to 140](https://github.com/SchedMD/slurm/blob/599e8ac50eaff5547946f3f0687d9fe3bf44347f/src/slurmrestd/plugins/openapi/slurmctld/jobs.c#L131-L140); present at 24.11 to 26.05 | confirmed |
| `/partitions/` and `/reservations/` have no `SLURM_NO_CHANGE_IN_DATA` branch at any release checked | `git grep` over the four tags | confirmed |
Expand Down
13 changes: 10 additions & 3 deletions lib/CommandTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
namespace Somethingwithproof\Hpcsched;

/**
* Reads Slurm through its client commands, the default transport (decision
* #7, provisional). Authentication is the poller host's own munge or
* Reads Slurm through its client commands, the default transport (ADR
* 0012). Authentication is the poller host's own munge or
* auth/slurm setup; no credential passes through the plugin.
*
* Every argument vector is fixed here: the binary is an absolute path from
Expand Down Expand Up @@ -125,7 +125,14 @@
return $env;
}

public function fetch(Section $section, string $dataParser, float $deadline): string {
/**
* The client commands have no conditional read.
*/
public function since(Section $section, ?SectionRecord $previous, string $release, int $now): int {

Check warning on line 131 in lib/CommandTransport.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Move this open curly brace to the beginning of the next line.

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaHiRZFOj4Bbu5Glib46&open=AaHiRZFOj4Bbu5Glib46&pullRequest=75
return 0;
}

public function fetch(Section $section, string $dataParser, float $deadline, int $since = 0): string {

Check warning on line 135 in lib/CommandTransport.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Move this open curly brace to the beginning of the next line.

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaHiRZFOj4Bbu5Glib47&open=AaHiRZFOj4Bbu5Glib47&pullRequest=75
if ($this->slurmConf !== '' && !Settings::pathAcceptable($this->slurmConf)) {
throw new TransportError(ErrorClass::Config, 'slurm.conf path');
}
Expand Down
39 changes: 38 additions & 1 deletion lib/DataParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/**
* The Slurm data parser the plugin pins, chosen in Settings from the
* versions below. v0.0.43 is the default because every supported release
* (25.05, 25.11, 26.05; decision #8, provisional) ships it, so one setting
* (25.05, 25.11, 26.05; ADR 0013) ships it, so one setting
* serves a mixed site and an upgraded client package cannot change the shape
* under the plugin (docs/research/slurm-client-output.md). SchedMD removes
* v0.0.43 in 27.05, so a site on 25.11 or later can move to a newer parser
Expand Down Expand Up @@ -51,6 +51,43 @@
return in_array($version, self::VERSIONS, true);
}

/**
* The supported versions, newest first: the order slurmrestd discovery
* tries them in (REQ-REST-002).
*
* @return list<string>
*/
public static function newestFirst(): array {

Check warning on line 60 in lib/DataParser.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Move this open curly brace to the beginning of the next line.

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaHiRY_Ij4Bbu5Glib4t&open=AaHiRY_Ij4Bbu5Glib4t&pullRequest=75
return array_reverse(self::VERSIONS);
}

/**
* The newest supported version a supported release ships, or null for a
* release the plugin does not support.
*/
public static function newestShippedBy(string $release): ?string {

Check warning on line 68 in lib/DataParser.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Move this open curly brace to the beginning of the next line.

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaHiRY_Ij4Bbu5Glib4u&open=AaHiRY_Ij4Bbu5Glib4u&pullRequest=75
foreach (self::newestFirst() as $version) {
if (self::shippedBy($release, $version)) {
return $version;
}
}

return null;
}

/**
* Whether a release is the given release or a later one, for example
* "26.05.5" against "26.05.3". A release without a patch level counts
* as its .0, and an unparsable release answers false.
*/
public static function atLeast(string $release, string $version): bool {

Check warning on line 83 in lib/DataParser.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Move this open curly brace to the beginning of the next line.

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaHiRY_Ij4Bbu5Glib4v&open=AaHiRY_Ij4Bbu5Glib4v&pullRequest=75
if (preg_match('/^(\d{2})\.(\d{2})(?:\.(\d+))?(?:[^\d.]|$)/', $release, $m) !== 1) {
return false;
}

return version_compare($m[1] . '.' . $m[2] . '.' . ($m[3] ?? '0'), $version, '>=');
}

/**
* Whether a reported release (for example "25.11.2") is a supported
* major release.
Expand Down
16 changes: 15 additions & 1 deletion lib/HealthPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
(string) ($run->calls ?? 0),
($run->release ?? '') === '' ? '-' : (string) $run?->release,
$cluster->transport->label(),
($run->dataParser ?? '') === '' ? '-' : (string) $run?->dataParser,
self::parser($cluster, $run),
Format::age($run->lastSuccess ?? 0, $now),
]);

Expand Down Expand Up @@ -152,4 +152,18 @@

return $problems;
}

/**
* The data parser of the last run: the Settings choice for client
* commands, the one discovered from the daemon for slurmrestd.
*/
private static function parser(Cluster $cluster, ?ClusterRun $run): string {

Check warning on line 160 in lib/HealthPage.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Move this open curly brace to the beginning of the next line.

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaHiRZFrj4Bbu5Glib5A&open=AaHiRZFrj4Bbu5Glib5A&pullRequest=75
$parser = $run->dataParser ?? '';

if ($parser === '') {
return '-';
}

return $cluster->transport === Transport::Rest ? __('%s, discovered', $parser, 'hpcsched') : $parser;
}
}
2 changes: 1 addition & 1 deletion lib/HealthWarnings.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

if ($run->release !== '' && !DataParser::releaseSupported($run->release)) {
$out[] = __('The scheduler reports Slurm %s, which is not a supported release (%s).', $run->release, implode(', ', DataParser::SUPPORTED_RELEASES), 'hpcsched');
} elseif ($run->release !== '' && !DataParser::shippedBy($run->release, $settings->dataParser)) {
} elseif ($cluster->transport === Transport::Commands && $run->release !== '' && !DataParser::shippedBy($run->release, $settings->dataParser)) {

Check warning on line 91 in lib/HealthWarnings.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 146 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaHiRZDAj4Bbu5Glib4x&open=AaHiRZDAj4Bbu5Glib4x&pullRequest=75
$out[] = __('The scheduler reports Slurm %s, which does not ship the data parser %s chosen in Settings.', $run->release, $settings->dataParser, 'hpcsched');
}

Expand Down
2 changes: 2 additions & 0 deletions lib/HttpRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
final readonly class HttpRequest {
/**
* @param array<string, string> $headers
* @param array<string, int> $query name => non-negative integer, the only query values the plugin sends
*/
public function __construct(
public Endpoint $endpoint,
public string $path,
public array $headers = [],
public array $query = [],
) {
}
}
4 changes: 2 additions & 2 deletions lib/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
$state = TokenState::None;

try {
$transport = $this->transports->for($cluster, $redactor, $token);
$transport = $this->transports->for($cluster, $redactor, $token, $previous);
$state = $token->state ?? TokenState::None;
$snapshot = (new SlurmBackend($transport, $this->clock))->collect($cluster, $deadline);
$snapshot = (new SlurmBackend($transport, $this->clock, $this->snapshots->sections($cluster->id), $previous->release))->collect($cluster, $deadline);

Check warning on line 73 in lib/Reader.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 153 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaHiRZDsj4Bbu5Glib4y&open=AaHiRZDsj4Bbu5Glib4y&pullRequest=75
$limited = $transport->memoryLimited();
} catch (TransportError $e) {
$snapshot = $this->failed($cluster, $e->errorClass);
Expand Down
Loading
Loading