From 8b62a79971a0d6da57944af1808ac8e6c4c16b81 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Sun, 15 Nov 2026 07:25:28 -0800 Subject: [PATCH 01/15] docs: decide the pending reason families and counting rules (#12) ADR 0011 keeps the eleven families the reason research proposed, with Other unsplit, and fixes the counting rules the graphs depend on: held jobs apart from eligible pending ones, a pending array counted by its remaining tasks, and jobs and nodes in several partitions counted once per cluster and once per partition. It also records how a renamed partition reaches Cacti's reindex. tests/fixtures/slurm/reasons.json holds the distinct reason strings from Slurm source at 24.11.7, 25.05.9, 25.11.9, 26.05.6, and 26.11.0rc1. A unit test checks the family counts at each release and that every string stays a counter key under its own name. Signed-off-by: Thomas Vincent --- ...11-pending-reason-families-and-counting.md | 55 + docs/decisions/README.md | 1 + lib/ReasonFamily.php | 10 +- tests/Unit/StateTest.php | 33 + tests/fixtures/slurm/reasons.json | 1103 +++++++++++++++++ 5 files changed, 1197 insertions(+), 5 deletions(-) create mode 100644 docs/decisions/0011-pending-reason-families-and-counting.md create mode 100644 tests/fixtures/slurm/reasons.json diff --git a/docs/decisions/0011-pending-reason-families-and-counting.md b/docs/decisions/0011-pending-reason-families-and-counting.md new file mode 100644 index 0000000..0b0104d --- /dev/null +++ b/docs/decisions/0011-pending-reason-families-and-counting.md @@ -0,0 +1,55 @@ +# 0011. Group pending reasons into eleven fixed families and fix the counting rules + +Status: Accepted (2026-11-15). Decides [#12](https://github.com/somethingwithproof/plugin_hpcsched/issues/12). + +## Context + +[ADR 0010](0010-bound-series-cardinality.md) bounds series by grouping pending reasons into families. The reason list lives in `src/common/job_state_reason.c` and changes between releases: 216 distinct strings at 24.11, 25.11, and 26.05, 215 at 25.05, and 218 at the 26.11 candidate. SchedMD's job reason page omits 23 of them. [slurm-states-reasons.md](../research/slurm-states-reasons.md) proposed prefix rules that place every string in one of eleven families, and left open whether the Other family should be split. + +The graphs also need counting rules that Slurm does not settle for us: how a pending array counts, which pending jobs are held, and how jobs and nodes in several partitions count. + +## Decision + +**Families.** Eleven fixed families, matched on the leading identifier of the reason, first rule wins (`ReasonFamily::of()`): + +| Family | Rule | Distinct strings at 26.05 | +|---|---|---| +| Priority | `Priority` | 1 | +| Resources | `Resources`, `Licenses`, `NvidiaImexChannels` | 3 | +| Dependency | `Dependency`, `DependencyNeverSatisfied` | 2 | +| Held | `JobHeldAdmin`, `JobHeldUser`, `JobHoldMaxRequeue` | 3 | +| Begin time | `BeginTime` | 1 | +| Reservation | prefix `Reservation` | 3 | +| Association limits | prefix `Assoc` | 61 | +| QOS limits | prefix `QOS`, or `Max…PerAccount`, `Max…PerUser` | 109 | +| Partition limits | prefix `Partition` | 5 | +| Node availability | `ReqNodeNotAvail`, `NodeDown`, `MaxPoweredUpNodes` | 3 | +| Other | everything else, and any name a later release adds | 25 | + +Other is not split. Its 25 strings at 26.05 are mostly failure reasons that a pending job does not carry (`NonZeroExitCode`, `TimeLimit`, `OutOfMemory`) or rare ones; `JobArrayTaskLimit`, `AccountNotAllowed`, and the three `BurstBuffer*` reasons are the candidates for a family of their own, and adding one later changes neither the unknown-reason rule nor the other families. The raw reason of every pending job is counted beside its family, and the pending reasons view of the HPC Scheduler page lists it, so a reason in Other is visible by name. + +`tests/fixtures/slurm/reasons.json` holds the distinct strings of each release from source (24.11.7, 25.05.9, 25.11.9, 26.05.6, 26.11.0rc1), and a unit test checks the family counts at each release, so a rule change that moves a reason fails the build. + +**Counting rules.** + +- Held is a pending job whose reason is in the Held family. The pending series counts eligible jobs only; held jobs have their own series. This matches the Slurm metrics plugin's definition, plus `JobHoldMaxRequeue`. +- A pending array that has not split into tasks counts as its number of remaining tasks, read from `array_task_string` (the metrics plugin also counts tasks). Array tasks that already run are separate job records and count once each. +- A job submitted to several partitions counts once in the cluster totals and once in each partition it names. +- A node in several partitions counts once in the cluster totals and once in each of its partitions, by node name. +- Pending reason families are values of one data source per partition, not data query indexes, so a partition has one RRD file for its eleven families. + +**Reindex.** A partition is an index of the partition data query. Cacti's "Index Count Changed" check sees a partition added or removed, but not one renamed. The reader therefore compares the partitions in a fresh snapshot with the device's indexes and runs Cacti's reindex when they differ. The data query sets `index_orphan_removal`, so a removed partition's data sources stop being polled through Cacti's own reindex path; its graphs stay, with their history, until an administrator deletes them. + +## Consequences + +- The series count per partition is fixed: eleven family values, whatever the release. +- A reason added by a release lands in Other until the rules name it. The unit test shows the change when the fixture gains the release. +- The family breakdown reports the scheduler's last examined reason only; the documentation says so. +- Cluster totals are not sums of partition series when jobs or nodes span partitions. + +## Alternatives rejected + +- **One series per raw reason.** Unbounded, release dependent, and rejected by ADR 0010. +- **Operator-defined families.** Every site would need configuration before the graphs mean anything. +- **Families as data query indexes.** Eleven RRD files per partition instead of one, and a pending reason graph could not stack them. +- **Splitting Other now.** Possible later without changing the rules above; no captured queue yet shows which reasons in Other matter in practice. diff --git a/docs/decisions/README.md b/docs/decisions/README.md index a8b5a9e..25a1909 100644 --- a/docs/decisions/README.md +++ b/docs/decisions/README.md @@ -14,5 +14,6 @@ Each record captures one architecture decision: its context, the decision, its c | [0008](0008-maintenance-through-owned-expiring-schedules.md) | Create maintenance through plugin-owned, expiring Maint schedules | Proposed | | [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 | Open decisions are tracked as issues labelled `type: decision`. diff --git a/lib/ReasonFamily.php b/lib/ReasonFamily.php index 389e415..df9116e 100644 --- a/lib/ReasonFamily.php +++ b/lib/ReasonFamily.php @@ -20,11 +20,11 @@ namespace Somethingwithproof\Hpcsched; /** - * Pending reason families (ADR 0010; the final set is decision #12). The - * draft rules from docs/research/slurm-states-reasons.md map every reason - * string in source at 24.11 to the 26.11 candidate; anything else is Other, - * with the raw string kept. Values are short codes because Cacti data source - * names are limited to 19 characters. + * Pending reason families (ADR 0010, ADR 0011). The rules map every reason + * string in Slurm source from 24.11 to the 26.11 candidate + * (tests/fixtures/slurm/reasons.json); anything else is Other, with the raw + * string kept. Values are short codes because Cacti data source names are + * limited to 19 characters. */ enum ReasonFamily: string { case Priority = 'priority'; diff --git a/tests/Unit/StateTest.php b/tests/Unit/StateTest.php index e0c46ed..dd920da 100644 --- a/tests/Unit/StateTest.php +++ b/tests/Unit/StateTest.php @@ -177,6 +177,39 @@ ['', ReasonFamily::Other], ]); + // ADR 0011: the counts per family of every distinct reason string in + // Slurm source, which docs/research/slurm-states-reasons.md recorded. + it('maps every reason in Slurm source at each release to the documented family', function (string $release, array $counts) { + $fixture = json_decode((string) file_get_contents(dirname(__DIR__) . '/fixtures/slurm/reasons.json'), true); + $tally = []; + + foreach ($fixture['reasons'][$release] as $reason) { + $family = ReasonFamily::of($reason)->value; + $tally[$family] = ($tally[$family] ?? 0) + 1; + } + + ksort($tally); + ksort($counts); + + expect($tally)->toBe($counts); + })->with([ + '24.11' => ['24.11', ['priority' => 1, 'resources' => 2, 'dependency' => 2, 'held' => 3, 'begin_time' => 1, 'reservation' => 3, 'assoc' => 61, 'qos' => 109, 'partition' => 5, 'node' => 3, 'other' => 26]], + '25.05' => ['25.05', ['priority' => 1, 'resources' => 2, 'dependency' => 2, 'held' => 3, 'begin_time' => 1, 'reservation' => 3, 'assoc' => 61, 'qos' => 109, 'partition' => 5, 'node' => 3, 'other' => 25]], + '25.11' => ['25.11', ['priority' => 1, 'resources' => 3, 'dependency' => 2, 'held' => 3, 'begin_time' => 1, 'reservation' => 3, 'assoc' => 61, 'qos' => 109, 'partition' => 5, 'node' => 3, 'other' => 25]], + '26.05' => ['26.05', ['priority' => 1, 'resources' => 3, 'dependency' => 2, 'held' => 3, 'begin_time' => 1, 'reservation' => 3, 'assoc' => 61, 'qos' => 109, 'partition' => 5, 'node' => 3, 'other' => 25]], + '26.11' => ['26.11', ['priority' => 1, 'resources' => 3, 'dependency' => 2, 'held' => 3, 'begin_time' => 1, 'reservation' => 3, 'assoc' => 61, 'qos' => 109, 'partition' => 6, 'node' => 3, 'other' => 26]], + ]); + + it('keeps every source reason a counter key as it is, so the page lists it by its own name', function () { + $fixture = json_decode((string) file_get_contents(dirname(__DIR__) . '/fixtures/slurm/reasons.json'), true); + + foreach ($fixture['reasons'] as $reasons) { + foreach ($reasons as $reason) { + expect(Reasons::name($reason))->toBe($reason); + } + } + }); + it('keeps family codes within the 19 characters of an RRD data source name', function () { foreach (ReasonFamily::cases() as $family) { expect(strlen($family->value))->toBeLessThanOrEqual(19); diff --git a/tests/fixtures/slurm/reasons.json b/tests/fixtures/slurm/reasons.json new file mode 100644 index 0000000..dd25f5b --- /dev/null +++ b/tests/fixtures/slurm/reasons.json @@ -0,0 +1,1103 @@ +{ + "source": "src/common/job_state_reason.c, the distinct .str values of the job_state_reasons table", + "commits": { + "24.11": "defaf214db2e55326f45ab08f1bde5b2036d9f5d", + "25.05": "420f74f5c427c4d507168f7994eba62115484609", + "25.11": "5f7be9109e151bc59099786d7e3faccbca105869", + "26.05": "599e8ac50eaff5547946f3f0687d9fe3bf44347f", + "26.11": "90592924641f8332d39a8ba7c2aec4a6412922c6" + }, + "reasons": { + "24.11": [ + "AccountNotAllowed", + "AccountingPolicy", + "AssocGrpBB", + "AssocGrpBBMinutes", + "AssocGrpBBRunMinutes", + "AssocGrpBilling", + "AssocGrpBillingMinutes", + "AssocGrpBillingRunMinutes", + "AssocGrpCPUMinutesLimit", + "AssocGrpCPURunMinutesLimit", + "AssocGrpCpuLimit", + "AssocGrpEnergy", + "AssocGrpEnergyMinutes", + "AssocGrpEnergyRunMinutes", + "AssocGrpGRES", + "AssocGrpGRESMinutes", + "AssocGrpGRESRunMinutes", + "AssocGrpJobsLimit", + "AssocGrpLicense", + "AssocGrpLicenseMinutes", + "AssocGrpLicenseRunMinutes", + "AssocGrpMemLimit", + "AssocGrpMemMinutes", + "AssocGrpMemRunMinutes", + "AssocGrpNodeLimit", + "AssocGrpNodeMinutes", + "AssocGrpNodeRunMinutes", + "AssocGrpSubmitJobsLimit", + "AssocGrpUnknown", + "AssocGrpUnknownMinutes", + "AssocGrpUnknownRunMinutes", + "AssocGrpWallLimit", + "AssocMaxBBMinutesPerJob", + "AssocMaxBBPerJob", + "AssocMaxBBPerNode", + "AssocMaxBillingMinutesPerJob", + "AssocMaxBillingPerJob", + "AssocMaxBillingPerNode", + "AssocMaxCpuMinutesPerJobLimit", + "AssocMaxCpuPerJobLimit", + "AssocMaxCpuPerNode", + "AssocMaxEnergyMinutesPerJob", + "AssocMaxEnergyPerJob", + "AssocMaxEnergyPerNode", + "AssocMaxGRESMinutesPerJob", + "AssocMaxGRESPerJob", + "AssocMaxGRESPerNode", + "AssocMaxJobsLimit", + "AssocMaxLicenseMinutesPerJob", + "AssocMaxLicensePerJob", + "AssocMaxMemMinutesPerJob", + "AssocMaxMemPerJob", + "AssocMaxMemPerNode", + "AssocMaxNodeMinutesPerJob", + "AssocMaxNodePerJobLimit", + "AssocMaxSubmitJobLimit", + "AssocMaxUnknownMinutesPerJob", + "AssocMaxUnknownPerJob", + "AssocMaxUnknownPerNode", + "AssocMaxWallDurationPerJobLimit", + "AssociationJobLimit", + "AssociationResourceLimit", + "AssociationTimeLimit", + "BadConstraints", + "BeginTime", + "BurstBufferOperation", + "BurstBufferResources", + "BurstBufferStageIn", + "Cleaning", + "Constraints", + "DeadLine", + "Dependency", + "DependencyNeverSatisfied", + "FedJobLock", + "FrontEndDown", + "InactiveLimit", + "InvalidAccount", + "InvalidQOS", + "JobArrayTaskLimit", + "JobHeldAdmin", + "JobHeldUser", + "JobHoldMaxRequeue", + "JobLaunchFailure", + "Licenses", + "MaxBBPerAccount", + "MaxBBRunMinsPerAccount", + "MaxBBRunMinsPerUser", + "MaxBillingPerAccount", + "MaxBillingRunMinsPerAccount", + "MaxBillingRunMinsPerUser", + "MaxCpuPerAccount", + "MaxCpuRunMinsPerAccount", + "MaxCpuRunMinsPerUser", + "MaxEnergyPerAccount", + "MaxEnergyRunMinsPerAccount", + "MaxEnergyRunMinsPerUser", + "MaxGRESPerAccount", + "MaxGRESRunMinsPerAccount", + "MaxGRESRunMinsPerUser", + "MaxJobsPerAccount", + "MaxLicensePerAccount", + "MaxLicenseRunMinsPerAccount", + "MaxLicenseRunMinsPerUser", + "MaxMemPerLimit", + "MaxMemoryPerAccount", + "MaxMemoryRunMinsPerAccount", + "MaxMemoryRunMinsPerUser", + "MaxNodePerAccount", + "MaxNodeRunMinsPerAccount", + "MaxNodeRunMinsPerUser", + "MaxPoweredUpNodes", + "MaxSubmitJobsPerAccount", + "MaxUnknownPerAccount", + "MaxUnknownRunMinsPerAccount", + "MaxUnknownRunMinsPerUser", + "MpiPortsBusy", + "NodeDown", + "NonZeroExitCode", + "None", + "OutOfMemory", + "PartitionConfig", + "PartitionDown", + "PartitionInactive", + "PartitionNodeLimit", + "PartitionTimeLimit", + "Priority", + "Prolog", + "QOSGrpBB", + "QOSGrpBBMinutes", + "QOSGrpBBRunMinutes", + "QOSGrpBilling", + "QOSGrpBillingMinutes", + "QOSGrpBillingRunMinutes", + "QOSGrpCPUMinutesLimit", + "QOSGrpCPURunMinutesLimit", + "QOSGrpCpuLimit", + "QOSGrpEnergy", + "QOSGrpEnergyMinutes", + "QOSGrpEnergyRunMinutes", + "QOSGrpGRES", + "QOSGrpGRESMinutes", + "QOSGrpGRESRunMinutes", + "QOSGrpJobsLimit", + "QOSGrpLicense", + "QOSGrpLicenseMinutes", + "QOSGrpLicenseRunMinutes", + "QOSGrpMemLimit", + "QOSGrpMemoryMinutes", + "QOSGrpMemoryRunMinutes", + "QOSGrpNodeLimit", + "QOSGrpNodeMinutes", + "QOSGrpNodeRunMinutes", + "QOSGrpSubmitJobsLimit", + "QOSGrpUnknown", + "QOSGrpUnknownMinutes", + "QOSGrpUnknownRunMinutes", + "QOSGrpWallLimit", + "QOSJobLimit", + "QOSMaxBBPerJob", + "QOSMaxBBPerNode", + "QOSMaxBBPerUser", + "QOSMaxBillingMinutesPerJob", + "QOSMaxBillingPerJob", + "QOSMaxBillingPerNode", + "QOSMaxBillingPerUser", + "QOSMaxCpuMinutesPerJobLimit", + "QOSMaxCpuPerJobLimit", + "QOSMaxCpuPerNode", + "QOSMaxCpuPerUserLimit", + "QOSMaxEnergyMinutesPerJob", + "QOSMaxEnergyPerJob", + "QOSMaxEnergyPerNode", + "QOSMaxEnergyPerUser", + "QOSMaxGRESMinutesPerJob", + "QOSMaxGRESPerJob", + "QOSMaxGRESPerNode", + "QOSMaxGRESPerUser", + "QOSMaxJobsPerUserLimit", + "QOSMaxLicenseMinutesPerJob", + "QOSMaxLicensePerJob", + "QOSMaxLicensePerUser", + "QOSMaxMemoryMinutesPerJob", + "QOSMaxMemoryPerJob", + "QOSMaxMemoryPerNode", + "QOSMaxMemoryPerUser", + "QOSMaxNodeMinutesPerJob", + "QOSMaxNodePerJobLimit", + "QOSMaxNodePerUserLimit", + "QOSMaxSubmitJobPerUserLimit", + "QOSMaxUnknownMinutesPerJob", + "QOSMaxUnknownPerJob", + "QOSMaxUnknownPerNode", + "QOSMaxUnknownPerUser", + "QOSMaxWallDurationPerJobLimit", + "QOSMinBB", + "QOSMinBilling", + "QOSMinCpuNotSatisfied", + "QOSMinEnergy", + "QOSMinGRES", + "QOSMinLicense", + "QOSMinMemory", + "QOSMinNode", + "QOSMinUnknown", + "QOSNotAllowed", + "QOSResourceLimit", + "QOSTimeLimit", + "QOSUsageThreshold", + "RaisedSignal", + "ReqNodeNotAvail", + "Reservation", + "ReservationDeleted", + "ReservationInvalid", + "Resources", + "SchedDefer", + "SystemFailure", + "TimeLimit" + ], + "25.05": [ + "AccountNotAllowed", + "AccountingPolicy", + "AssocGrpBB", + "AssocGrpBBMinutes", + "AssocGrpBBRunMinutes", + "AssocGrpBilling", + "AssocGrpBillingMinutes", + "AssocGrpBillingRunMinutes", + "AssocGrpCPUMinutesLimit", + "AssocGrpCPURunMinutesLimit", + "AssocGrpCpuLimit", + "AssocGrpEnergy", + "AssocGrpEnergyMinutes", + "AssocGrpEnergyRunMinutes", + "AssocGrpGRES", + "AssocGrpGRESMinutes", + "AssocGrpGRESRunMinutes", + "AssocGrpJobsLimit", + "AssocGrpLicense", + "AssocGrpLicenseMinutes", + "AssocGrpLicenseRunMinutes", + "AssocGrpMemLimit", + "AssocGrpMemMinutes", + "AssocGrpMemRunMinutes", + "AssocGrpNodeLimit", + "AssocGrpNodeMinutes", + "AssocGrpNodeRunMinutes", + "AssocGrpSubmitJobsLimit", + "AssocGrpUnknown", + "AssocGrpUnknownMinutes", + "AssocGrpUnknownRunMinutes", + "AssocGrpWallLimit", + "AssocMaxBBMinutesPerJob", + "AssocMaxBBPerJob", + "AssocMaxBBPerNode", + "AssocMaxBillingMinutesPerJob", + "AssocMaxBillingPerJob", + "AssocMaxBillingPerNode", + "AssocMaxCpuMinutesPerJobLimit", + "AssocMaxCpuPerJobLimit", + "AssocMaxCpuPerNode", + "AssocMaxEnergyMinutesPerJob", + "AssocMaxEnergyPerJob", + "AssocMaxEnergyPerNode", + "AssocMaxGRESMinutesPerJob", + "AssocMaxGRESPerJob", + "AssocMaxGRESPerNode", + "AssocMaxJobsLimit", + "AssocMaxLicenseMinutesPerJob", + "AssocMaxLicensePerJob", + "AssocMaxMemMinutesPerJob", + "AssocMaxMemPerJob", + "AssocMaxMemPerNode", + "AssocMaxNodeMinutesPerJob", + "AssocMaxNodePerJobLimit", + "AssocMaxSubmitJobLimit", + "AssocMaxUnknownMinutesPerJob", + "AssocMaxUnknownPerJob", + "AssocMaxUnknownPerNode", + "AssocMaxWallDurationPerJobLimit", + "AssociationJobLimit", + "AssociationResourceLimit", + "AssociationTimeLimit", + "BadConstraints", + "BeginTime", + "BurstBufferOperation", + "BurstBufferResources", + "BurstBufferStageIn", + "Cleaning", + "Constraints", + "DeadLine", + "Dependency", + "DependencyNeverSatisfied", + "FedJobLock", + "InactiveLimit", + "InvalidAccount", + "InvalidQOS", + "JobArrayTaskLimit", + "JobHeldAdmin", + "JobHeldUser", + "JobHoldMaxRequeue", + "JobLaunchFailure", + "Licenses", + "MaxBBPerAccount", + "MaxBBRunMinsPerAccount", + "MaxBBRunMinsPerUser", + "MaxBillingPerAccount", + "MaxBillingRunMinsPerAccount", + "MaxBillingRunMinsPerUser", + "MaxCpuPerAccount", + "MaxCpuRunMinsPerAccount", + "MaxCpuRunMinsPerUser", + "MaxEnergyPerAccount", + "MaxEnergyRunMinsPerAccount", + "MaxEnergyRunMinsPerUser", + "MaxGRESPerAccount", + "MaxGRESRunMinsPerAccount", + "MaxGRESRunMinsPerUser", + "MaxJobsPerAccount", + "MaxLicensePerAccount", + "MaxLicenseRunMinsPerAccount", + "MaxLicenseRunMinsPerUser", + "MaxMemPerLimit", + "MaxMemoryPerAccount", + "MaxMemoryRunMinsPerAccount", + "MaxMemoryRunMinsPerUser", + "MaxNodePerAccount", + "MaxNodeRunMinsPerAccount", + "MaxNodeRunMinsPerUser", + "MaxPoweredUpNodes", + "MaxSubmitJobsPerAccount", + "MaxUnknownPerAccount", + "MaxUnknownRunMinsPerAccount", + "MaxUnknownRunMinsPerUser", + "MpiPortsBusy", + "NodeDown", + "NonZeroExitCode", + "None", + "OutOfMemory", + "PartitionConfig", + "PartitionDown", + "PartitionInactive", + "PartitionNodeLimit", + "PartitionTimeLimit", + "Priority", + "Prolog", + "QOSGrpBB", + "QOSGrpBBMinutes", + "QOSGrpBBRunMinutes", + "QOSGrpBilling", + "QOSGrpBillingMinutes", + "QOSGrpBillingRunMinutes", + "QOSGrpCPUMinutesLimit", + "QOSGrpCPURunMinutesLimit", + "QOSGrpCpuLimit", + "QOSGrpEnergy", + "QOSGrpEnergyMinutes", + "QOSGrpEnergyRunMinutes", + "QOSGrpGRES", + "QOSGrpGRESMinutes", + "QOSGrpGRESRunMinutes", + "QOSGrpJobsLimit", + "QOSGrpLicense", + "QOSGrpLicenseMinutes", + "QOSGrpLicenseRunMinutes", + "QOSGrpMemLimit", + "QOSGrpMemoryMinutes", + "QOSGrpMemoryRunMinutes", + "QOSGrpNodeLimit", + "QOSGrpNodeMinutes", + "QOSGrpNodeRunMinutes", + "QOSGrpSubmitJobsLimit", + "QOSGrpUnknown", + "QOSGrpUnknownMinutes", + "QOSGrpUnknownRunMinutes", + "QOSGrpWallLimit", + "QOSJobLimit", + "QOSMaxBBPerJob", + "QOSMaxBBPerNode", + "QOSMaxBBPerUser", + "QOSMaxBillingMinutesPerJob", + "QOSMaxBillingPerJob", + "QOSMaxBillingPerNode", + "QOSMaxBillingPerUser", + "QOSMaxCpuMinutesPerJobLimit", + "QOSMaxCpuPerJobLimit", + "QOSMaxCpuPerNode", + "QOSMaxCpuPerUserLimit", + "QOSMaxEnergyMinutesPerJob", + "QOSMaxEnergyPerJob", + "QOSMaxEnergyPerNode", + "QOSMaxEnergyPerUser", + "QOSMaxGRESMinutesPerJob", + "QOSMaxGRESPerJob", + "QOSMaxGRESPerNode", + "QOSMaxGRESPerUser", + "QOSMaxJobsPerUserLimit", + "QOSMaxLicenseMinutesPerJob", + "QOSMaxLicensePerJob", + "QOSMaxLicensePerUser", + "QOSMaxMemoryMinutesPerJob", + "QOSMaxMemoryPerJob", + "QOSMaxMemoryPerNode", + "QOSMaxMemoryPerUser", + "QOSMaxNodeMinutesPerJob", + "QOSMaxNodePerJobLimit", + "QOSMaxNodePerUserLimit", + "QOSMaxSubmitJobPerUserLimit", + "QOSMaxUnknownMinutesPerJob", + "QOSMaxUnknownPerJob", + "QOSMaxUnknownPerNode", + "QOSMaxUnknownPerUser", + "QOSMaxWallDurationPerJobLimit", + "QOSMinBB", + "QOSMinBilling", + "QOSMinCpuNotSatisfied", + "QOSMinEnergy", + "QOSMinGRES", + "QOSMinLicense", + "QOSMinMemory", + "QOSMinNode", + "QOSMinUnknown", + "QOSNotAllowed", + "QOSResourceLimit", + "QOSTimeLimit", + "QOSUsageThreshold", + "RaisedSignal", + "ReqNodeNotAvail", + "Reservation", + "ReservationDeleted", + "ReservationInvalid", + "Resources", + "SchedDefer", + "SystemFailure", + "TimeLimit" + ], + "25.11": [ + "AccountNotAllowed", + "AccountingPolicy", + "AssocGrpBB", + "AssocGrpBBMinutes", + "AssocGrpBBRunMinutes", + "AssocGrpBilling", + "AssocGrpBillingMinutes", + "AssocGrpBillingRunMinutes", + "AssocGrpCPUMinutesLimit", + "AssocGrpCPURunMinutesLimit", + "AssocGrpCpuLimit", + "AssocGrpEnergy", + "AssocGrpEnergyMinutes", + "AssocGrpEnergyRunMinutes", + "AssocGrpGRES", + "AssocGrpGRESMinutes", + "AssocGrpGRESRunMinutes", + "AssocGrpJobsLimit", + "AssocGrpLicense", + "AssocGrpLicenseMinutes", + "AssocGrpLicenseRunMinutes", + "AssocGrpMemLimit", + "AssocGrpMemMinutes", + "AssocGrpMemRunMinutes", + "AssocGrpNodeLimit", + "AssocGrpNodeMinutes", + "AssocGrpNodeRunMinutes", + "AssocGrpSubmitJobsLimit", + "AssocGrpUnknown", + "AssocGrpUnknownMinutes", + "AssocGrpUnknownRunMinutes", + "AssocGrpWallLimit", + "AssocMaxBBMinutesPerJob", + "AssocMaxBBPerJob", + "AssocMaxBBPerNode", + "AssocMaxBillingMinutesPerJob", + "AssocMaxBillingPerJob", + "AssocMaxBillingPerNode", + "AssocMaxCpuMinutesPerJobLimit", + "AssocMaxCpuPerJobLimit", + "AssocMaxCpuPerNode", + "AssocMaxEnergyMinutesPerJob", + "AssocMaxEnergyPerJob", + "AssocMaxEnergyPerNode", + "AssocMaxGRESMinutesPerJob", + "AssocMaxGRESPerJob", + "AssocMaxGRESPerNode", + "AssocMaxJobsLimit", + "AssocMaxLicenseMinutesPerJob", + "AssocMaxLicensePerJob", + "AssocMaxMemMinutesPerJob", + "AssocMaxMemPerJob", + "AssocMaxMemPerNode", + "AssocMaxNodeMinutesPerJob", + "AssocMaxNodePerJobLimit", + "AssocMaxSubmitJobLimit", + "AssocMaxUnknownMinutesPerJob", + "AssocMaxUnknownPerJob", + "AssocMaxUnknownPerNode", + "AssocMaxWallDurationPerJobLimit", + "AssociationJobLimit", + "AssociationResourceLimit", + "AssociationTimeLimit", + "BadConstraints", + "BeginTime", + "BurstBufferOperation", + "BurstBufferResources", + "BurstBufferStageIn", + "Cleaning", + "Constraints", + "DeadLine", + "Dependency", + "DependencyNeverSatisfied", + "FedJobLock", + "InactiveLimit", + "InvalidAccount", + "InvalidQOS", + "JobArrayTaskLimit", + "JobHeldAdmin", + "JobHeldUser", + "JobHoldMaxRequeue", + "JobLaunchFailure", + "Licenses", + "MaxBBPerAccount", + "MaxBBRunMinsPerAccount", + "MaxBBRunMinsPerUser", + "MaxBillingPerAccount", + "MaxBillingRunMinsPerAccount", + "MaxBillingRunMinsPerUser", + "MaxCpuPerAccount", + "MaxCpuRunMinsPerAccount", + "MaxCpuRunMinsPerUser", + "MaxEnergyPerAccount", + "MaxEnergyRunMinsPerAccount", + "MaxEnergyRunMinsPerUser", + "MaxGRESPerAccount", + "MaxGRESRunMinsPerAccount", + "MaxGRESRunMinsPerUser", + "MaxJobsPerAccount", + "MaxLicensePerAccount", + "MaxLicenseRunMinsPerAccount", + "MaxLicenseRunMinsPerUser", + "MaxMemPerLimit", + "MaxMemoryPerAccount", + "MaxMemoryRunMinsPerAccount", + "MaxMemoryRunMinsPerUser", + "MaxNodePerAccount", + "MaxNodeRunMinsPerAccount", + "MaxNodeRunMinsPerUser", + "MaxPoweredUpNodes", + "MaxSubmitJobsPerAccount", + "MaxUnknownPerAccount", + "MaxUnknownRunMinsPerAccount", + "MaxUnknownRunMinsPerUser", + "MpiPortsBusy", + "NodeDown", + "NonZeroExitCode", + "None", + "NvidiaImexChannels", + "OutOfMemory", + "PartitionConfig", + "PartitionDown", + "PartitionInactive", + "PartitionNodeLimit", + "PartitionTimeLimit", + "Priority", + "Prolog", + "QOSGrpBB", + "QOSGrpBBMinutes", + "QOSGrpBBRunMinutes", + "QOSGrpBilling", + "QOSGrpBillingMinutes", + "QOSGrpBillingRunMinutes", + "QOSGrpCPUMinutesLimit", + "QOSGrpCPURunMinutesLimit", + "QOSGrpCpuLimit", + "QOSGrpEnergy", + "QOSGrpEnergyMinutes", + "QOSGrpEnergyRunMinutes", + "QOSGrpGRES", + "QOSGrpGRESMinutes", + "QOSGrpGRESRunMinutes", + "QOSGrpJobsLimit", + "QOSGrpLicense", + "QOSGrpLicenseMinutes", + "QOSGrpLicenseRunMinutes", + "QOSGrpMemLimit", + "QOSGrpMemoryMinutes", + "QOSGrpMemoryRunMinutes", + "QOSGrpNodeLimit", + "QOSGrpNodeMinutes", + "QOSGrpNodeRunMinutes", + "QOSGrpSubmitJobsLimit", + "QOSGrpUnknown", + "QOSGrpUnknownMinutes", + "QOSGrpUnknownRunMinutes", + "QOSGrpWallLimit", + "QOSJobLimit", + "QOSMaxBBPerJob", + "QOSMaxBBPerNode", + "QOSMaxBBPerUser", + "QOSMaxBillingMinutesPerJob", + "QOSMaxBillingPerJob", + "QOSMaxBillingPerNode", + "QOSMaxBillingPerUser", + "QOSMaxCpuMinutesPerJobLimit", + "QOSMaxCpuPerJobLimit", + "QOSMaxCpuPerNode", + "QOSMaxCpuPerUserLimit", + "QOSMaxEnergyMinutesPerJob", + "QOSMaxEnergyPerJob", + "QOSMaxEnergyPerNode", + "QOSMaxEnergyPerUser", + "QOSMaxGRESMinutesPerJob", + "QOSMaxGRESPerJob", + "QOSMaxGRESPerNode", + "QOSMaxGRESPerUser", + "QOSMaxJobsPerUserLimit", + "QOSMaxLicenseMinutesPerJob", + "QOSMaxLicensePerJob", + "QOSMaxLicensePerUser", + "QOSMaxMemoryMinutesPerJob", + "QOSMaxMemoryPerJob", + "QOSMaxMemoryPerNode", + "QOSMaxMemoryPerUser", + "QOSMaxNodeMinutesPerJob", + "QOSMaxNodePerJobLimit", + "QOSMaxNodePerUserLimit", + "QOSMaxSubmitJobPerUserLimit", + "QOSMaxUnknownMinutesPerJob", + "QOSMaxUnknownPerJob", + "QOSMaxUnknownPerNode", + "QOSMaxUnknownPerUser", + "QOSMaxWallDurationPerJobLimit", + "QOSMinBB", + "QOSMinBilling", + "QOSMinCpuNotSatisfied", + "QOSMinEnergy", + "QOSMinGRES", + "QOSMinLicense", + "QOSMinMemory", + "QOSMinNode", + "QOSMinUnknown", + "QOSNotAllowed", + "QOSResourceLimit", + "QOSTimeLimit", + "QOSUsageThreshold", + "RaisedSignal", + "ReqNodeNotAvail", + "Reservation", + "ReservationDeleted", + "ReservationInvalid", + "Resources", + "SchedDefer", + "SystemFailure", + "TimeLimit" + ], + "26.05": [ + "AccountNotAllowed", + "AccountingPolicy", + "AssocGrpBB", + "AssocGrpBBMinutes", + "AssocGrpBBRunMinutes", + "AssocGrpBilling", + "AssocGrpBillingMinutes", + "AssocGrpBillingRunMinutes", + "AssocGrpCPUMinutesLimit", + "AssocGrpCPURunMinutesLimit", + "AssocGrpCpuLimit", + "AssocGrpEnergy", + "AssocGrpEnergyMinutes", + "AssocGrpEnergyRunMinutes", + "AssocGrpGRES", + "AssocGrpGRESMinutes", + "AssocGrpGRESRunMinutes", + "AssocGrpJobsLimit", + "AssocGrpLicense", + "AssocGrpLicenseMinutes", + "AssocGrpLicenseRunMinutes", + "AssocGrpMemLimit", + "AssocGrpMemMinutes", + "AssocGrpMemRunMinutes", + "AssocGrpNodeLimit", + "AssocGrpNodeMinutes", + "AssocGrpNodeRunMinutes", + "AssocGrpSubmitJobsLimit", + "AssocGrpUnknown", + "AssocGrpUnknownMinutes", + "AssocGrpUnknownRunMinutes", + "AssocGrpWallLimit", + "AssocMaxBBMinutesPerJob", + "AssocMaxBBPerJob", + "AssocMaxBBPerNode", + "AssocMaxBillingMinutesPerJob", + "AssocMaxBillingPerJob", + "AssocMaxBillingPerNode", + "AssocMaxCpuMinutesPerJobLimit", + "AssocMaxCpuPerJobLimit", + "AssocMaxCpuPerNode", + "AssocMaxEnergyMinutesPerJob", + "AssocMaxEnergyPerJob", + "AssocMaxEnergyPerNode", + "AssocMaxGRESMinutesPerJob", + "AssocMaxGRESPerJob", + "AssocMaxGRESPerNode", + "AssocMaxJobsLimit", + "AssocMaxLicenseMinutesPerJob", + "AssocMaxLicensePerJob", + "AssocMaxMemMinutesPerJob", + "AssocMaxMemPerJob", + "AssocMaxMemPerNode", + "AssocMaxNodeMinutesPerJob", + "AssocMaxNodePerJobLimit", + "AssocMaxSubmitJobLimit", + "AssocMaxUnknownMinutesPerJob", + "AssocMaxUnknownPerJob", + "AssocMaxUnknownPerNode", + "AssocMaxWallDurationPerJobLimit", + "AssociationJobLimit", + "AssociationResourceLimit", + "AssociationTimeLimit", + "BadConstraints", + "BeginTime", + "BurstBufferOperation", + "BurstBufferResources", + "BurstBufferStageIn", + "Cleaning", + "Constraints", + "DeadLine", + "Dependency", + "DependencyNeverSatisfied", + "FedJobLock", + "InactiveLimit", + "InvalidAccount", + "InvalidQOS", + "JobArrayTaskLimit", + "JobHeldAdmin", + "JobHeldUser", + "JobHoldMaxRequeue", + "JobLaunchFailure", + "Licenses", + "MaxBBPerAccount", + "MaxBBRunMinsPerAccount", + "MaxBBRunMinsPerUser", + "MaxBillingPerAccount", + "MaxBillingRunMinsPerAccount", + "MaxBillingRunMinsPerUser", + "MaxCpuPerAccount", + "MaxCpuRunMinsPerAccount", + "MaxCpuRunMinsPerUser", + "MaxEnergyPerAccount", + "MaxEnergyRunMinsPerAccount", + "MaxEnergyRunMinsPerUser", + "MaxGRESPerAccount", + "MaxGRESRunMinsPerAccount", + "MaxGRESRunMinsPerUser", + "MaxJobsPerAccount", + "MaxLicensePerAccount", + "MaxLicenseRunMinsPerAccount", + "MaxLicenseRunMinsPerUser", + "MaxMemPerLimit", + "MaxMemoryPerAccount", + "MaxMemoryRunMinsPerAccount", + "MaxMemoryRunMinsPerUser", + "MaxNodePerAccount", + "MaxNodeRunMinsPerAccount", + "MaxNodeRunMinsPerUser", + "MaxPoweredUpNodes", + "MaxSubmitJobsPerAccount", + "MaxUnknownPerAccount", + "MaxUnknownRunMinsPerAccount", + "MaxUnknownRunMinsPerUser", + "MpiPortsBusy", + "NodeDown", + "NonZeroExitCode", + "None", + "NvidiaImexChannels", + "OutOfMemory", + "PartitionConfig", + "PartitionDown", + "PartitionInactive", + "PartitionNodeLimit", + "PartitionTimeLimit", + "Priority", + "Prolog", + "QOSGrpBB", + "QOSGrpBBMinutes", + "QOSGrpBBRunMinutes", + "QOSGrpBilling", + "QOSGrpBillingMinutes", + "QOSGrpBillingRunMinutes", + "QOSGrpCPUMinutesLimit", + "QOSGrpCPURunMinutesLimit", + "QOSGrpCpuLimit", + "QOSGrpEnergy", + "QOSGrpEnergyMinutes", + "QOSGrpEnergyRunMinutes", + "QOSGrpGRES", + "QOSGrpGRESMinutes", + "QOSGrpGRESRunMinutes", + "QOSGrpJobsLimit", + "QOSGrpLicense", + "QOSGrpLicenseMinutes", + "QOSGrpLicenseRunMinutes", + "QOSGrpMemLimit", + "QOSGrpMemoryMinutes", + "QOSGrpMemoryRunMinutes", + "QOSGrpNodeLimit", + "QOSGrpNodeMinutes", + "QOSGrpNodeRunMinutes", + "QOSGrpSubmitJobsLimit", + "QOSGrpUnknown", + "QOSGrpUnknownMinutes", + "QOSGrpUnknownRunMinutes", + "QOSGrpWallLimit", + "QOSJobLimit", + "QOSMaxBBPerJob", + "QOSMaxBBPerNode", + "QOSMaxBBPerUser", + "QOSMaxBillingMinutesPerJob", + "QOSMaxBillingPerJob", + "QOSMaxBillingPerNode", + "QOSMaxBillingPerUser", + "QOSMaxCpuMinutesPerJobLimit", + "QOSMaxCpuPerJobLimit", + "QOSMaxCpuPerNode", + "QOSMaxCpuPerUserLimit", + "QOSMaxEnergyMinutesPerJob", + "QOSMaxEnergyPerJob", + "QOSMaxEnergyPerNode", + "QOSMaxEnergyPerUser", + "QOSMaxGRESMinutesPerJob", + "QOSMaxGRESPerJob", + "QOSMaxGRESPerNode", + "QOSMaxGRESPerUser", + "QOSMaxJobsPerUserLimit", + "QOSMaxLicenseMinutesPerJob", + "QOSMaxLicensePerJob", + "QOSMaxLicensePerUser", + "QOSMaxMemoryMinutesPerJob", + "QOSMaxMemoryPerJob", + "QOSMaxMemoryPerNode", + "QOSMaxMemoryPerUser", + "QOSMaxNodeMinutesPerJob", + "QOSMaxNodePerJobLimit", + "QOSMaxNodePerUserLimit", + "QOSMaxSubmitJobPerUserLimit", + "QOSMaxUnknownMinutesPerJob", + "QOSMaxUnknownPerJob", + "QOSMaxUnknownPerNode", + "QOSMaxUnknownPerUser", + "QOSMaxWallDurationPerJobLimit", + "QOSMinBB", + "QOSMinBilling", + "QOSMinCpuNotSatisfied", + "QOSMinEnergy", + "QOSMinGRES", + "QOSMinLicense", + "QOSMinMemory", + "QOSMinNode", + "QOSMinUnknown", + "QOSNotAllowed", + "QOSResourceLimit", + "QOSTimeLimit", + "QOSUsageThreshold", + "RaisedSignal", + "ReqNodeNotAvail", + "Reservation", + "ReservationDeleted", + "ReservationInvalid", + "Resources", + "SchedDefer", + "SystemFailure", + "TimeLimit" + ], + "26.11": [ + "AccountNotAllowed", + "AccountingPolicy", + "AssocGrpBB", + "AssocGrpBBMinutes", + "AssocGrpBBRunMinutes", + "AssocGrpBilling", + "AssocGrpBillingMinutes", + "AssocGrpBillingRunMinutes", + "AssocGrpCPUMinutesLimit", + "AssocGrpCPURunMinutesLimit", + "AssocGrpCpuLimit", + "AssocGrpEnergy", + "AssocGrpEnergyMinutes", + "AssocGrpEnergyRunMinutes", + "AssocGrpGRES", + "AssocGrpGRESMinutes", + "AssocGrpGRESRunMinutes", + "AssocGrpJobsLimit", + "AssocGrpLicense", + "AssocGrpLicenseMinutes", + "AssocGrpLicenseRunMinutes", + "AssocGrpMemLimit", + "AssocGrpMemMinutes", + "AssocGrpMemRunMinutes", + "AssocGrpNodeLimit", + "AssocGrpNodeMinutes", + "AssocGrpNodeRunMinutes", + "AssocGrpSubmitJobsLimit", + "AssocGrpUnknown", + "AssocGrpUnknownMinutes", + "AssocGrpUnknownRunMinutes", + "AssocGrpWallLimit", + "AssocMaxBBMinutesPerJob", + "AssocMaxBBPerJob", + "AssocMaxBBPerNode", + "AssocMaxBillingMinutesPerJob", + "AssocMaxBillingPerJob", + "AssocMaxBillingPerNode", + "AssocMaxCpuMinutesPerJobLimit", + "AssocMaxCpuPerJobLimit", + "AssocMaxCpuPerNode", + "AssocMaxEnergyMinutesPerJob", + "AssocMaxEnergyPerJob", + "AssocMaxEnergyPerNode", + "AssocMaxGRESMinutesPerJob", + "AssocMaxGRESPerJob", + "AssocMaxGRESPerNode", + "AssocMaxJobsLimit", + "AssocMaxLicenseMinutesPerJob", + "AssocMaxLicensePerJob", + "AssocMaxMemMinutesPerJob", + "AssocMaxMemPerJob", + "AssocMaxMemPerNode", + "AssocMaxNodeMinutesPerJob", + "AssocMaxNodePerJobLimit", + "AssocMaxSubmitJobLimit", + "AssocMaxUnknownMinutesPerJob", + "AssocMaxUnknownPerJob", + "AssocMaxUnknownPerNode", + "AssocMaxWallDurationPerJobLimit", + "AssociationJobLimit", + "AssociationResourceLimit", + "AssociationTimeLimit", + "BadConstraints", + "BeginTime", + "BurstBufferOperation", + "BurstBufferResources", + "BurstBufferStageIn", + "Cleaning", + "Constraints", + "DeadLine", + "Dependency", + "DependencyNeverSatisfied", + "FedJobLock", + "HRESDisabled", + "InactiveLimit", + "InvalidAccount", + "InvalidQOS", + "JobArrayTaskLimit", + "JobHeldAdmin", + "JobHeldUser", + "JobHoldMaxRequeue", + "JobLaunchFailure", + "Licenses", + "MaxBBPerAccount", + "MaxBBRunMinsPerAccount", + "MaxBBRunMinsPerUser", + "MaxBillingPerAccount", + "MaxBillingRunMinsPerAccount", + "MaxBillingRunMinsPerUser", + "MaxCpuPerAccount", + "MaxCpuRunMinsPerAccount", + "MaxCpuRunMinsPerUser", + "MaxEnergyPerAccount", + "MaxEnergyRunMinsPerAccount", + "MaxEnergyRunMinsPerUser", + "MaxGRESPerAccount", + "MaxGRESRunMinsPerAccount", + "MaxGRESRunMinsPerUser", + "MaxJobsPerAccount", + "MaxLicensePerAccount", + "MaxLicenseRunMinsPerAccount", + "MaxLicenseRunMinsPerUser", + "MaxMemPerLimit", + "MaxMemoryPerAccount", + "MaxMemoryRunMinsPerAccount", + "MaxMemoryRunMinsPerUser", + "MaxNodePerAccount", + "MaxNodeRunMinsPerAccount", + "MaxNodeRunMinsPerUser", + "MaxPoweredUpNodes", + "MaxSubmitJobsPerAccount", + "MaxUnknownPerAccount", + "MaxUnknownRunMinsPerAccount", + "MaxUnknownRunMinsPerUser", + "MpiPortsBusy", + "NodeDown", + "NonZeroExitCode", + "None", + "NvidiaImexChannels", + "OutOfMemory", + "PartitionConfig", + "PartitionCpuLimit", + "PartitionDown", + "PartitionInactive", + "PartitionNodeLimit", + "PartitionTimeLimit", + "Priority", + "Prolog", + "QOSGrpBB", + "QOSGrpBBMinutes", + "QOSGrpBBRunMinutes", + "QOSGrpBilling", + "QOSGrpBillingMinutes", + "QOSGrpBillingRunMinutes", + "QOSGrpCPUMinutesLimit", + "QOSGrpCPURunMinutesLimit", + "QOSGrpCpuLimit", + "QOSGrpEnergy", + "QOSGrpEnergyMinutes", + "QOSGrpEnergyRunMinutes", + "QOSGrpGRES", + "QOSGrpGRESMinutes", + "QOSGrpGRESRunMinutes", + "QOSGrpJobsLimit", + "QOSGrpLicense", + "QOSGrpLicenseMinutes", + "QOSGrpLicenseRunMinutes", + "QOSGrpMemLimit", + "QOSGrpMemoryMinutes", + "QOSGrpMemoryRunMinutes", + "QOSGrpNodeLimit", + "QOSGrpNodeMinutes", + "QOSGrpNodeRunMinutes", + "QOSGrpSubmitJobsLimit", + "QOSGrpUnknown", + "QOSGrpUnknownMinutes", + "QOSGrpUnknownRunMinutes", + "QOSGrpWallLimit", + "QOSJobLimit", + "QOSMaxBBPerJob", + "QOSMaxBBPerNode", + "QOSMaxBBPerUser", + "QOSMaxBillingMinutesPerJob", + "QOSMaxBillingPerJob", + "QOSMaxBillingPerNode", + "QOSMaxBillingPerUser", + "QOSMaxCpuMinutesPerJobLimit", + "QOSMaxCpuPerJobLimit", + "QOSMaxCpuPerNode", + "QOSMaxCpuPerUserLimit", + "QOSMaxEnergyMinutesPerJob", + "QOSMaxEnergyPerJob", + "QOSMaxEnergyPerNode", + "QOSMaxEnergyPerUser", + "QOSMaxGRESMinutesPerJob", + "QOSMaxGRESPerJob", + "QOSMaxGRESPerNode", + "QOSMaxGRESPerUser", + "QOSMaxJobsPerUserLimit", + "QOSMaxLicenseMinutesPerJob", + "QOSMaxLicensePerJob", + "QOSMaxLicensePerUser", + "QOSMaxMemoryMinutesPerJob", + "QOSMaxMemoryPerJob", + "QOSMaxMemoryPerNode", + "QOSMaxMemoryPerUser", + "QOSMaxNodeMinutesPerJob", + "QOSMaxNodePerJobLimit", + "QOSMaxNodePerUserLimit", + "QOSMaxSubmitJobPerUserLimit", + "QOSMaxUnknownMinutesPerJob", + "QOSMaxUnknownPerJob", + "QOSMaxUnknownPerNode", + "QOSMaxUnknownPerUser", + "QOSMaxWallDurationPerJobLimit", + "QOSMinBB", + "QOSMinBilling", + "QOSMinCpuNotSatisfied", + "QOSMinEnergy", + "QOSMinGRES", + "QOSMinLicense", + "QOSMinMemory", + "QOSMinNode", + "QOSMinUnknown", + "QOSNotAllowed", + "QOSResourceLimit", + "QOSTimeLimit", + "QOSUsageThreshold", + "RaisedSignal", + "ReqNodeNotAvail", + "Reservation", + "ReservationDeleted", + "ReservationInvalid", + "Resources", + "SchedDefer", + "SystemFailure", + "TimeLimit" + ] + } +} From f4a1763af32812ec7c1bfa6de902e8baf613614d Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Sun, 15 Nov 2026 07:30:16 -0800 Subject: [PATCH 02/15] feat: serve cluster and partition series from the snapshot (#42, #43, #44) Schema version 2 adds plugin_hpcsched_node_count, node and CPU counts per partition written with the nodes section, and the cluster's host_id. The column is added with a guarded ALTER TABLE: api_plugin_db_add_column() records it for core to drop on uninstall, also when the tables are kept. NodeTally counts a node once for the cluster and once per partition, by name, and splits CPUs the way sinfo %C does: allocated, idle, other (unallocated CPUs of nodes that cannot take work), and total. ClusterSeries answers the two script server inputs of a cluster device from the snapshot tables only: 32 values for the cluster plus age in one call, and the same 32 per partition through a data query indexed by partition name. Counts are U while their section is stale; age stays numeric once the cluster was collected. Fields and indexes are checked against fixed lists, and anything else is answered with U. Signed-off-by: Thomas Vincent --- lib/Cluster.php | 6 +- lib/ClusterRepository.php | 45 ++- lib/ClusterSeries.php | 148 ++++++++++ lib/ClusterValues.php | 22 +- lib/NodeTally.php | 101 +++++++ lib/Schema.php | 39 ++- lib/Series.php | 120 ++++++++ lib/SeriesRepository.php | 95 +++++++ lib/SnapshotRepository.php | 20 ++ phpstan.neon | 1 + .../script_server/hpcsched_partitions.xml | 185 +++++++++++++ scripts/ss_hpcsched_cluster.php | 56 ++++ scripts/ss_hpcsched_partitions.php | 61 +++++ setup.php | 16 ++ tests/Unit/SeriesTest.php | 258 ++++++++++++++++++ 15 files changed, 1160 insertions(+), 13 deletions(-) create mode 100644 lib/ClusterSeries.php create mode 100644 lib/NodeTally.php create mode 100644 lib/Series.php create mode 100644 lib/SeriesRepository.php create mode 100644 resource/script_server/hpcsched_partitions.xml create mode 100644 scripts/ss_hpcsched_cluster.php create mode 100644 scripts/ss_hpcsched_partitions.php create mode 100644 tests/Unit/SeriesTest.php diff --git a/lib/Cluster.php b/lib/Cluster.php index 3cd44b8..812e746 100644 --- a/lib/Cluster.php +++ b/lib/Cluster.php @@ -23,7 +23,9 @@ * One scheduler cluster as an administrator configured it. Nothing here is a * command line: binaries come from the global settings and the argument * vectors are fixed in CommandTransport. The token file is a path; the token - * itself is read at use time and never stored (REQ-CRED-002). + * itself is read at use time and never stored (REQ-CRED-002). A cluster + * mapped to a Cacti device (hostId) belongs to that device for permissions + * (DeviceAccess). */ final readonly class Cluster { public const NAME_PATTERN = '/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/'; @@ -48,6 +50,7 @@ public function __construct( public bool $reservations = false, public bool $shares = false, public int $updatedAt = 0, + public int $hostId = 0, ) { } @@ -80,6 +83,7 @@ public static function fromRow(array $row): ?self { reservations: Row::bool($row, 'collect_reservations'), shares: Row::bool($row, 'collect_shares'), updatedAt: Row::int($row, 'updated_at', 0, 0), + hostId: Row::int($row, 'host_id', 0, 0), ); } diff --git a/lib/ClusterRepository.php b/lib/ClusterRepository.php index 36bd2a2..3c19ab6 100644 --- a/lib/ClusterRepository.php +++ b/lib/ClusterRepository.php @@ -21,10 +21,11 @@ /** * Cluster configuration rows. Deleting a cluster deletes its run record and - * cached snapshot in one transaction; nothing is sent to the scheduler. + * cached snapshot in one transaction, and leaves its Cacti device and graphs + * alone; nothing is sent to the scheduler. */ final class ClusterRepository { - private const SNAPSHOT_TABLES = ['plugin_hpcsched_run', 'plugin_hpcsched_section', 'plugin_hpcsched_job_count', 'plugin_hpcsched_node', 'plugin_hpcsched_partition', 'plugin_hpcsched_reservation', 'plugin_hpcsched_share']; + private const SNAPSHOT_TABLES = ['plugin_hpcsched_run', 'plugin_hpcsched_section', 'plugin_hpcsched_job_count', 'plugin_hpcsched_node', 'plugin_hpcsched_node_count', 'plugin_hpcsched_partition', 'plugin_hpcsched_reservation', 'plugin_hpcsched_share']; public function __construct(private readonly \PDO|false $connection, private readonly Clock $clock) { } @@ -52,6 +53,46 @@ public function get(int $id): ?Cluster { return $row === null ? null : Cluster::fromRow($row); } + public function findByHost(int $hostId): ?Cluster { + if ($hostId <= 0) { + return null; + } + + $row = Row::one(db_fetch_row_prepared('SELECT * FROM plugin_hpcsched_cluster WHERE host_id = ? ORDER BY id LIMIT 1', [$hostId], true, $this->connection)); + + return $row === null ? null : Cluster::fromRow($row); + } + + /** + * Map a cluster to a device, unless another cluster has that device: a + * device carries one cluster's graphs. 0 unmaps. + */ + public function mapHost(int $id, int $hostId): bool { + $ok = db_execute_prepared('UPDATE plugin_hpcsched_cluster SET host_id = ?, updated_at = GREATEST(updated_at + 1, ?) + WHERE id = ? AND (? = 0 OR NOT EXISTS (SELECT 1 FROM (SELECT id FROM plugin_hpcsched_cluster WHERE host_id = ? AND id <> ?) AS other))', [$hostId, $this->clock->now(), $id, $hostId, $hostId, $id], true, $this->connection); + + return $ok !== false && db_affected_rows($this->connection) === 1; + } + + /** + * Forget deleted devices. Returns the number of clusters unmapped. + * + * @param list $hostIds + */ + public function unmapHosts(array $hostIds): int { + $hostIds = array_values(array_filter($hostIds, static fn (int $id): bool => $id > 0)); + + if ($hostIds === []) { + return 0; + } + + $ok = db_execute_prepared('UPDATE plugin_hpcsched_cluster SET host_id = 0, updated_at = GREATEST(updated_at + 1, ?) WHERE host_id IN (' . implode(', ', array_fill(0, count($hostIds), '?')) . ')', array_merge([$this->clock->now()], $hostIds), true, $this->connection); + + $count = $ok === false ? 0 : db_affected_rows($this->connection); + + return is_int($count) ? $count : 0; + } + public function nameTaken(string $name, int $exceptId): bool { return Row::count(db_fetch_cell_prepared('SELECT COUNT(*) FROM plugin_hpcsched_cluster WHERE name = ? AND id <> ?', [$name, $exceptId], '', true, $this->connection)) > 0; } diff --git a/lib/ClusterSeries.php b/lib/ClusterSeries.php new file mode 100644 index 0000000..bf838a2 --- /dev/null +++ b/lib/ClusterSeries.php @@ -0,0 +1,148 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_hpcsched, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_hpcsched + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + + +namespace Somethingwithproof\Hpcsched; + +/** + * Answers the two script server inputs of a cluster device from the + * snapshot, never from the scheduler (REQ-OBJ-005, REQ-PERF-004): + * + * - the "HPC Scheduler Cluster Values" input: every cluster value and age as + * name:value pairs in one call (scripts/ss_hpcsched_cluster.php); + * - the "HPC Scheduler Partitions" data query: index, num_indexes, query, + * and get (scripts/ss_hpcsched_partitions.php). + * + * Every argument arrives from Cacti's command line or the script server, so + * each is checked against a fixed list: the field against the value names, + * the index against the cluster's partitions. Anything else is answered + * with U or nothing, never echoed back. Counts are U while their section is + * stale or failed (REQ-QUEUE-005, REQ-ALERT-001); age is numeric once the + * cluster has been collected (REQ-ALERT-002). + */ +final class ClusterSeries { + public const NAME_FIELD = 'name'; + + /** The script server answers a whole poll cycle from one process. */ + private const CACHE_SECONDS = 30; + + /** @var array, values: array>, age: ?int}> */ + private array $cache = []; + + public function __construct( + private readonly ClusterRepository $clusters, + private readonly SeriesRepository $series, + private readonly FreshnessEvaluator $evaluator, + private readonly Clock $clock, + private readonly int $pollerInterval, + ) { + } + + public function cluster(int $hostId): string { + $data = $this->load($hostId); + $values = $data['values']['p:'] ?? array_fill_keys(Series::names(), null); + $pairs = []; + + foreach (Series::names() as $name) { + $pairs[] = $name . ':' . Series::format($values[$name] ?? null); + } + + $pairs[] = Series::AGE . ':' . Series::format($data['age'] === null ? null : (float) $data['age']); + + return implode(' ', $pairs); + } + + public function partitions(int $hostId, string $command, string $field = '', string $index = ''): string { + $data = $this->load($hostId); + + return match ($command) { + 'index' => self::lines($data['partitions']), + 'num_indexes' => (string) count($data['partitions']), + 'query' => $this->query($data, $field), + 'get' => $this->get($data, $field, $index), + default => '', + }; + } + + /** + * @param array{partitions: list, values: array>} $data + */ + private function query(array $data, string $field): string { + if ($field !== self::NAME_FIELD && !in_array($field, Series::names(), true)) { + return ''; + } + + $lines = []; + + foreach ($data['partitions'] as $partition) { + $lines[] = $partition . '!' . ($field === self::NAME_FIELD ? $partition : Series::format($data['values']["p:$partition"][$field] ?? null)); + } + + return self::lines($lines); + } + + /** + * @param array{partitions: list, values: array>} $data + */ + private function get(array $data, string $field, string $index): string { + if (!in_array($field, Series::names(), true) || !in_array($index, $data['partitions'], true)) { + return 'U'; + } + + return Series::format($data['values']["p:$index"][$field] ?? null); + } + + /** + * @return array{at: int, cluster: ?Cluster, partitions: list, values: array>, age: ?int} + */ + private function load(int $hostId): array { + $now = $this->clock->now(); + + if (isset($this->cache[$hostId]) && $now >= $this->cache[$hostId]['at'] && $now - $this->cache[$hostId]['at'] < self::CACHE_SECONDS) { + return $this->cache[$hostId]; + } + + $cluster = $this->clusters->findByHost($hostId); + $data = ['at' => $now, 'cluster' => $cluster, 'partitions' => [], 'values' => [], 'age' => null]; + + if ($cluster !== null) { + $sections = $this->series->sections($cluster->id); + $jobsOk = ClusterValues::usable($cluster, $sections, Section::Jobs, $this->evaluator, $this->pollerInterval); + $nodesOk = ClusterValues::usable($cluster, $sections, Section::Nodes, $this->evaluator, $this->pollerInterval); + $jobs = $jobsOk ? $this->series->jobs($cluster->id) : []; + $nodes = $nodesOk ? $this->series->nodes($cluster->id) : []; + + $data['partitions'] = $this->series->partitions($cluster->id); + $data['age'] = ClusterValues::of($cluster, $sections, [], [], $this->evaluator, $this->pollerInterval)->age; + + foreach (array_merge([''], $data['partitions']) as $partition) { + $data['values']["p:$partition"] = Series::values($jobsOk, $nodesOk, $jobs["p:$partition"] ?? [], $nodes["p:$partition"] ?? []); + } + } + + return $this->cache[$hostId] = $data; + } + + /** + * @param list $lines + */ + private static function lines(array $lines): string { + return $lines === [] ? '' : implode("\n", $lines) . "\n"; + } +} diff --git a/lib/ClusterValues.php b/lib/ClusterValues.php index 40a119c..93fd82f 100644 --- a/lib/ClusterValues.php +++ b/lib/ClusterValues.php @@ -71,20 +71,14 @@ public static function of(Cluster $cluster, array $sections, array $jobs, array default => $evaluator->evaluate($oldest, $interval), }; - $usable = static function (Section $section) use ($sections, $evaluator, $interval): bool { - $record = $sections[$section->value] ?? null; - - return $record !== null && $evaluator->evaluate($record->observedAt, max($interval, $record->interval))->usable(); - }; - $values = []; - $jobsOk = $usable(Section::Jobs); + $jobsOk = self::usable($cluster, $sections, Section::Jobs, $evaluator, $pollerInterval); foreach (self::JOB_VALUES as $name) { $values[$name] = $jobsOk ? ($jobs[$name] ?? 0) : null; } - $nodesOk = $usable(Section::Nodes); + $nodesOk = self::usable($cluster, $sections, Section::Nodes, $evaluator, $pollerInterval); $values += [ 'nodes_total' => $nodesOk ? array_sum(array_diff_key($nodes, ['drain_flag' => 0])) : null, 'nodes_down' => $nodesOk ? ($nodes[NodeState::Down->value] ?? 0) : null, @@ -96,4 +90,16 @@ public static function of(Cluster $cluster, array $sections, array $jobs, array return new self($freshness, $oldest === null ? null : $evaluator->age($oldest), $values); } + + /** + * Whether a section's stored rows may be served: current or delayed on + * the longer of the cluster's interval and the one they were collected on. + * + * @param array $sections section value => record + */ + public static function usable(Cluster $cluster, array $sections, Section $section, FreshnessEvaluator $evaluator, int $pollerInterval): bool { + $record = $sections[$section->value] ?? null; + + return $record !== null && $evaluator->evaluate($record->observedAt, max($cluster->effectiveInterval($pollerInterval), $record->interval))->usable(); + } } diff --git a/lib/NodeTally.php b/lib/NodeTally.php new file mode 100644 index 0000000..e88b90e --- /dev/null +++ b/lib/NodeTally.php @@ -0,0 +1,101 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_hpcsched, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_hpcsched + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +namespace Somethingwithproof\Hpcsched; + +/** + * Node and CPU counts per partition, made from the nodes section when it is + * written, so the data inputs read a few rows per partition instead of every + * node (ADR 0011). + * + * Partition '' is the cluster: a node in several partitions counts once + * there, by name, and once in each partition. CPUs follow sinfo's %C split: + * allocated, idle, other, and total, where other is the unallocated CPUs of + * nodes that cannot take work (down, drained or draining, maintenance, + * powered down, or a state the plugin does not know). The utilization + * denominator is the total, other included. + */ +final class NodeTally { + /** Node state series, each normalized state in exactly one. */ + public const STATES = ['n_idle', 'n_allocated', 'n_mixed', 'n_drained', 'n_down', 'n_maint', 'n_powered_down', 'n_other']; + + public const CPUS = ['cpus_alloc', 'cpus_idle', 'cpus_other', 'cpus_total']; + + public const NODES = ['nodes_alloc', 'nodes_total']; + + public static function series(NodeState $state): string { + return match ($state) { + NodeState::Idle => 'n_idle', + NodeState::Allocated => 'n_allocated', + NodeState::Mixed => 'n_mixed', + NodeState::Drained, NodeState::Draining => 'n_drained', + NodeState::Down => 'n_down', + NodeState::Maintenance, NodeState::Reserved => 'n_maint', + NodeState::PoweredDown => 'n_powered_down', + NodeState::Other => 'n_other', + }; + } + + /** + * @param list $nodes + * + * @return list + */ + public static function rows(array $nodes): array { + $byName = []; + + // A node listed twice keeps its last record, as the node table does. + foreach ($nodes as $node) { + $byName['n:' . $node->name] = $node; + } + + $counts = []; + + foreach ($byName as $node) { + $total = max(0, $node->cpus); + $allocated = min($total, max(0, $node->allocCpus)); + $working = in_array($node->state, [NodeState::Idle, NodeState::Allocated, NodeState::Mixed, NodeState::Reserved], true); + $values = [ + self::series($node->state) => 1, + 'cpus_alloc' => $allocated, + 'cpus_idle' => $working ? $total - $allocated : 0, + 'cpus_other' => $working ? 0 : $total - $allocated, + 'cpus_total' => $total, + 'nodes_alloc' => $allocated > 0 || in_array($node->state, [NodeState::Allocated, NodeState::Mixed], true) ? 1 : 0, + 'nodes_total' => 1, + ]; + + foreach (array_merge([''], array_values(array_unique($node->partitions))) as $partition) { + foreach ($values as $name => $value) { + $counts["p:$partition"][$name] = ($counts["p:$partition"][$name] ?? 0) + $value; + } + } + } + + $rows = []; + + foreach ($counts as $key => $names) { + foreach ($names as $name => $value) { + $rows[] = ['partition' => substr((string) $key, 2), 'name' => (string) $name, 'value' => $value]; + } + } + + return $rows; + } +} diff --git a/lib/Schema.php b/lib/Schema.php index e878bb0..5a6798a 100644 --- a/lib/Schema.php +++ b/lib/Schema.php @@ -35,7 +35,7 @@ * schedule, or contacts the scheduler. */ final class Schema { - public const VERSION = 1; + public const VERSION = 2; public const HOOKS = [ 'config_arrays' => 'hpcsched_config_arrays', @@ -155,9 +155,30 @@ public function trackTables(): void { private function migrations(): array { return [ 1 => fn (): bool => $this->createTables(self::tables()), + // Milestone 3: the cluster's Cacti device and the node counts the + // data inputs read. A fresh install already has both from + // migration 1, which uses the current definitions. + 2 => fn (): bool => $this->createTables(array_intersect_key(self::tables(), ['plugin_hpcsched_node_count' => true])) && $this->addHostColumn(), ]; } + /** + * Added with ALTER TABLE rather than api_plugin_db_add_column(), which + * records the column for core to drop on uninstall, also when the + * administrator chose to keep the tables. + */ + private function addHostColumn(): bool { + if (!$this->columnExists('plugin_hpcsched_cluster', 'host_id')) { + db_execute_prepared("ALTER TABLE plugin_hpcsched_cluster ADD COLUMN host_id int(10) unsigned NOT NULL DEFAULT '0' AFTER poller_id, ADD KEY host_id (host_id)", [], true, $this->connection); + } + + return $this->columnExists('plugin_hpcsched_cluster', 'host_id'); + } + + private function columnExists(string $table, string $column): bool { + return db_fetch_cell_prepared('SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = ? AND COLUMN_NAME = ?', [$table, $column], '', true, $this->connection) > 0; + } + /** * @param array> $tables */ @@ -208,6 +229,7 @@ public static function tables(): array { $id('id') + ['auto_increment' => true], $text('name', 64), $id('poller_id') + ['default' => '1'], + $int('host_id'), $text('admin_state', 16, 'enabled'), $text('transport', 16, 'commands'), $int('collect_interval') + ['default' => (string) Cluster::DEFAULT_INTERVAL], @@ -222,7 +244,7 @@ public static function tables(): array { ], 'primary' => 'id', 'unique_keys' => [['name' => 'name', 'columns' => ['name']]], - 'keys' => [['name' => 'poller_id', 'columns' => ['poller_id']]], + 'keys' => [['name' => 'poller_id', 'columns' => ['poller_id']], ['name' => 'host_id', 'columns' => ['host_id']]], ], // One row per cluster: the reader lease and the last run. 'plugin_hpcsched_run' => $innodb + [ @@ -281,6 +303,19 @@ public static function tables(): array { ], 'unique_keys' => [['name' => 'cluster_count', 'columns' => ['cluster_id', 'partition_name', 'kind', 'name']]], ], + // Node and CPU counts per partition (NodeTally), written with + // the nodes section; partition '' is the cluster. + 'plugin_hpcsched_node_count' => $innodb + [ + 'comment' => 'Node and CPU counts by partition', + 'columns' => [ + $id('cluster_id'), + $text('partition_name', 64), + $text('name', 16), + $int('value'), + ...$stamps, + ], + 'unique_keys' => [['name' => 'cluster_count', 'columns' => ['cluster_id', 'partition_name', 'name']]], + ], 'plugin_hpcsched_node' => $innodb + [ 'comment' => 'Scheduler nodes with normalized and raw state', 'columns' => [ diff --git a/lib/Series.php b/lib/Series.php new file mode 100644 index 0000000..c51fb45 --- /dev/null +++ b/lib/Series.php @@ -0,0 +1,120 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_hpcsched, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_hpcsched + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + + +namespace Somethingwithproof\Hpcsched; + +/** + * The values the cluster and partition data sources store, by graph, and how + * a snapshot becomes them (ADR 0011, REQ-QUEUE-001 to REQ-QUEUE-005, + * REQ-REASON-001, REQ-NODEAGG-001 to REQ-NODEAGG-003). + * + * Each graph has a data source of its own holding exactly the values it + * draws, because Cacti 1.2 stores in an RRD file only the values a graph + * draws when the file is created. Names are at most 19 characters, Cacti's + * limit for a data source name. + * + * A value whose section cannot be vouched for is null (U), never zero. A + * utilization with no CPUs or nodes behind it is null too. + */ +final class Series { + /** Job series: the normalized states, Other renamed to keep it apart from the other Others. */ + public const JOBS = ['pending', 'held', 'running', 'completing', 'jobs_other']; + + public const UTILIZATION = ['cpu_util_pct', 'node_util_pct', 'nodes_alloc', 'nodes_total']; + + /** Seconds since the cluster's oldest configured section was observed. */ + public const AGE = 'age'; + + /** Index names the partition data query accepts, as the parser keeps them. */ + public const PARTITION_PATTERN = '/^[A-Za-z0-9._-]{1,64}$/'; + + /** + * Values per graph, the same for the cluster and for each partition. + * + * @return array> graph => value names + */ + public static function groups(): array { + return [ + 'Jobs' => self::JOBS, + 'Pending Reasons' => self::reasons(), + 'Nodes' => NodeTally::STATES, + 'CPUs' => NodeTally::CPUS, + 'Utilization' => self::UTILIZATION, + ]; + } + + /** + * @return list + */ + public static function reasons(): array { + return array_map(static fn (ReasonFamily $f): string => 'r_' . $f->value, ReasonFamily::cases()); + } + + /** + * Every per-partition value name. + * + * @return list + */ + public static function names(): array { + return array_merge(...array_values(self::groups())); + } + + /** + * @param array $jobs job_count names: state values and family values + * @param array $nodes NodeTally names + * + * @return array value name => value, null for U + */ + public static function values(bool $jobsUsable, bool $nodesUsable, array $jobs, array $nodes): array { + $out = []; + + foreach (JobState::cases() as $state) { + $out[$state === JobState::Other ? 'jobs_other' : $state->value] = $jobsUsable ? (float) ($jobs['state:' . $state->value] ?? 0) : null; + } + + foreach (ReasonFamily::cases() as $family) { + $out['r_' . $family->value] = $jobsUsable ? (float) ($jobs['family:' . $family->value] ?? 0) : null; + } + + foreach (array_merge(NodeTally::STATES, NodeTally::CPUS, NodeTally::NODES) as $name) { + $out[$name] = $nodesUsable ? (float) ($nodes[$name] ?? 0) : null; + } + + $out['cpu_util_pct'] = self::percent($out['cpus_alloc'], $out['cpus_total']); + $out['node_util_pct'] = self::percent($out['nodes_alloc'], $out['nodes_total']); + + return $out; + } + + /** + * A value as Cacti stores it: U for unknown, else a plain decimal. + */ + public static function format(?float $value): string { + if ($value === null || !is_finite($value)) { + return 'U'; + } + + return floor($value) === $value && abs($value) < 1e15 ? (string) (int) $value : rtrim(rtrim(sprintf('%.4F', $value), '0'), '.'); + } + + private static function percent(?float $part, ?float $whole): ?float { + return $part === null || $whole === null || $whole <= 0 ? null : round(100 * $part / $whole, 2); + } +} diff --git a/lib/SeriesRepository.php b/lib/SeriesRepository.php new file mode 100644 index 0000000..846ea31 --- /dev/null +++ b/lib/SeriesRepository.php @@ -0,0 +1,95 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_hpcsched, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_hpcsched + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + + +namespace Somethingwithproof\Hpcsched; + +/** + * Read-only snapshot queries for the data inputs: job and node counts per + * partition and the partition names of one cluster. Only the plugin's + * snapshot tables are read (REQ-OBJ-005). + */ +final class SeriesRepository { + public function __construct(private readonly \PDO|false $connection) { + } + + /** + * @return array section value => record + */ + public function sections(int $clusterId): array { + $out = []; + + foreach (Row::rows(db_fetch_assoc_prepared('SELECT * FROM plugin_hpcsched_section WHERE cluster_id = ?', [$clusterId], true, $this->connection)) as $row) { + $record = SectionRecord::fromRow($row); + + if ($record !== null) { + $out[$record->section->value] = $record; + } + } + + return $out; + } + + /** + * @return array> "p:" partition => "kind:name" => jobs, for states and families + */ + public function jobs(int $clusterId): array { + $out = []; + + foreach (Row::rows(db_fetch_assoc_prepared("SELECT partition_name, kind, name, jobs FROM plugin_hpcsched_job_count WHERE cluster_id = ? AND kind IN ('state', 'family')", [$clusterId], true, $this->connection)) as $row) { + $out['p:' . Row::string($row, 'partition_name')][Row::string($row, 'kind') . ':' . Row::string($row, 'name')] = Row::int($row, 'jobs', 0, 0); + } + + return $out; + } + + /** + * @return array> "p:" partition => name => value + */ + public function nodes(int $clusterId): array { + $out = []; + + foreach (Row::rows(db_fetch_assoc_prepared('SELECT partition_name, name, value FROM plugin_hpcsched_node_count WHERE cluster_id = ?', [$clusterId], true, $this->connection)) as $row) { + $out['p:' . Row::string($row, 'partition_name')][Row::string($row, 'name')] = Row::int($row, 'value', 0, 0); + } + + return $out; + } + + /** + * Partition names that can be data query indexes, sorted. + * + * @return list + */ + public function partitions(int $clusterId): array { + $names = []; + + foreach (Row::rows(db_fetch_assoc_prepared('SELECT name FROM plugin_hpcsched_partition WHERE cluster_id = ? ORDER BY name', [$clusterId], true, $this->connection)) as $row) { + $name = Row::string($row, 'name'); + + if (preg_match(Series::PARTITION_PATTERN, $name) === 1) { + $names[] = $name; + } + } + + sort($names, SORT_STRING); + + return array_values(array_unique($names)); + } +} diff --git a/lib/SnapshotRepository.php b/lib/SnapshotRepository.php index a239899..98a29fc 100644 --- a/lib/SnapshotRepository.php +++ b/lib/SnapshotRepository.php @@ -55,6 +55,15 @@ public function apply(int $clusterId, string $holder, int $now, int $interval, S if ($outcome->state === SectionState::Completed) { $ok = $this->replace($clusterId, $section, $snapshot, $stamps) && $this->inTransaction(); + + // The node counts are the nodes section's, so they are + // replaced with it and never outlive it. + if ($ok && $section === Section::Nodes) { + $ok = $this->write($clusterId, 'plugin_hpcsched_node_count', ['partition_name', 'name', 'value'], array_map( + static fn (array $r): array => [$r['partition'], $r['name'], $r['value']], + NodeTally::rows($snapshot->nodes ?? []) + ), $stamps); + } } $ok = $ok && $this->section($clusterId, $section, $outcome, $now, $stamps) && $this->inTransaction(); @@ -114,6 +123,17 @@ private function replace(int $clusterId, Section $section, Snapshot $snapshot, a )], }; + return $this->write($clusterId, $table, $columns, $rows, $stamps); + } + + /** + * Replace every row of a cluster in one table. + * + * @param list $columns + * @param list> $rows + * @param array{int, int, int} $stamps + */ + private function write(int $clusterId, string $table, array $columns, array $rows, array $stamps): bool { if (db_execute_prepared("DELETE FROM $table WHERE cluster_id = ?", [$clusterId], true, $this->connection) === false) { return false; } diff --git a/phpstan.neon b/phpstan.neon index 3bbc48e..a3dfd8e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -23,6 +23,7 @@ parameters: paths: - lib - setup.php + - scripts - include/unbooted-uninstall.php scanDirectories: - %env.CACTI_PATH%/lib diff --git a/resource/script_server/hpcsched_partitions.xml b/resource/script_server/hpcsched_partitions.xml new file mode 100644 index 0000000..7a7312a --- /dev/null +++ b/resource/script_server/hpcsched_partitions.xml @@ -0,0 +1,185 @@ + + HPC Scheduler Partitions + Partitions of a scheduler cluster, answered from the HPC Scheduler plugin snapshot + |path_cacti|/plugins/hpcsched/scripts/ss_hpcsched_partitions.php + ss_hpcsched_partitions + php + |host_id| + index + query + get + num_indexes + ! + hpcPartition + alphabetic + |chosen_order_field| + true + + + + Partition + input + name + + + Pending Jobs (eligible) + output + pending + + + Held Jobs + output + held + + + Running Jobs + output + running + + + Completing Jobs + output + completing + + + Jobs in Other States + output + jobs_other + + + Pending Jobs: Priority + output + r_priority + + + Pending Jobs: Resources + output + r_resources + + + Pending Jobs: Dependency + output + r_dependency + + + Pending Jobs: Held + output + r_held + + + Pending Jobs: Begin time + output + r_begin_time + + + Pending Jobs: Reservation + output + r_reservation + + + Pending Jobs: Association limits + output + r_assoc + + + Pending Jobs: QOS limits + output + r_qos + + + Pending Jobs: Partition limits + output + r_partition + + + Pending Jobs: Node availability + output + r_node + + + Pending Jobs: Other + output + r_other + + + Idle Nodes + output + n_idle + + + Allocated Nodes + output + n_allocated + + + Mixed Nodes + output + n_mixed + + + Drained or Draining Nodes + output + n_drained + + + Down Nodes + output + n_down + + + Maintenance or Reserved Nodes + output + n_maint + + + Powered Down Nodes + output + n_powered_down + + + Nodes in Other States + output + n_other + + + Allocated CPUs + output + cpus_alloc + + + Idle CPUs + output + cpus_idle + + + Unavailable CPUs + output + cpus_other + + + Total CPUs + output + cpus_total + + + CPU Utilization (percent) + output + cpu_util_pct + + + Node Utilization (percent) + output + node_util_pct + + + Nodes with Allocated CPUs + output + nodes_alloc + + + Total Nodes + output + nodes_total + + + diff --git a/scripts/ss_hpcsched_cluster.php b/scripts/ss_hpcsched_cluster.php new file mode 100644 index 0000000..86645a2 --- /dev/null +++ b/scripts/ss_hpcsched_cluster.php @@ -0,0 +1,56 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_hpcsched, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_hpcsched + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + + +/* + * Script server input for the "HPC Scheduler Cluster Values" data sources: + * every cluster value and age as name:value pairs in one call. It answers + * from the plugin snapshot and never contacts a scheduler. + * + * This file must parse on PHP 8.0: the script server includes it on + * whatever PHP the site runs, and hpcsched_boot() refuses before any plugin + * class loads, answering U. + */ + +if (!isset($called_by_script_server)) { + include_once(__DIR__ . '/../../../include/cli_check.php'); + + $hpcsched_args = isset($_SERVER['argv']) && is_array($_SERVER['argv']) ? array_values(array_filter(array_slice($_SERVER['argv'], 1), 'is_string')) : array(); + + print ss_hpcsched_cluster(...$hpcsched_args); +} + +/** + * @param int|string $host_id the cluster's Cacti device + */ +function ss_hpcsched_cluster($host_id = 0): string { + static $series = null; + + include_once(dirname(__DIR__) . '/setup.php'); + + if (!hpcsched_boot()) { + return 'U'; + } + + if ($series === null) { + $series = hpcsched_cluster_series(); + } + + return $series->cluster((int) $host_id); +} diff --git a/scripts/ss_hpcsched_partitions.php b/scripts/ss_hpcsched_partitions.php new file mode 100644 index 0000000..e53c423 --- /dev/null +++ b/scripts/ss_hpcsched_partitions.php @@ -0,0 +1,61 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_hpcsched, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_hpcsched + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + + +/* + * Script server data query for the partitions of a cluster + * (resource/script_server/hpcsched_partitions.xml). Cacti runs it as a PHP + * CLI process for the index and query steps and through the script server + * for each polled value. It answers from the plugin snapshot and never + * contacts a scheduler. + * + * This file must parse on PHP 8.0: the script server includes it on + * whatever PHP the site runs, and hpcsched_boot() refuses before any plugin + * class loads, answering U. + */ + +if (!isset($called_by_script_server)) { + include_once(__DIR__ . '/../../../include/cli_check.php'); + + $hpcsched_args = isset($_SERVER['argv']) && is_array($_SERVER['argv']) ? array_values(array_filter(array_slice($_SERVER['argv'], 1), 'is_string')) : array(); + + print ss_hpcsched_partitions(...$hpcsched_args); +} + +/** + * @param int|string $host_id the cluster's Cacti device + * @param string $cmd index, num_indexes, query, or get + * @param string $arg1 the field for query and get + * @param string $arg2 the index (partition name) for get + */ +function ss_hpcsched_partitions($host_id = 0, $cmd = 'index', $arg1 = '', $arg2 = ''): string { + static $series = null; + + include_once(dirname(__DIR__) . '/setup.php'); + + if (!hpcsched_boot()) { + return $cmd === 'get' ? 'U' : ''; + } + + if ($series === null) { + $series = hpcsched_cluster_series(); + } + + return $series->partitions((int) $host_id, (string) $cmd, (string) $arg1, (string) $arg2); +} diff --git a/setup.php b/setup.php index 52f0616..53c409e 100644 --- a/setup.php +++ b/setup.php @@ -357,6 +357,22 @@ function hpcsched_due_clusters(int $poller_id): array { ))->due($poller_id, hpcsched_poller_interval()); } +/** + * The answerer behind scripts/ss_hpcsched_cluster.php and + * scripts/ss_hpcsched_partitions.php. + */ +function hpcsched_cluster_series(): \Somethingwithproof\Hpcsched\ClusterSeries { + $clock = new \Somethingwithproof\Hpcsched\SystemClock(); + + return new \Somethingwithproof\Hpcsched\ClusterSeries( + new \Somethingwithproof\Hpcsched\ClusterRepository(false, $clock), + new \Somethingwithproof\Hpcsched\SeriesRepository(false), + new \Somethingwithproof\Hpcsched\FreshnessEvaluator($clock), + $clock, + hpcsched_poller_interval() + ); +} + function hpcsched_poller_interval(): int { $interval = (int) read_config_option('poller_interval'); diff --git a/tests/Unit/SeriesTest.php b/tests/Unit/SeriesTest.php new file mode 100644 index 0000000..18aed3a --- /dev/null +++ b/tests/Unit/SeriesTest.php @@ -0,0 +1,258 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_hpcsched, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_hpcsched + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + + +use Somethingwithproof\Hpcsched\ClusterRepository; +use Somethingwithproof\Hpcsched\ClusterSeries; +use Somethingwithproof\Hpcsched\FixedClock; +use Somethingwithproof\Hpcsched\FreshnessEvaluator; +use Somethingwithproof\Hpcsched\NodeTally; +use Somethingwithproof\Hpcsched\Series; +use Somethingwithproof\Hpcsched\SeriesRepository; +use Somethingwithproof\Hpcsched\SlurmJson; +use Somethingwithproof\Hpcsched\SlurmParser; + +const SERIES_T = 1800000000; + +function series_fixture(string $section): array { + return SlurmJson::decode((string) file_get_contents(dirname(__DIR__) . "/fixtures/slurm/25.11/$section.json")); +} + +/** + * The 25.11 fixture snapshot as the tables hold it, observed $age seconds ago. + */ +function series_tables(int $age = 10, string $jobsState = 'completed'): void { + $observed = SERIES_T - $age; + $jobs = []; + $nodes = []; + + foreach (SlurmParser::jobs(series_fixture('jobs'))->rows() as $row) { + $jobs[] = ['partition_name' => $row['partition'], 'kind' => $row['kind'], 'name' => $row['name'], 'jobs' => $row['jobs']]; + } + + foreach (NodeTally::rows(SlurmParser::nodes(series_fixture('nodes'))) as $row) { + $nodes[] = ['partition_name' => $row['partition'], 'name' => $row['name'], 'value' => $row['value']]; + } + + $section = static fn (string $name, string $state): array => ['cluster_id' => 7, 'section' => $name, 'state' => $state, 'error_class' => '', 'attempted_at' => $observed, 'records' => 1, 'observed_at' => $observed, 'ingested_at' => $observed, 'collect_interval' => 60]; + + $GLOBALS['__hpcsched_db_rows'] = [ + 'FROM plugin_hpcsched_cluster WHERE host_id' => [['id' => 7, 'name' => 'c1', 'poller_id' => 1, 'host_id' => 42, 'admin_state' => 'enabled', 'transport' => 'commands', 'collect_interval' => 60]], + 'FROM plugin_hpcsched_section' => [$section('jobs', $jobsState), $section('nodes', 'completed'), $section('partitions', 'completed')], + 'FROM plugin_hpcsched_job_count' => $jobs, + 'FROM plugin_hpcsched_node_count' => $nodes, + // Stored as the parser left them; a name that cannot be an index is + // left out of the data query. + 'FROM plugin_hpcsched_partition' => [['name' => 'batch'], ['name' => 'gpu'], ['name' => 'bad name']], + ]; +} + +function series_answerer(): ClusterSeries { + $clock = new FixedClock(SERIES_T); + + return new ClusterSeries(new ClusterRepository(false, $clock), new SeriesRepository(false), new FreshnessEvaluator($clock), $clock, 60); +} + +/** + * @return array + */ +function series_pairs(string $answer): array { + $out = []; + + foreach (explode(' ', $answer) as $pair) { + [$name, $value] = explode(':', $pair, 2); + $out[$name] = $value; + } + + return $out; +} + +beforeEach(function () { + $GLOBALS['__hpcsched_db_rows'] = []; +}); + +describe('node counts per partition (REQ-NODEAGG-001, REQ-NODEAGG-003)', function () { + it('counts a node in several partitions once for the cluster and once per partition', function () { + $counts = []; + + foreach (NodeTally::rows(SlurmParser::nodes(series_fixture('nodes'))) as $row) { + $counts[$row['partition']][$row['name']] = $row['value']; + } + + // n04 is in batch and gpu: 8 nodes in all, 4 plus 5 by partition. + expect($counts['']['nodes_total'])->toBe(8) + ->and($counts['batch']['nodes_total'])->toBe(4) + ->and($counts['gpu']['nodes_total'])->toBe(5) + ->and(array_sum(array_intersect_key($counts[''], array_flip(NodeTally::STATES))))->toBe(8); + }); + + it('puts each normalized state in one node series, an unknown state in Other', function () { + $counts = []; + + foreach (NodeTally::rows(SlurmParser::nodes(series_fixture('nodes'))) as $row) { + $counts[$row['partition']][$row['name']] = $row['value']; + } + + expect(array_intersect_key($counts[''], array_flip(NodeTally::STATES)))->toBe([ + 'n_idle' => 1, 'n_allocated' => 1, 'n_down' => 1, 'n_drained' => 2, 'n_powered_down' => 1, 'n_maint' => 1, 'n_other' => 1, + ]); + }); + + it('splits CPUs the way sinfo %C does, with unavailable nodes as other', function () { + $counts = []; + + foreach (NodeTally::rows(SlurmParser::nodes(series_fixture('nodes'))) as $row) { + $counts[$row['partition']][$row['name']] = $row['value']; + } + + $cpus = static fn (string $p): array => array_intersect_key($counts[$p], array_flip(NodeTally::CPUS)); + + // Allocated/idle/other/total: sinfo -o %C gives 72/64/248/384. + expect($cpus(''))->toBe(['cpus_alloc' => 72, 'cpus_idle' => 64, 'cpus_other' => 248, 'cpus_total' => 384]) + ->and($cpus('batch'))->toBe(['cpus_alloc' => 72, 'cpus_idle' => 64, 'cpus_other' => 120, 'cpus_total' => 256]) + ->and($cpus('gpu'))->toBe(['cpus_alloc' => 8, 'cpus_idle' => 0, 'cpus_other' => 184, 'cpus_total' => 192]) + ->and($counts['']['nodes_alloc'])->toBe(2) + ->and($counts['gpu']['nodes_alloc'])->toBe(1); + }); +}); + +describe('series values', function () { + it('names every value within the 19 characters of an RRD data source name, once', function () { + foreach (array_merge(Series::names(), [Series::AGE]) as $name) { + expect(strlen($name))->toBeLessThanOrEqual(19)->and($name)->toMatch('/^[a-z][a-z0-9_]*$/'); + } + + expect(Series::names())->toBe(array_values(array_unique(Series::names()))) + ->and(count(Series::names()))->toBe(32); + }); + + it('serves U for every count of a section it cannot vouch for, never zero', function () { + $values = Series::values(false, true, ['state:pending' => 5], ['n_idle' => 3, 'cpus_total' => 10, 'cpus_alloc' => 5]); + + expect($values['pending'])->toBeNull() + ->and($values['r_priority'])->toBeNull() + ->and($values['n_idle'])->toBe(3.0) + ->and($values['cpu_util_pct'])->toBe(50.0); + + $values = Series::values(true, false, [], []); + + expect($values['pending'])->toBe(0.0) + ->and($values['cpus_total'])->toBeNull() + ->and($values['cpu_util_pct'])->toBeNull(); + }); + + it('leaves utilization unknown when nothing is behind it', function () { + expect(Series::values(true, true, [], [])['cpu_util_pct'])->toBeNull() + ->and(Series::format(null))->toBe('U') + ->and(Series::format(18.75))->toBe('18.75') + ->and(Series::format(1e20))->not->toContain('E'); + }); +}); + +describe('cluster and partition data inputs (REQ-OBJ-005, REQ-QUEUE-001 to REQ-QUEUE-005)', function () { + it('answers the cluster values in one call, from the snapshot tables only', function () { + series_tables(); + $GLOBALS['__hpcsched_db_reads'] = []; + + $pairs = series_pairs(series_answerer()->cluster(42)); + + // 9 job records: two running, one completing, one held, and five + // pending of which two are arrays with 10 and 50 tasks left. + expect($pairs['running'])->toBe('2') + ->and($pairs['completing'])->toBe('1') + ->and($pairs['held'])->toBe('1') + ->and($pairs['pending'])->toBe('63') + ->and($pairs['r_assoc'])->toBe('50') + ->and($pairs['r_held'])->toBe('1') + ->and($pairs['cpus_alloc'])->toBe('72') + ->and($pairs['cpu_util_pct'])->toBe('18.75') + ->and($pairs['node_util_pct'])->toBe('25') + ->and($pairs['age'])->toBe('10') + ->and(count($pairs))->toBe(33); + + foreach ($GLOBALS['__hpcsched_db_reads'] as $sql) { + expect($sql)->toMatch('/FROM plugin_hpcsched_(cluster|section|job_count|node_count|partition)\b/'); + } + }); + + it('counts a job in several partitions once per partition it names', function () { + series_tables(); + $answer = series_answerer(); + + // Job 103 is pending in batch and gpu. + expect($answer->partitions(42, 'get', 'r_priority', 'batch'))->toBe('1') + ->and($answer->partitions(42, 'get', 'r_priority', 'gpu'))->toBe('1') + ->and(series_pairs($answer->cluster(42))['r_priority'])->toBe('1') + ->and($answer->partitions(42, 'get', 'pending', 'batch'))->toBe('62') + ->and($answer->partitions(42, 'get', 'pending', 'gpu'))->toBe('2'); + }); + + it('lists partitions as indexes by name, and only names that can be indexes', function () { + series_tables(); + $answer = series_answerer(); + + expect($answer->partitions(42, 'index'))->toBe("batch\ngpu\n") + ->and($answer->partitions(42, 'num_indexes'))->toBe('2') + ->and($answer->partitions(42, 'query', 'name'))->toBe("batch!batch\ngpu!gpu\n") + ->and($answer->partitions(42, 'query', 'cpus_total'))->toBe("batch!256\ngpu!192\n"); + }); + + it('answers U or nothing to a hostile field, index, command, or device', function () { + series_tables(); + $answer = series_answerer(); + + expect($answer->partitions(42, 'get', 'password', 'batch'))->toBe('U') + ->and($answer->partitions(42, 'get', 'pending', '../../etc/passwd'))->toBe('U') + ->and($answer->partitions(42, 'get', 'pending', 'bad name'))->toBe('U') + ->and($answer->partitions(42, 'query', 'password'))->toBe('') + ->and($answer->partitions(42, 'drop'))->toBe(''); + + $GLOBALS['__hpcsched_db_rows'] = []; + + expect(series_answerer()->partitions(43, 'index'))->toBe('') + ->and(series_answerer()->partitions(43, 'num_indexes'))->toBe('0') + ->and(series_pairs(series_answerer()->cluster(43))['pending'])->toBe('U') + ->and(series_pairs(series_answerer()->cluster(43))['age'])->toBe('U'); + }); + + it('turns counts U once the snapshot is stale, and keeps age numeric (REQ-ALERT-001, REQ-ALERT-002)', function () { + series_tables(400); + $pairs = series_pairs(series_answerer()->cluster(42)); + + expect($pairs['pending'])->toBe('U') + ->and($pairs['n_idle'])->toBe('U') + ->and($pairs['cpu_util_pct'])->toBe('U') + ->and($pairs['age'])->toBe('400') + ->and(series_answerer()->partitions(42, 'get', 'running', 'batch'))->toBe('U'); + }); + + it('keeps serving nodes when only the jobs section failed', function () { + series_tables(10, 'failed'); + $pairs = series_pairs(series_answerer()->cluster(42)); + + // A failed section keeps its rows and their observation time, so it + // is served until it turns stale; a section never collected is U. + expect($pairs['pending'])->toBe('63')->and($pairs['n_idle'])->toBe('1'); + + $GLOBALS['__hpcsched_db_rows']['FROM plugin_hpcsched_section'] = array_slice($GLOBALS['__hpcsched_db_rows']['FROM plugin_hpcsched_section'], 1); + $pairs = series_pairs(series_answerer()->cluster(42)); + + expect($pairs['pending'])->toBe('U')->and($pairs['n_idle'])->toBe('1'); + }); +}); From 6c32d6a97243efd9508de30b8195776c3f6420f3 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Sun, 15 Nov 2026 07:46:48 -0800 Subject: [PATCH 03/15] feat: ship the cluster device, data query, and graph templates (#41) The plugin now ships its Cacti objects as a template export and imports them on install and upgrade with Cacti's own importer. Every object has a fixed hash derived from its kind and name, so a reinstall or an upgrade updates the same rows instead of adding copies, and the installer finds each object by hash rather than by name. The export holds the HPC Scheduler Cluster device template, the cluster data input and data template (every cluster value plus the snapshot age), six cluster graph templates, and the HPC Scheduler Partitions data query with five partition graph templates, each with its own data template that holds exactly the values it draws. Core's data source profile is referenced by hash and not shipped. The data query file is copied into resource/script_server with its sha256 recorded. A file there that the plugin did not write, or that was changed after, is never overwritten: the install fails with the reason kept for the health page. Uninstall removes the file only when it is still the one the plugin wrote; templates and graphs stay. tests/bin/build-templates.php regenerates the export from a disposable Cacti database. Unit tests check that every hash the installer looks up is in the export and that the query fields are exactly the partition series. Signed-off-by: Thomas Vincent --- REUSE.toml | 7 +- lib/CactiObjectRepository.php | 131 + lib/TemplateInstaller.php | 290 ++ templates/hpcsched-templates.xml | 6973 ++++++++++++++++++++++++++++++ tests/Unit/SeriesTest.php | 1 - tests/Unit/TemplatesTest.php | 85 + tests/bin/build-templates.php | 461 ++ 7 files changed, 7945 insertions(+), 3 deletions(-) create mode 100644 lib/CactiObjectRepository.php create mode 100644 lib/TemplateInstaller.php create mode 100644 templates/hpcsched-templates.xml create mode 100644 tests/Unit/TemplatesTest.php create mode 100644 tests/bin/build-templates.php diff --git a/REUSE.toml b/REUSE.toml index 1607615..18e8c51 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -2,8 +2,9 @@ version = 1 # Files that cannot carry a comment header, or whose format makes one # awkward: documentation, repository metadata, GitHub templates, test -# configuration, captured node output fixtures, and translation catalogs, -# which gettext regenerates. +# configuration, captured node output fixtures, translation catalogs, +# which gettext regenerates, and the Cacti template export and data query +# file, which Cacti reads and the template builder regenerates. [[annotations]] path = [ "README.md", @@ -20,6 +21,8 @@ path = [ "tests/node-matching/fixtures.json", "locales/po/**", "locales/LC_MESSAGES/**", + "resource/script_server/*.xml", + "templates/*.xml", ] precedence = "aggregate" SPDX-FileCopyrightText = "2026 Thomas Vincent " diff --git a/lib/CactiObjectRepository.php b/lib/CactiObjectRepository.php new file mode 100644 index 0000000..1069c81 --- /dev/null +++ b/lib/CactiObjectRepository.php @@ -0,0 +1,131 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_hpcsched, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_hpcsched + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + + +namespace Somethingwithproof\Hpcsched; + +/** + * Read-only lookups in Cacti's own tables: templates by hash, devices, + * graphs, and data query indexes. Every change to a Cacti object goes + * through Cacti's API functions in DeviceProvisioner; nothing here writes. + */ +final class CactiObjectRepository { + /** Tables whose rows the plugin looks up by hash. */ + private const HASHED = ['host_template', 'data_input', 'data_template', 'graph_templates', 'snmp_query']; + + public function __construct(private readonly \PDO|false $connection) { + } + + public function idByHash(string $table, string $hash): int { + if (!in_array($table, self::HASHED, true) || preg_match('/^[0-9a-f]{32}$/', $hash) !== 1) { + return 0; + } + + return Row::count(db_fetch_cell_prepared("SELECT id FROM `$table` WHERE hash = ? ORDER BY id LIMIT 1", [$hash], '', true, $this->connection)); + } + + public function graphTemplateId(string $name): int { + return $this->idByHash('graph_templates', TemplateInstaller::hash('graph_template', $name)); + } + + public function queryId(): int { + return $this->idByHash('snmp_query', TemplateInstaller::hash('data_query', TemplateInstaller::QUERY)); + } + + public function deviceTemplateId(): int { + return $this->idByHash('host_template', TemplateInstaller::hash('host_template', TemplateInstaller::DEVICE_TEMPLATE)); + } + + /** + * The query graph (snmp_query_graph) that creates a partition graph. + */ + public function queryGraphId(int $queryId, int $graphTemplateId): int { + return Row::count(db_fetch_cell_prepared('SELECT id FROM snmp_query_graph WHERE snmp_query_id = ? AND graph_template_id = ? ORDER BY id LIMIT 1', [$queryId, $graphTemplateId], '', true, $this->connection)); + } + + public function defaultProfileId(): int { + $id = Row::count(db_fetch_cell_prepared("SELECT id FROM data_source_profiles WHERE `default` = 'on' ORDER BY id LIMIT 1", [], '', true, $this->connection)); + + return $id > 0 ? $id : 1; + } + + /** + * @return array{id: int, description: string, poller_id: int}|null + */ + public function device(int $hostId): ?array { + $row = $hostId > 0 ? Row::one(db_fetch_row_prepared("SELECT id, description, poller_id FROM host WHERE id = ? AND deleted = ''", [$hostId], true, $this->connection)) : null; + + if ($row === null || Row::int($row, 'id', 0, 1) === 0) { + return null; + } + + return ['id' => Row::int($row, 'id', 0, 1), 'description' => Row::string($row, 'description'), 'poller_id' => Row::int($row, 'poller_id', 1, 1)]; + } + + /** + * Devices a cluster may be mapped to: every device not already mapped. + * + * @param list $mapped host ids already in use + * + * @return array host id => description + */ + public function mappableDevices(array $mapped): array { + $out = []; + + foreach (Row::rows(db_fetch_assoc_prepared("SELECT id, description FROM host WHERE deleted = '' ORDER BY description, id", [], true, $this->connection)) as $row) { + $id = Row::int($row, 'id', 0, 1); + + if ($id > 0 && !in_array($id, $mapped, true)) { + $out[$id] = Row::string($row, 'description'); + } + } + + return $out; + } + + /** + * Graphs of a device from one template; for a partition graph, of one + * index. + */ + public function graphCount(int $hostId, int $graphTemplateId, string $index = ''): int { + return Row::count(db_fetch_cell_prepared('SELECT COUNT(*) FROM graph_local WHERE host_id = ? AND graph_template_id = ? AND snmp_index = ?', [$hostId, $graphTemplateId, $index], '', true, $this->connection)); + } + + public function hasQuery(int $hostId, int $queryId): bool { + return Row::count(db_fetch_cell_prepared('SELECT COUNT(*) FROM host_snmp_query WHERE host_id = ? AND snmp_query_id = ?', [$hostId, $queryId], '', true, $this->connection)) > 0; + } + + /** + * The indexes Cacti holds for a device's data query, as its last + * reindex left them. + * + * @return list + */ + public function indexes(int $hostId, int $queryId): array { + $out = []; + + foreach (Row::rows(db_fetch_assoc_prepared("SELECT DISTINCT snmp_index FROM host_snmp_cache WHERE host_id = ? AND snmp_query_id = ? AND snmp_index != '' ORDER BY snmp_index", [$hostId, $queryId], true, $this->connection)) as $row) { + $out[] = Row::string($row, 'snmp_index'); + } + + sort($out, SORT_STRING); + + return $out; + } +} diff --git a/lib/TemplateInstaller.php b/lib/TemplateInstaller.php new file mode 100644 index 0000000..f46fabc --- /dev/null +++ b/lib/TemplateInstaller.php @@ -0,0 +1,290 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_hpcsched, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_hpcsched + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + + +namespace Somethingwithproof\Hpcsched; + +/** + * Imports the shipped device, data, and graph templates and the partition + * data query with Cacti's own import_xml_data() (REQ-OBJ-001), and installs + * the data query XML under Cacti's resource/script_server/. + * + * templates/hpcsched-templates.xml is Cacti's own export of templates that + * tests/bin/build-templates.php builds in a disposable Cacti; it is never + * edited by hand. Every object carries a hash derived from its name, so a + * second import updates the objects of the first instead of adding copies, + * and the plugin finds its objects by hash even after an operator renames + * them. + * + * Cacti 1.2.31 and 1.2.x read a data query XML only from inside + * /resource (get_data_query_array() rejects any other path after + * resolving it), so the file is copied there. A file the plugin did not + * write, or that was changed after it was written, is never replaced or + * removed: the plugin records the SHA-256 of each file it wrote. + */ +final class TemplateInstaller { + /** Bump when templates/hpcsched-templates.xml or the query XML changes. */ + public const VERSION = 1; + + public const SETTING = 'hpcsched_templates_version'; + public const FAILURE_SETTING = 'hpcsched_templates_failure'; + public const FILES_SETTING = 'hpcsched_query_files'; + + public const DEVICE_TEMPLATE = 'HPC Scheduler Cluster'; + public const CLUSTER = 'HPC Scheduler Cluster Values'; + public const QUERY = 'HPC Scheduler Partitions'; + public const QUERY_FILE = 'hpcsched_partitions.xml'; + public const AGE_GRAPH = 'HPC Scheduler Snapshot Age'; + + public function __construct( + private readonly string $pluginPath, + private readonly string $cactiPath, + private readonly CactiObjectRepository $objects, + ) { + } + + /** + * The hash the template builder gives an object, 32 hex characters as + * Cacti stores it. + */ + public static function hash(string $kind, string $name): string { + return md5('plugin_hpcsched:' . $kind . ':' . $name); + } + + /** + * Graph templates created with every cluster device, each drawing one + * group of the cluster values, plus the age graph that keeps age stored. + * + * @return array Series group (or age) => graph template name + */ + public static function overview(): array { + $out = []; + + foreach (array_keys(Series::groups()) as $group) { + $out[$group] = 'HPC Scheduler ' . $group; + } + + return $out + [Series::AGE => self::AGE_GRAPH]; + } + + /** + * Per-partition graph templates, one per Series group; each has a data + * template of the same name holding exactly the values it draws. + * + * @return array Series group => graph and data template name + */ + public static function partitionGraphs(): array { + $out = []; + + foreach (array_keys(Series::groups()) as $group) { + $out[$group] = 'HPC Scheduler Partition ' . $group; + } + + return $out; + } + + public function isCurrent(): bool { + return (int) read_config_option(self::SETTING) === self::VERSION && $this->present() && $this->queryFileProblem() === null; + } + + /** + * The reason the last install failed, or '' when it succeeded. + */ + public function failure(): string { + return (string) read_config_option(self::FAILURE_SETTING); + } + + /** + * Install the query file and import the templates. A failure is logged + * and kept for the health page; success clears it. + */ + public function install(): bool { + $error = $this->installQueryFile() ?? $this->import(); + + if ($error !== null) { + Log::error($error); + set_config_option(self::FAILURE_SETTING, $error); + + return false; + } + + set_config_option(self::SETTING, (string) self::VERSION); + set_config_option(self::FAILURE_SETTING, ''); + + return true; + } + + /** + * Remove the query file the plugin wrote if nobody changed it since. The + * templates and every Cacti object made from them stay: they belong to + * the site once imported. + */ + public function uninstall(): void { + $written = $this->written(); + $target = $this->queryTarget(); + + if ($written !== null && $target !== null && is_file($target) && hash_file('sha256', $target) === $written) { + @unlink($target); + } + + set_config_option(self::FILES_SETTING, ''); + set_config_option(self::SETTING, ''); + } + + /** + * Every shipped object exists, found by hash. + */ + public function present(): bool { + $found = [ + $this->objects->deviceTemplateId(), + $this->objects->idByHash('data_input', self::hash('data_input', self::CLUSTER)), + $this->objects->idByHash('data_template', self::hash('data_template', self::CLUSTER)), + $this->objects->queryId(), + ]; + + foreach (self::overview() as $name) { + $found[] = $this->objects->graphTemplateId($name); + } + + foreach (self::partitionGraphs() as $name) { + $found[] = $this->objects->graphTemplateId($name); + $found[] = $this->objects->idByHash('data_template', self::hash('data_template', $name)); + } + + return !in_array(0, $found, true); + } + + /** + * Why the installed query file is missing or differs from the shipped + * one, or null when it is in place. + */ + public function queryFileProblem(): ?string { + $source = $this->querySource(); + $target = $this->queryTarget(); + + if ($target === null || !is_file($target)) { + return __('The data query file %s is not installed in Cacti\'s resource/script_server directory.', self::QUERY_FILE, 'hpcsched'); + } + + if (!is_file($source) || hash_file('sha256', $target) !== hash_file('sha256', $source)) { + return __('The data query file %s in Cacti\'s resource/script_server directory differs from the one the plugin ships.', self::QUERY_FILE, 'hpcsched'); + } + + return null; + } + + /** + * @return string|null the reason, or null when the file is in place + */ + private function installQueryFile(): ?string { + $source = $this->querySource(); + $target = $this->queryTarget(); + $written = $this->written(); + + if ($target === null || !is_file($source)) { + return sprintf('The data query file %s cannot be installed: the source or the Cacti resource directory is missing', self::QUERY_FILE); + } + + $want = (string) hash_file('sha256', $source); + + if (is_file($target)) { + $have = (string) hash_file('sha256', $target); + + if ($have === $want) { + if ($written !== $want) { + set_config_option(self::FILES_SETTING, $want); + } + + return null; + } + + if ($written !== $have) { + return sprintf('%s exists and was not written by this plugin, or was changed after; it was left as it is. Compare it with plugins/hpcsched/resource/script_server/%s', $target, self::QUERY_FILE); + } + } + + if (!is_writable(dirname($target)) || @copy($source, $target) === false || hash_file('sha256', $target) !== $want) { + return sprintf('Could not write %s. Copy plugins/hpcsched/resource/script_server/%s there as the web server user, then install the templates again from the health page', $target, self::QUERY_FILE); + } + + set_config_option(self::FILES_SETTING, $want); + + return null; + } + + /** + * @return string|null the reason, or null when every object imported + */ + private function import(): ?string { + $file = $this->pluginPath . '/templates/hpcsched-templates.xml'; + $xml = is_readable($file) ? file_get_contents($file) : false; + + if (!is_string($xml) || $xml === '') { + return 'The template file ' . $file . ' is missing or empty'; + } + + include_once($this->cactiPath . '/lib/utility.php'); + include_once($this->cactiPath . '/lib/import.php'); + + $result = import_xml_data($xml, false, $this->objects->defaultProfileId()); + + if (!is_array($result) || $result === []) { + return 'Importing the HPC Scheduler templates returned nothing'; + } + + $failed = 0; + + foreach ($result as $type => $entries) { + if ($type === 'files' || !is_array($entries)) { + continue; + } + + foreach ($entries as $entry) { + if (is_array($entry) && ($entry['result'] ?? '') === 'fail') { + $failed++; + } + } + } + + if ($failed > 0) { + return sprintf('%d HPC Scheduler template objects failed to import', $failed); + } + + return $this->present() ? null : 'The HPC Scheduler templates are missing after import'; + } + + /** + * The SHA-256 of the query file as the plugin last wrote it, or null. + */ + private function written(): ?string { + $hash = (string) read_config_option(self::FILES_SETTING); + + return preg_match('/^[0-9a-f]{64}$/', $hash) === 1 ? $hash : null; + } + + private function querySource(): string { + return $this->pluginPath . '/resource/script_server/' . self::QUERY_FILE; + } + + private function queryTarget(): ?string { + $dir = $this->cactiPath . '/resource/script_server'; + + return is_dir($dir) ? $dir . '/' . self::QUERY_FILE : null; + } +} diff --git a/templates/hpcsched-templates.xml b/templates/hpcsched-templates.xml new file mode 100644 index 0000000..9cf9e9c --- /dev/null +++ b/templates/hpcsched-templates.xml @@ -0,0 +1,6973 @@ + + + HPC Scheduler Cluster + + hash_0001033328ce25d6380e4be631678da82308cf|hash_0001037f800919b0dd22fb1b1b811f799a174e|hash_0001035b1a2db969d4beb047fea19a13cc57dc|hash_00010397724839bd10a4329cf05ca8c693b308|hash_000103b1aa9da119729ea35120f90c92e0b5f2|hash_00010359fe79c66e70d5f6601a7d2f492f02fa + hash_040103ca6761e89acb4fb8814f0562f73692d4 + + + HPC Scheduler Jobs + + + + + |host_description| - Jobs + + jobs + + 1 + + 150 + + 600 + + 1000 + + on + + on + + 2 + + + + + + + + 100 + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 + + + + + + + + 7 + hash_080103cfc77bca55755b549edd71437bdda970 + F39C12 + FF + 1 + 0 + 0 + + + 0 + + Pending (eligible) + + 0.00 + + + 1 + + + 11 + hash_080103cfc77bca55755b549edd71437bdda970 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 2 + + + 14 + hash_080103cfc77bca55755b549edd71437bdda970 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 3 + + + 12 + hash_080103cfc77bca55755b549edd71437bdda970 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 4 + + + 8 + hash_080103bce1c7294d9e362f15dd5de7699b3c85 + 8E44AD + FF + 1 + 0 + 0 + + + 0 + + Held + + 0.00 + + + 5 + + + 11 + hash_080103bce1c7294d9e362f15dd5de7699b3c85 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 6 + + + 14 + hash_080103bce1c7294d9e362f15dd5de7699b3c85 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 7 + + + 12 + hash_080103bce1c7294d9e362f15dd5de7699b3c85 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 8 + + + 8 + hash_08010315f5f45a4543631a69433ca11ed40bac + 27AE60 + FF + 1 + 0 + 0 + + + 0 + + Running + + 0.00 + + + 9 + + + 11 + hash_08010315f5f45a4543631a69433ca11ed40bac + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 10 + + + 14 + hash_08010315f5f45a4543631a69433ca11ed40bac + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 11 + + + 12 + hash_08010315f5f45a4543631a69433ca11ed40bac + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 12 + + + 8 + hash_0801035197aabe36baf2b6c67ff4048002bddf + 2E86C1 + FF + 1 + 0 + 0 + + + 0 + + Completing + + 0.00 + + + 13 + + + 11 + hash_0801035197aabe36baf2b6c67ff4048002bddf + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 14 + + + 14 + hash_0801035197aabe36baf2b6c67ff4048002bddf + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 15 + + + 12 + hash_0801035197aabe36baf2b6c67ff4048002bddf + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 16 + + + 8 + hash_080103f279d8dcb9edb658910e45c938595681 + 95A5A6 + FF + 1 + 0 + 0 + + + 0 + + Other + + 0.00 + + + 17 + + + 11 + hash_080103f279d8dcb9edb658910e45c938595681 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 18 + + + 14 + hash_080103f279d8dcb9edb658910e45c938595681 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 19 + + + 12 + hash_080103f279d8dcb9edb658910e45c938595681 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 20 + + + + + First Item Color + The color of the first item + color_id + hash_000103ae20001fb8eeecb066cb41075b8a5b1a + + + + + HPC Scheduler Pending Reasons + + + + + |host_description| - Pending Reasons + + jobs + + 1 + + 150 + + 600 + + 1000 + + on + + on + + 2 + + + + + + + + 100 + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 + + + + + + + + 7 + hash_080103355cb1c514d28ef9de4ec12bfd9b1a3e + 1F77B4 + FF + 1 + 0 + 0 + + + 0 + + Priority + + 0.00 + + + 1 + + + 11 + hash_080103355cb1c514d28ef9de4ec12bfd9b1a3e + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 2 + + + 14 + hash_080103355cb1c514d28ef9de4ec12bfd9b1a3e + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 3 + + + 12 + hash_080103355cb1c514d28ef9de4ec12bfd9b1a3e + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 4 + + + 8 + hash_080103483f3ac3038078d8cb48692f9467148f + FF7F0E + FF + 1 + 0 + 0 + + + 0 + + Resources + + 0.00 + + + 5 + + + 11 + hash_080103483f3ac3038078d8cb48692f9467148f + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 6 + + + 14 + hash_080103483f3ac3038078d8cb48692f9467148f + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 7 + + + 12 + hash_080103483f3ac3038078d8cb48692f9467148f + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 8 + + + 8 + hash_080103951f2cca924463b63e5f8d4dfc09e5ed + 2CA02C + FF + 1 + 0 + 0 + + + 0 + + Dependency + + 0.00 + + + 9 + + + 11 + hash_080103951f2cca924463b63e5f8d4dfc09e5ed + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 10 + + + 14 + hash_080103951f2cca924463b63e5f8d4dfc09e5ed + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 11 + + + 12 + hash_080103951f2cca924463b63e5f8d4dfc09e5ed + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 12 + + + 8 + hash_0801036ebcbf428e72783ecfa34a9d5bb2e7b2 + D62728 + FF + 1 + 0 + 0 + + + 0 + + Held + + 0.00 + + + 13 + + + 11 + hash_0801036ebcbf428e72783ecfa34a9d5bb2e7b2 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 14 + + + 14 + hash_0801036ebcbf428e72783ecfa34a9d5bb2e7b2 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 15 + + + 12 + hash_0801036ebcbf428e72783ecfa34a9d5bb2e7b2 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 16 + + + 8 + hash_08010382ee8a5d7efd3057a3d9cbb42e5f3b9b + 9467BD + FF + 1 + 0 + 0 + + + 0 + + Begin time + + 0.00 + + + 17 + + + 11 + hash_08010382ee8a5d7efd3057a3d9cbb42e5f3b9b + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 18 + + + 14 + hash_08010382ee8a5d7efd3057a3d9cbb42e5f3b9b + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 19 + + + 12 + hash_08010382ee8a5d7efd3057a3d9cbb42e5f3b9b + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 20 + + + 8 + hash_0801033e99c4f12050850e09937ffdcdc2bb28 + 8C564B + FF + 1 + 0 + 0 + + + 0 + + Reservation + + 0.00 + + + 21 + + + 11 + hash_0801033e99c4f12050850e09937ffdcdc2bb28 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 22 + + + 14 + hash_0801033e99c4f12050850e09937ffdcdc2bb28 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 23 + + + 12 + hash_0801033e99c4f12050850e09937ffdcdc2bb28 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 24 + + + 8 + hash_080103ce680bfdf9ffbb1be7e49fb670ba31e5 + E377C2 + FF + 1 + 0 + 0 + + + 0 + + Association limits + + 0.00 + + + 25 + + + 11 + hash_080103ce680bfdf9ffbb1be7e49fb670ba31e5 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 26 + + + 14 + hash_080103ce680bfdf9ffbb1be7e49fb670ba31e5 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 27 + + + 12 + hash_080103ce680bfdf9ffbb1be7e49fb670ba31e5 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 28 + + + 8 + hash_080103b3f8daef2456b3e6535019f26b0f026a + 7F7F7F + FF + 1 + 0 + 0 + + + 0 + + QOS limits + + 0.00 + + + 29 + + + 11 + hash_080103b3f8daef2456b3e6535019f26b0f026a + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 30 + + + 14 + hash_080103b3f8daef2456b3e6535019f26b0f026a + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 31 + + + 12 + hash_080103b3f8daef2456b3e6535019f26b0f026a + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 32 + + + 8 + hash_080103fbba38127a3120969c4e6a881b45b0b0 + BCBD22 + FF + 1 + 0 + 0 + + + 0 + + Partition limits + + 0.00 + + + 33 + + + 11 + hash_080103fbba38127a3120969c4e6a881b45b0b0 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 34 + + + 14 + hash_080103fbba38127a3120969c4e6a881b45b0b0 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 35 + + + 12 + hash_080103fbba38127a3120969c4e6a881b45b0b0 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 36 + + + 8 + hash_080103de61b11f9ca7181f29b63c1b03eb3303 + 17BECF + FF + 1 + 0 + 0 + + + 0 + + Node availability + + 0.00 + + + 37 + + + 11 + hash_080103de61b11f9ca7181f29b63c1b03eb3303 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 38 + + + 14 + hash_080103de61b11f9ca7181f29b63c1b03eb3303 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 39 + + + 12 + hash_080103de61b11f9ca7181f29b63c1b03eb3303 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 40 + + + 8 + hash_08010360393d3cdb28db42366c0b059040982a + 393B79 + FF + 1 + 0 + 0 + + + 0 + + Other + + 0.00 + + + 41 + + + 11 + hash_08010360393d3cdb28db42366c0b059040982a + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 42 + + + 14 + hash_08010360393d3cdb28db42366c0b059040982a + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 43 + + + 12 + hash_08010360393d3cdb28db42366c0b059040982a + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 44 + + + 1 + 0 + 0 + FF + 1 + 0 + 0 + + + 0 + + Each job under the last reason the scheduler gave it; eligible and held jobs both count + on + 0.00 + + + 45 + + + + + First Item Color + The color of the first item + color_id + hash_00010302b0d78b1ae4a336e28fa57dc4184e34 + + + + + HPC Scheduler Nodes + + + + + |host_description| - Nodes + + nodes + + 1 + + 150 + + 600 + + 1000 + + on + + on + + 2 + + + + + + + + 100 + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 + + + + + + + + 7 + hash_0801037eceee8cd467510ef4c6611579a299da + 52BE80 + FF + 1 + 0 + 0 + + + 0 + + Idle + + 0.00 + + + 1 + + + 11 + hash_0801037eceee8cd467510ef4c6611579a299da + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 2 + + + 14 + hash_0801037eceee8cd467510ef4c6611579a299da + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 3 + + + 12 + hash_0801037eceee8cd467510ef4c6611579a299da + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 4 + + + 8 + hash_080103b624eab4bb788c3b620c423ffdd1f8f7 + 2471A3 + FF + 1 + 0 + 0 + + + 0 + + Allocated + + 0.00 + + + 5 + + + 11 + hash_080103b624eab4bb788c3b620c423ffdd1f8f7 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 6 + + + 14 + hash_080103b624eab4bb788c3b620c423ffdd1f8f7 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 7 + + + 12 + hash_080103b624eab4bb788c3b620c423ffdd1f8f7 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 8 + + + 8 + hash_080103e0e46b44a6c4dbfdf900a1bab783ced5 + 5DADE2 + FF + 1 + 0 + 0 + + + 0 + + Mixed + + 0.00 + + + 9 + + + 11 + hash_080103e0e46b44a6c4dbfdf900a1bab783ced5 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 10 + + + 14 + hash_080103e0e46b44a6c4dbfdf900a1bab783ced5 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 11 + + + 12 + hash_080103e0e46b44a6c4dbfdf900a1bab783ced5 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 12 + + + 8 + hash_0801032d159d0fb4284a377099df16129180e9 + E67E22 + FF + 1 + 0 + 0 + + + 0 + + Drained or draining + + 0.00 + + + 13 + + + 11 + hash_0801032d159d0fb4284a377099df16129180e9 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 14 + + + 14 + hash_0801032d159d0fb4284a377099df16129180e9 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 15 + + + 12 + hash_0801032d159d0fb4284a377099df16129180e9 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 16 + + + 8 + hash_08010323f66c9a10786319a4c71996ba8237fe + C0392B + FF + 1 + 0 + 0 + + + 0 + + Down + + 0.00 + + + 17 + + + 11 + hash_08010323f66c9a10786319a4c71996ba8237fe + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 18 + + + 14 + hash_08010323f66c9a10786319a4c71996ba8237fe + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 19 + + + 12 + hash_08010323f66c9a10786319a4c71996ba8237fe + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 20 + + + 8 + hash_0801034bea19c937a4602185b290173b4f3b05 + 7D3C98 + FF + 1 + 0 + 0 + + + 0 + + Maintenance or reserved + + 0.00 + + + 21 + + + 11 + hash_0801034bea19c937a4602185b290173b4f3b05 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 22 + + + 14 + hash_0801034bea19c937a4602185b290173b4f3b05 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 23 + + + 12 + hash_0801034bea19c937a4602185b290173b4f3b05 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 24 + + + 8 + hash_080103a9602435586ec9d7d3b52c38716f2e40 + 566573 + FF + 1 + 0 + 0 + + + 0 + + Powered down + + 0.00 + + + 25 + + + 11 + hash_080103a9602435586ec9d7d3b52c38716f2e40 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 26 + + + 14 + hash_080103a9602435586ec9d7d3b52c38716f2e40 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 27 + + + 12 + hash_080103a9602435586ec9d7d3b52c38716f2e40 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 28 + + + 8 + hash_0801031d4dab3e7d387a3f19dbe232672b7a00 + BDC3C7 + FF + 1 + 0 + 0 + + + 0 + + Other + + 0.00 + + + 29 + + + 11 + hash_0801031d4dab3e7d387a3f19dbe232672b7a00 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 30 + + + 14 + hash_0801031d4dab3e7d387a3f19dbe232672b7a00 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 31 + + + 12 + hash_0801031d4dab3e7d387a3f19dbe232672b7a00 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 32 + + + + + First Item Color + The color of the first item + color_id + hash_000103f3a68588f67f67848131026d64b2e66d + + + + + HPC Scheduler CPUs + + + + + |host_description| - CPUs + + CPUs + + 1 + + 150 + + 600 + + 1000 + + on + + on + + 2 + + + + + + + + 100 + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 + + + + + + + + 7 + hash_08010379cb2c28f192da1c43903bdfeb5e3d89 + 2471A3 + FF + 1 + 0 + 0 + + + 0 + + Allocated + + 0.00 + + + 1 + + + 11 + hash_08010379cb2c28f192da1c43903bdfeb5e3d89 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 2 + + + 14 + hash_08010379cb2c28f192da1c43903bdfeb5e3d89 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 3 + + + 12 + hash_08010379cb2c28f192da1c43903bdfeb5e3d89 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 4 + + + 8 + hash_080103008a201229fa5d30932f32aa3d746a22 + A9DFBF + FF + 1 + 0 + 0 + + + 0 + + Idle + + 0.00 + + + 5 + + + 11 + hash_080103008a201229fa5d30932f32aa3d746a22 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 6 + + + 14 + hash_080103008a201229fa5d30932f32aa3d746a22 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 7 + + + 12 + hash_080103008a201229fa5d30932f32aa3d746a22 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 8 + + + 8 + hash_080103bee6dba7a88c047fda0ff84e185d3ca6 + E6B0AA + FF + 1 + 0 + 0 + + + 0 + + Unavailable + + 0.00 + + + 9 + + + 11 + hash_080103bee6dba7a88c047fda0ff84e185d3ca6 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 10 + + + 14 + hash_080103bee6dba7a88c047fda0ff84e185d3ca6 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 11 + + + 12 + hash_080103bee6dba7a88c047fda0ff84e185d3ca6 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 12 + + + 4 + hash_08010328e5ce0e6ecd472037dadb8f8493620f + 17202A + FF + 1 + 0 + 0 + + + 0 + + Total + + 0.00 + + + 13 + + + 11 + hash_08010328e5ce0e6ecd472037dadb8f8493620f + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + on + 0.00 + + + 14 + + + 1 + 0 + 0 + FF + 1 + 0 + 0 + + + 0 + + Unavailable is the unallocated CPUs of nodes that are down, drained, draining, in maintenance, or powered down + on + 0.00 + + + 15 + + + + + First Item Color + The color of the first item + color_id + hash_00010329caae922996b4ea2f0e6a245f6984a3 + + + + + HPC Scheduler Utilization + + + + + |host_description| - Utilization + + percent + + 1 + + 150 + + 600 + + 1000 + + on + + + + 2 + + + + + + on + + 100 + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 + + + + + + + + 5 + hash_080103a13efa9676fb776d5dd0bd77a301309f + 2471A3 + FF + 1 + 0 + 0 + + + 0 + + CPUs allocated + + 0.00 + + + 1 + + + 11 + hash_080103a13efa9676fb776d5dd0bd77a301309f + 0 + FF + 1 + 0 + 0 + + + hash_06010323ae2637e1f5ca813176a055f1823ad4 + + Current: + + 0.00 + + + 2 + + + 14 + hash_080103a13efa9676fb776d5dd0bd77a301309f + 0 + FF + 1 + 0 + 0 + + + hash_06010323ae2637e1f5ca813176a055f1823ad4 + + Average: + + 0.00 + + + 3 + + + 12 + hash_080103a13efa9676fb776d5dd0bd77a301309f + 0 + FF + 1 + 0 + 0 + + + hash_06010323ae2637e1f5ca813176a055f1823ad4 + + Maximum: + on + 0.00 + + + 4 + + + 5 + hash_0801034a42022bbc0da97516a6dd9684ef8256 + 27AE60 + FF + 1 + 0 + 0 + + + 0 + + Nodes with allocated CPUs + + 0.00 + + + 5 + + + 11 + hash_0801034a42022bbc0da97516a6dd9684ef8256 + 0 + FF + 1 + 0 + 0 + + + hash_06010323ae2637e1f5ca813176a055f1823ad4 + + Current: + + 0.00 + + + 6 + + + 14 + hash_0801034a42022bbc0da97516a6dd9684ef8256 + 0 + FF + 1 + 0 + 0 + + + hash_06010323ae2637e1f5ca813176a055f1823ad4 + + Average: + + 0.00 + + + 7 + + + 12 + hash_0801034a42022bbc0da97516a6dd9684ef8256 + 0 + FF + 1 + 0 + 0 + + + hash_06010323ae2637e1f5ca813176a055f1823ad4 + + Maximum: + on + 0.00 + + + 8 + + + 11 + hash_0801033c032495b640446f7dd9a38e88640ae5 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Nodes with allocated CPUs now + on + 0.00 + + + 9 + + + 11 + hash_0801038ba2258902a424175e7bb5791786208e + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + of + on + 0.00 + + + 10 + + + 1 + 0 + 0 + FF + 1 + 0 + 0 + + + 0 + + Allocated over all CPUs and nodes, down, drained, and maintenance ones included, as sinfo counts them + on + 0.00 + + + 11 + + + + + First Item Color + The color of the first item + color_id + hash_000103b0b477c35317c4c8c6d599264da15686 + + + + + HPC Scheduler Snapshot Age + + + + + |host_description| - Snapshot Age + + seconds + + 1 + + 150 + + 600 + + 1000 + + on + + on + + 2 + + + + + + + + 100 + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 + + + + + + + + 7 + hash_080103bdf0b071ec77aa9c68ae48a5487df81d + 5D6D7E + FF + 1 + 0 + 0 + + + 0 + + Age of the oldest section + + 0.00 + + + 1 + + + 11 + hash_080103bdf0b071ec77aa9c68ae48a5487df81d + 0 + FF + 1 + 0 + 0 + + + hash_0601032f5610fab54b2061c62f315eb7f67c11 + + Current: + + 0.00 + + + 2 + + + 14 + hash_080103bdf0b071ec77aa9c68ae48a5487df81d + 0 + FF + 1 + 0 + 0 + + + hash_0601032f5610fab54b2061c62f315eb7f67c11 + + Average: + + 0.00 + + + 3 + + + 12 + hash_080103bdf0b071ec77aa9c68ae48a5487df81d + 0 + FF + 1 + 0 + 0 + + + hash_0601032f5610fab54b2061c62f315eb7f67c11 + + Maximum: + on + 0.00 + + + 4 + + + 1 + 0 + 0 + FF + 1 + 0 + 0 + + + 0 + + Grows while the reader is stopped; alert on it with a duration of at least one collection interval + on + 0.00 + + + 5 + + + + + First Item Color + The color of the first item + color_id + hash_0001037d9f596fb0def503e249a1164421ff4f + + + + + HPC Scheduler Partition Jobs + + + + + |host_description| - |query_hpcPartition| - Jobs + + jobs + + 1 + + 150 + + 600 + + 1000 + + on + + on + + 2 + + + + + + + + 100 + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 + + + + + + + + 7 + hash_0801034ff959437f54362eea08f291354cecf5 + F39C12 + FF + 1 + 0 + 0 + + + 0 + + Pending (eligible) + + 0.00 + + + 1 + + + 11 + hash_0801034ff959437f54362eea08f291354cecf5 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 2 + + + 14 + hash_0801034ff959437f54362eea08f291354cecf5 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 3 + + + 12 + hash_0801034ff959437f54362eea08f291354cecf5 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 4 + + + 8 + hash_0801036910693ddea2f118d9ef98e616856dc1 + 8E44AD + FF + 1 + 0 + 0 + + + 0 + + Held + + 0.00 + + + 5 + + + 11 + hash_0801036910693ddea2f118d9ef98e616856dc1 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 6 + + + 14 + hash_0801036910693ddea2f118d9ef98e616856dc1 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 7 + + + 12 + hash_0801036910693ddea2f118d9ef98e616856dc1 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 8 + + + 8 + hash_080103e8c91c649e1559b7b53d46d9cda8de8c + 27AE60 + FF + 1 + 0 + 0 + + + 0 + + Running + + 0.00 + + + 9 + + + 11 + hash_080103e8c91c649e1559b7b53d46d9cda8de8c + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 10 + + + 14 + hash_080103e8c91c649e1559b7b53d46d9cda8de8c + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 11 + + + 12 + hash_080103e8c91c649e1559b7b53d46d9cda8de8c + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 12 + + + 8 + hash_080103420fd08d22950c802324c7062681483c + 2E86C1 + FF + 1 + 0 + 0 + + + 0 + + Completing + + 0.00 + + + 13 + + + 11 + hash_080103420fd08d22950c802324c7062681483c + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 14 + + + 14 + hash_080103420fd08d22950c802324c7062681483c + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 15 + + + 12 + hash_080103420fd08d22950c802324c7062681483c + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 16 + + + 8 + hash_0801036c941d3746def1539410b64f52c65fee + 95A5A6 + FF + 1 + 0 + 0 + + + 0 + + Other + + 0.00 + + + 17 + + + 11 + hash_0801036c941d3746def1539410b64f52c65fee + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 18 + + + 14 + hash_0801036c941d3746def1539410b64f52c65fee + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 19 + + + 12 + hash_0801036c941d3746def1539410b64f52c65fee + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 20 + + + + + First Item Color + The color of the first item + color_id + hash_00010363b65452b4cb06f8f239ef672ae64bc9 + + + + + HPC Scheduler Partition Pending Reasons + + + + + |host_description| - |query_hpcPartition| - Pending Reasons + + jobs + + 1 + + 150 + + 600 + + 1000 + + on + + on + + 2 + + + + + + + + 100 + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 + + + + + + + + 7 + hash_08010330f147e48698ef75a96754b69baa1714 + 1F77B4 + FF + 1 + 0 + 0 + + + 0 + + Priority + + 0.00 + + + 1 + + + 11 + hash_08010330f147e48698ef75a96754b69baa1714 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 2 + + + 14 + hash_08010330f147e48698ef75a96754b69baa1714 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 3 + + + 12 + hash_08010330f147e48698ef75a96754b69baa1714 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 4 + + + 8 + hash_0801033898e9baa2c1677dc4f7581f83f69b51 + FF7F0E + FF + 1 + 0 + 0 + + + 0 + + Resources + + 0.00 + + + 5 + + + 11 + hash_0801033898e9baa2c1677dc4f7581f83f69b51 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 6 + + + 14 + hash_0801033898e9baa2c1677dc4f7581f83f69b51 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 7 + + + 12 + hash_0801033898e9baa2c1677dc4f7581f83f69b51 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 8 + + + 8 + hash_0801037de9f095bbe02b21d3872631ebc80336 + 2CA02C + FF + 1 + 0 + 0 + + + 0 + + Dependency + + 0.00 + + + 9 + + + 11 + hash_0801037de9f095bbe02b21d3872631ebc80336 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 10 + + + 14 + hash_0801037de9f095bbe02b21d3872631ebc80336 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 11 + + + 12 + hash_0801037de9f095bbe02b21d3872631ebc80336 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 12 + + + 8 + hash_0801035c4e50ebe6a1f6c29bba50ba3515a4e9 + D62728 + FF + 1 + 0 + 0 + + + 0 + + Held + + 0.00 + + + 13 + + + 11 + hash_0801035c4e50ebe6a1f6c29bba50ba3515a4e9 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 14 + + + 14 + hash_0801035c4e50ebe6a1f6c29bba50ba3515a4e9 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 15 + + + 12 + hash_0801035c4e50ebe6a1f6c29bba50ba3515a4e9 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 16 + + + 8 + hash_080103a06e11a45f19e59586c8b7b3f29d5d67 + 9467BD + FF + 1 + 0 + 0 + + + 0 + + Begin time + + 0.00 + + + 17 + + + 11 + hash_080103a06e11a45f19e59586c8b7b3f29d5d67 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 18 + + + 14 + hash_080103a06e11a45f19e59586c8b7b3f29d5d67 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 19 + + + 12 + hash_080103a06e11a45f19e59586c8b7b3f29d5d67 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 20 + + + 8 + hash_0801034dff552c2fcec4454940e3e37bd93321 + 8C564B + FF + 1 + 0 + 0 + + + 0 + + Reservation + + 0.00 + + + 21 + + + 11 + hash_0801034dff552c2fcec4454940e3e37bd93321 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 22 + + + 14 + hash_0801034dff552c2fcec4454940e3e37bd93321 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 23 + + + 12 + hash_0801034dff552c2fcec4454940e3e37bd93321 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 24 + + + 8 + hash_080103aed79703af06848b734e408422ac9fca + E377C2 + FF + 1 + 0 + 0 + + + 0 + + Association limits + + 0.00 + + + 25 + + + 11 + hash_080103aed79703af06848b734e408422ac9fca + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 26 + + + 14 + hash_080103aed79703af06848b734e408422ac9fca + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 27 + + + 12 + hash_080103aed79703af06848b734e408422ac9fca + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 28 + + + 8 + hash_080103f421d3b5bda04856abf9c5bfc86c0489 + 7F7F7F + FF + 1 + 0 + 0 + + + 0 + + QOS limits + + 0.00 + + + 29 + + + 11 + hash_080103f421d3b5bda04856abf9c5bfc86c0489 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 30 + + + 14 + hash_080103f421d3b5bda04856abf9c5bfc86c0489 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 31 + + + 12 + hash_080103f421d3b5bda04856abf9c5bfc86c0489 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 32 + + + 8 + hash_0801035c4dd87e39dcac83a3585a03afd2278e + BCBD22 + FF + 1 + 0 + 0 + + + 0 + + Partition limits + + 0.00 + + + 33 + + + 11 + hash_0801035c4dd87e39dcac83a3585a03afd2278e + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 34 + + + 14 + hash_0801035c4dd87e39dcac83a3585a03afd2278e + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 35 + + + 12 + hash_0801035c4dd87e39dcac83a3585a03afd2278e + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 36 + + + 8 + hash_0801037eae4d4dcbcb73bae84d1e76fe3aa1f8 + 17BECF + FF + 1 + 0 + 0 + + + 0 + + Node availability + + 0.00 + + + 37 + + + 11 + hash_0801037eae4d4dcbcb73bae84d1e76fe3aa1f8 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 38 + + + 14 + hash_0801037eae4d4dcbcb73bae84d1e76fe3aa1f8 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 39 + + + 12 + hash_0801037eae4d4dcbcb73bae84d1e76fe3aa1f8 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 40 + + + 8 + hash_0801037fa54617106b4ea3de8e11d2fff4fece + 393B79 + FF + 1 + 0 + 0 + + + 0 + + Other + + 0.00 + + + 41 + + + 11 + hash_0801037fa54617106b4ea3de8e11d2fff4fece + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 42 + + + 14 + hash_0801037fa54617106b4ea3de8e11d2fff4fece + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 43 + + + 12 + hash_0801037fa54617106b4ea3de8e11d2fff4fece + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 44 + + + 1 + 0 + 0 + FF + 1 + 0 + 0 + + + 0 + + Each job under the last reason the scheduler gave it; eligible and held jobs both count + on + 0.00 + + + 45 + + + + + First Item Color + The color of the first item + color_id + hash_0001038f84fc1e692dc225f9ecb59562dc4d01 + + + + + HPC Scheduler Partition Nodes + + + + + |host_description| - |query_hpcPartition| - Nodes + + nodes + + 1 + + 150 + + 600 + + 1000 + + on + + on + + 2 + + + + + + + + 100 + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 + + + + + + + + 7 + hash_0801034ee85681f3a342270a28cfe40a031733 + 52BE80 + FF + 1 + 0 + 0 + + + 0 + + Idle + + 0.00 + + + 1 + + + 11 + hash_0801034ee85681f3a342270a28cfe40a031733 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 2 + + + 14 + hash_0801034ee85681f3a342270a28cfe40a031733 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 3 + + + 12 + hash_0801034ee85681f3a342270a28cfe40a031733 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 4 + + + 8 + hash_0801037fbc9dece25fe4b26a9f04cb0cd044a1 + 2471A3 + FF + 1 + 0 + 0 + + + 0 + + Allocated + + 0.00 + + + 5 + + + 11 + hash_0801037fbc9dece25fe4b26a9f04cb0cd044a1 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 6 + + + 14 + hash_0801037fbc9dece25fe4b26a9f04cb0cd044a1 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 7 + + + 12 + hash_0801037fbc9dece25fe4b26a9f04cb0cd044a1 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 8 + + + 8 + hash_0801034b45508fd09493ccc08e922fbae0c27b + 5DADE2 + FF + 1 + 0 + 0 + + + 0 + + Mixed + + 0.00 + + + 9 + + + 11 + hash_0801034b45508fd09493ccc08e922fbae0c27b + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 10 + + + 14 + hash_0801034b45508fd09493ccc08e922fbae0c27b + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 11 + + + 12 + hash_0801034b45508fd09493ccc08e922fbae0c27b + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 12 + + + 8 + hash_0801033b2d04342adceb65807c5519f2280e3d + E67E22 + FF + 1 + 0 + 0 + + + 0 + + Drained or draining + + 0.00 + + + 13 + + + 11 + hash_0801033b2d04342adceb65807c5519f2280e3d + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 14 + + + 14 + hash_0801033b2d04342adceb65807c5519f2280e3d + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 15 + + + 12 + hash_0801033b2d04342adceb65807c5519f2280e3d + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 16 + + + 8 + hash_08010322cd1ac43ffb6061cefe8316e8ef0172 + C0392B + FF + 1 + 0 + 0 + + + 0 + + Down + + 0.00 + + + 17 + + + 11 + hash_08010322cd1ac43ffb6061cefe8316e8ef0172 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 18 + + + 14 + hash_08010322cd1ac43ffb6061cefe8316e8ef0172 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 19 + + + 12 + hash_08010322cd1ac43ffb6061cefe8316e8ef0172 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 20 + + + 8 + hash_08010308194a6e880efd8592b7883a9a2ba46a + 7D3C98 + FF + 1 + 0 + 0 + + + 0 + + Maintenance or reserved + + 0.00 + + + 21 + + + 11 + hash_08010308194a6e880efd8592b7883a9a2ba46a + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 22 + + + 14 + hash_08010308194a6e880efd8592b7883a9a2ba46a + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 23 + + + 12 + hash_08010308194a6e880efd8592b7883a9a2ba46a + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 24 + + + 8 + hash_080103fe459c327d326b8e04ebee4dea8f820c + 566573 + FF + 1 + 0 + 0 + + + 0 + + Powered down + + 0.00 + + + 25 + + + 11 + hash_080103fe459c327d326b8e04ebee4dea8f820c + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 26 + + + 14 + hash_080103fe459c327d326b8e04ebee4dea8f820c + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 27 + + + 12 + hash_080103fe459c327d326b8e04ebee4dea8f820c + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 28 + + + 8 + hash_080103532745dbf13b13b7eea78cf659ff2523 + BDC3C7 + FF + 1 + 0 + 0 + + + 0 + + Other + + 0.00 + + + 29 + + + 11 + hash_080103532745dbf13b13b7eea78cf659ff2523 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 30 + + + 14 + hash_080103532745dbf13b13b7eea78cf659ff2523 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 31 + + + 12 + hash_080103532745dbf13b13b7eea78cf659ff2523 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 32 + + + + + First Item Color + The color of the first item + color_id + hash_000103320b366830128482aa072b3391e2c602 + + + + + HPC Scheduler Partition CPUs + + + + + |host_description| - |query_hpcPartition| - CPUs + + CPUs + + 1 + + 150 + + 600 + + 1000 + + on + + on + + 2 + + + + + + + + 100 + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 + + + + + + + + 7 + hash_080103466364a045f96d0750d0146b2f0196b6 + 2471A3 + FF + 1 + 0 + 0 + + + 0 + + Allocated + + 0.00 + + + 1 + + + 11 + hash_080103466364a045f96d0750d0146b2f0196b6 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 2 + + + 14 + hash_080103466364a045f96d0750d0146b2f0196b6 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 3 + + + 12 + hash_080103466364a045f96d0750d0146b2f0196b6 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 4 + + + 8 + hash_08010366dfeb3a32ef68ae0f772daaf5612444 + A9DFBF + FF + 1 + 0 + 0 + + + 0 + + Idle + + 0.00 + + + 5 + + + 11 + hash_08010366dfeb3a32ef68ae0f772daaf5612444 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 6 + + + 14 + hash_08010366dfeb3a32ef68ae0f772daaf5612444 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 7 + + + 12 + hash_08010366dfeb3a32ef68ae0f772daaf5612444 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 8 + + + 8 + hash_0801036996ef8e015507ff92446a3b02049b71 + E6B0AA + FF + 1 + 0 + 0 + + + 0 + + Unavailable + + 0.00 + + + 9 + + + 11 + hash_0801036996ef8e015507ff92446a3b02049b71 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + + 0.00 + + + 10 + + + 14 + hash_0801036996ef8e015507ff92446a3b02049b71 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Average: + + 0.00 + + + 11 + + + 12 + hash_0801036996ef8e015507ff92446a3b02049b71 + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Maximum: + on + 0.00 + + + 12 + + + 4 + hash_0801036fb6d39698b37d74c27d293707adea3c + 17202A + FF + 1 + 0 + 0 + + + 0 + + Total + + 0.00 + + + 13 + + + 11 + hash_0801036fb6d39698b37d74c27d293707adea3c + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Current: + on + 0.00 + + + 14 + + + 1 + 0 + 0 + FF + 1 + 0 + 0 + + + 0 + + Unavailable is the unallocated CPUs of nodes that are down, drained, draining, in maintenance, or powered down + on + 0.00 + + + 15 + + + + + First Item Color + The color of the first item + color_id + hash_000103d275bbaabe0c7cedb885c759d44d73b9 + + + + + HPC Scheduler Partition Utilization + + + + + |host_description| - |query_hpcPartition| - Utilization + + percent + + 1 + + 150 + + 600 + + 1000 + + on + + + + 2 + + + + + + on + + 100 + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 + + + + + + + + 5 + hash_0801032a4689d55826d5a9bcbcc92c83d9b02e + 2471A3 + FF + 1 + 0 + 0 + + + 0 + + CPUs allocated + + 0.00 + + + 1 + + + 11 + hash_0801032a4689d55826d5a9bcbcc92c83d9b02e + 0 + FF + 1 + 0 + 0 + + + hash_06010323ae2637e1f5ca813176a055f1823ad4 + + Current: + + 0.00 + + + 2 + + + 14 + hash_0801032a4689d55826d5a9bcbcc92c83d9b02e + 0 + FF + 1 + 0 + 0 + + + hash_06010323ae2637e1f5ca813176a055f1823ad4 + + Average: + + 0.00 + + + 3 + + + 12 + hash_0801032a4689d55826d5a9bcbcc92c83d9b02e + 0 + FF + 1 + 0 + 0 + + + hash_06010323ae2637e1f5ca813176a055f1823ad4 + + Maximum: + on + 0.00 + + + 4 + + + 5 + hash_0801034c6f8a7ada8ed434a20faf1ca5409e1e + 27AE60 + FF + 1 + 0 + 0 + + + 0 + + Nodes with allocated CPUs + + 0.00 + + + 5 + + + 11 + hash_0801034c6f8a7ada8ed434a20faf1ca5409e1e + 0 + FF + 1 + 0 + 0 + + + hash_06010323ae2637e1f5ca813176a055f1823ad4 + + Current: + + 0.00 + + + 6 + + + 14 + hash_0801034c6f8a7ada8ed434a20faf1ca5409e1e + 0 + FF + 1 + 0 + 0 + + + hash_06010323ae2637e1f5ca813176a055f1823ad4 + + Average: + + 0.00 + + + 7 + + + 12 + hash_0801034c6f8a7ada8ed434a20faf1ca5409e1e + 0 + FF + 1 + 0 + 0 + + + hash_06010323ae2637e1f5ca813176a055f1823ad4 + + Maximum: + on + 0.00 + + + 8 + + + 11 + hash_080103b2340aff73ce9708e5ae00b355bf67df + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + Nodes with allocated CPUs now + on + 0.00 + + + 9 + + + 11 + hash_080103ee5df66878883a2f759c97a903ba88aa + 0 + FF + 1 + 0 + 0 + + + hash_060103242cc01ea20a658a4f9f885c670bb815 + + of + on + 0.00 + + + 10 + + + 1 + 0 + 0 + FF + 1 + 0 + 0 + + + 0 + + Allocated over all CPUs and nodes, down, drained, and maintenance ones included, as sinfo counts them + on + 0.00 + + + 11 + + + + + First Item Color + The color of the first item + color_id + hash_000103f9cc66be24d73f8dcfd8bc36fdf9e99b + + + + + HPC Scheduler Cluster Values + + |host_description| - HPC Scheduler Cluster + + hash_03010319f724e81aa364782b3c47cd3ba20b1f + + hash_200103d62c52891f4f9688729a5bc9fad91b18 + + 300 + + on + + + + pending + 0 + U + 1 + 600 + hash_070103c292bffe20e990dd09b85dd45e6f4081 + + + held + 0 + U + 1 + 600 + hash_0701032ccbd2a79ddd0cc182c87b51f63cda49 + + + running + 0 + U + 1 + 600 + hash_070103d8cd1421a42434427a9d7cdc3a1677c8 + + + completing + 0 + U + 1 + 600 + hash_0701035e1069853c55805b7dda9708ef1d2bf4 + + + jobs_other + 0 + U + 1 + 600 + hash_070103811698af772ad050ac9617f73dbeab89 + + + r_priority + 0 + U + 1 + 600 + hash_0701035247edb5d132b891f2eb52c41b34c425 + + + r_resources + 0 + U + 1 + 600 + hash_070103e9bdc61dc8f81626082e3d0b2216f2e0 + + + r_dependency + 0 + U + 1 + 600 + hash_07010301ee7f18b01321869062de35adf2fde0 + + + r_held + 0 + U + 1 + 600 + hash_07010318040972e8ec0b43f8b32c67d216c161 + + + r_begin_time + 0 + U + 1 + 600 + hash_070103a61d3f72e2be398f8b74b789604861aa + + + r_reservation + 0 + U + 1 + 600 + hash_070103eb05833d5b10579192c6f419db7ff487 + + + r_assoc + 0 + U + 1 + 600 + hash_070103d6a0a584731ddedbb6f3bb8d92c75f69 + + + r_qos + 0 + U + 1 + 600 + hash_070103afdf3369708d283250ff6d8d6e13342f + + + r_partition + 0 + U + 1 + 600 + hash_07010384f5515b5d28ba8962cf0c895c81388b + + + r_node + 0 + U + 1 + 600 + hash_070103dc29bccf26bbceb0c3c96e69c94f20bb + + + r_other + 0 + U + 1 + 600 + hash_070103b5deca122c481a6364290f5bc1903643 + + + n_idle + 0 + U + 1 + 600 + hash_0701030a618fa4b4d3928621f1d807def8e04a + + + n_allocated + 0 + U + 1 + 600 + hash_0701033669e20b77d1cc9a464157bb07696648 + + + n_mixed + 0 + U + 1 + 600 + hash_07010367705216cce4a4995a897a698fca4827 + + + n_drained + 0 + U + 1 + 600 + hash_0701036e6321fa7cadd1e521212cee43cd5dfc + + + n_down + 0 + U + 1 + 600 + hash_0701034c58617977cca121f1e2dfb999d19f0b + + + n_maint + 0 + U + 1 + 600 + hash_070103fe9492aba4e9e4fcbd4da8c7c9bd4cc1 + + + n_powered_down + 0 + U + 1 + 600 + hash_07010380a82c81df6745615c0b80f2e6aab428 + + + n_other + 0 + U + 1 + 600 + hash_07010368bfa55a54b939b59d979729bf04441c + + + cpus_alloc + 0 + U + 1 + 600 + hash_070103c0ab583f5e833d6cf94adc334f4da318 + + + cpus_idle + 0 + U + 1 + 600 + hash_07010301c8f081141c7ec37f7b18580387aca4 + + + cpus_other + 0 + U + 1 + 600 + hash_07010394621ba688910ce40e7c33b6959b4401 + + + cpus_total + 0 + U + 1 + 600 + hash_070103557a5d0d0083da3fd19e3ecc6ea59dbb + + + cpu_util_pct + 0 + 100 + 1 + 600 + hash_070103ab14d6455c5a3e4b71f8f1e92b45ab20 + + + node_util_pct + 0 + 100 + 1 + 600 + hash_0701037fce4e612b0ba3361ae218c247079706 + + + nodes_alloc + 0 + U + 1 + 600 + hash_070103624e76e195818126500443fdcfb52838 + + + nodes_total + 0 + U + 1 + 600 + hash_0701033687d639126acfa295080becfb4966c0 + + + age + 0 + U + 1 + 600 + hash_070103cffee6cfc087ad598417a1b93a0adba3 + + + + + hash_070103d481c0961187d36093593446db5f0d6d + + + + + + + HPC Scheduler Partition Jobs + + |host_description| - |query_hpcPartition| - Jobs + + hash_030103332111d8b54ac8ce939af87a7eac0c06 + + hash_200103d62c52891f4f9688729a5bc9fad91b18 + + 300 + + on + + + + pending + 0 + U + 1 + 600 + 0 + + + held + 0 + U + 1 + 600 + 0 + + + running + 0 + U + 1 + 600 + 0 + + + completing + 0 + U + 1 + 600 + 0 + + + jobs_other + 0 + U + 1 + 600 + 0 + + + + + hash_070103172b4b0eacee4948c6479f587b62e512 + on + + + + hash_07010330fb5d5bcf3d66bb5abe88596f357c26 + on + + + + hash_07010331112c85ae4ff821d3b288336288818c + on + + + + + + HPC Scheduler Partition Pending Reasons + + |host_description| - |query_hpcPartition| - Pending Reasons + + hash_030103332111d8b54ac8ce939af87a7eac0c06 + + hash_200103d62c52891f4f9688729a5bc9fad91b18 + + 300 + + on + + + + r_priority + 0 + U + 1 + 600 + 0 + + + r_resources + 0 + U + 1 + 600 + 0 + + + r_dependency + 0 + U + 1 + 600 + 0 + + + r_held + 0 + U + 1 + 600 + 0 + + + r_begin_time + 0 + U + 1 + 600 + 0 + + + r_reservation + 0 + U + 1 + 600 + 0 + + + r_assoc + 0 + U + 1 + 600 + 0 + + + r_qos + 0 + U + 1 + 600 + 0 + + + r_partition + 0 + U + 1 + 600 + 0 + + + r_node + 0 + U + 1 + 600 + 0 + + + r_other + 0 + U + 1 + 600 + 0 + + + + + hash_070103172b4b0eacee4948c6479f587b62e512 + on + + + + hash_07010330fb5d5bcf3d66bb5abe88596f357c26 + on + + + + hash_07010331112c85ae4ff821d3b288336288818c + on + + + + + + HPC Scheduler Partition Nodes + + |host_description| - |query_hpcPartition| - Nodes + + hash_030103332111d8b54ac8ce939af87a7eac0c06 + + hash_200103d62c52891f4f9688729a5bc9fad91b18 + + 300 + + on + + + + n_idle + 0 + U + 1 + 600 + 0 + + + n_allocated + 0 + U + 1 + 600 + 0 + + + n_mixed + 0 + U + 1 + 600 + 0 + + + n_drained + 0 + U + 1 + 600 + 0 + + + n_down + 0 + U + 1 + 600 + 0 + + + n_maint + 0 + U + 1 + 600 + 0 + + + n_powered_down + 0 + U + 1 + 600 + 0 + + + n_other + 0 + U + 1 + 600 + 0 + + + + + hash_070103172b4b0eacee4948c6479f587b62e512 + on + + + + hash_07010330fb5d5bcf3d66bb5abe88596f357c26 + on + + + + hash_07010331112c85ae4ff821d3b288336288818c + on + + + + + + HPC Scheduler Partition CPUs + + |host_description| - |query_hpcPartition| - CPUs + + hash_030103332111d8b54ac8ce939af87a7eac0c06 + + hash_200103d62c52891f4f9688729a5bc9fad91b18 + + 300 + + on + + + + cpus_alloc + 0 + U + 1 + 600 + 0 + + + cpus_idle + 0 + U + 1 + 600 + 0 + + + cpus_other + 0 + U + 1 + 600 + 0 + + + cpus_total + 0 + U + 1 + 600 + 0 + + + + + hash_070103172b4b0eacee4948c6479f587b62e512 + on + + + + hash_07010330fb5d5bcf3d66bb5abe88596f357c26 + on + + + + hash_07010331112c85ae4ff821d3b288336288818c + on + + + + + + HPC Scheduler Partition Utilization + + |host_description| - |query_hpcPartition| - Utilization + + hash_030103332111d8b54ac8ce939af87a7eac0c06 + + hash_200103d62c52891f4f9688729a5bc9fad91b18 + + 300 + + on + + + + cpu_util_pct + 0 + 100 + 1 + 600 + 0 + + + node_util_pct + 0 + 100 + 1 + 600 + 0 + + + nodes_alloc + 0 + U + 1 + 600 + 0 + + + nodes_total + 0 + U + 1 + 600 + 0 + + + + + hash_070103172b4b0eacee4948c6479f587b62e512 + on + + + + hash_07010330fb5d5bcf3d66bb5abe88596f357c26 + on + + + + hash_07010331112c85ae4ff821d3b288336288818c + on + + + + + + HPC Scheduler Cluster Values + 5 + PHBhdGhfY2FjdGk+L3BsdWdpbnMvaHBjc2NoZWQvc2NyaXB0cy9zc19ocGNzY2hlZF9jbHVzdGVyLnBocCBzc19ocGNzY2hlZF9jbHVzdGVyIDxob3N0X2lkPg== + + + Device ID + + + + host_id + in + host_id + + + Pending (eligible) + on + + + + out + pending + + + Held + on + + + + out + held + + + Running + on + + + + out + running + + + Completing + on + + + + out + completing + + + Other + on + + + + out + jobs_other + + + Priority + on + + + + out + r_priority + + + Resources + on + + + + out + r_resources + + + Dependency + on + + + + out + r_dependency + + + Held + on + + + + out + r_held + + + Begin time + on + + + + out + r_begin_time + + + Reservation + on + + + + out + r_reservation + + + Association limits + on + + + + out + r_assoc + + + QOS limits + on + + + + out + r_qos + + + Partition limits + on + + + + out + r_partition + + + Node availability + on + + + + out + r_node + + + Other + on + + + + out + r_other + + + Idle + on + + + + out + n_idle + + + Allocated + on + + + + out + n_allocated + + + Mixed + on + + + + out + n_mixed + + + Drained or draining + on + + + + out + n_drained + + + Down + on + + + + out + n_down + + + Maintenance or reserved + on + + + + out + n_maint + + + Powered down + on + + + + out + n_powered_down + + + Other + on + + + + out + n_other + + + Allocated + on + + + + out + cpus_alloc + + + Idle + on + + + + out + cpus_idle + + + Unavailable + on + + + + out + cpus_other + + + Total + on + + + + out + cpus_total + + + CPUs allocated + on + + + + out + cpu_util_pct + + + Nodes with allocated CPUs + on + + + + out + node_util_pct + + + Nodes with allocated CPUs + on + + + + out + nodes_alloc + + + Nodes + on + + + + out + nodes_total + + + Snapshot age (seconds) + on + + + + out + age + + + + + Get Script Server Data (Indexed) + 6 + + + + Index Type + + + + index_type + in + index_type + + + Index Value + + + + index_value + in + index_value + + + Output Type ID + + + + output_type + in + output_type + + + Output Value + on + + + + out + output + + + + + HPC Scheduler Count + %8.0lf + + + HPC Scheduler Percent + %5.1lf %% + + + HPC Scheduler Seconds + %8.0lf s + + + HPC Scheduler Partitions + Partitions of a scheduler cluster, from the HPC Scheduler plugin snapshot + <path_cacti>/resource/script_server/hpcsched_partitions.xml + hash_030103332111d8b54ac8ce939af87a7eac0c06 + + + hash_000103f93d9acade90b53222dfc3c271074105 + Partition Jobs + + + pending + hash_01010333672b509723b205b76de9cf9c4d3037 + hash_0801034ff959437f54362eea08f291354cecf5 + + + held + hash_01010333672b509723b205b76de9cf9c4d3037 + hash_0801036910693ddea2f118d9ef98e616856dc1 + + + running + hash_01010333672b509723b205b76de9cf9c4d3037 + hash_080103e8c91c649e1559b7b53d46d9cda8de8c + + + completing + hash_01010333672b509723b205b76de9cf9c4d3037 + hash_080103420fd08d22950c802324c7062681483c + + + jobs_other + hash_01010333672b509723b205b76de9cf9c4d3037 + hash_0801036c941d3746def1539410b64f52c65fee + + + + + title + 1 + |host_description| - |query_hpcPartition| - Jobs + + + + + name + hash_01010333672b509723b205b76de9cf9c4d3037 + 1 + |host_description| - |query_hpcPartition| - Jobs + + + + + hash_000103f3d2e23f91e63569ea0818bef55b3a44 + Partition Pending Reasons + + + r_priority + hash_01010333e84e66f50cc2ee2d773819f7053603 + hash_08010330f147e48698ef75a96754b69baa1714 + + + r_resources + hash_01010333e84e66f50cc2ee2d773819f7053603 + hash_0801033898e9baa2c1677dc4f7581f83f69b51 + + + r_dependency + hash_01010333e84e66f50cc2ee2d773819f7053603 + hash_0801037de9f095bbe02b21d3872631ebc80336 + + + r_held + hash_01010333e84e66f50cc2ee2d773819f7053603 + hash_0801035c4e50ebe6a1f6c29bba50ba3515a4e9 + + + r_begin_time + hash_01010333e84e66f50cc2ee2d773819f7053603 + hash_080103a06e11a45f19e59586c8b7b3f29d5d67 + + + r_reservation + hash_01010333e84e66f50cc2ee2d773819f7053603 + hash_0801034dff552c2fcec4454940e3e37bd93321 + + + r_assoc + hash_01010333e84e66f50cc2ee2d773819f7053603 + hash_080103aed79703af06848b734e408422ac9fca + + + r_qos + hash_01010333e84e66f50cc2ee2d773819f7053603 + hash_080103f421d3b5bda04856abf9c5bfc86c0489 + + + r_partition + hash_01010333e84e66f50cc2ee2d773819f7053603 + hash_0801035c4dd87e39dcac83a3585a03afd2278e + + + r_node + hash_01010333e84e66f50cc2ee2d773819f7053603 + hash_0801037eae4d4dcbcb73bae84d1e76fe3aa1f8 + + + r_other + hash_01010333e84e66f50cc2ee2d773819f7053603 + hash_0801037fa54617106b4ea3de8e11d2fff4fece + + + + + title + 1 + |host_description| - |query_hpcPartition| - Pending Reasons + + + + + name + hash_01010333e84e66f50cc2ee2d773819f7053603 + 1 + |host_description| - |query_hpcPartition| - Pending Reasons + + + + + hash_0001032408f3ed38f512e0456cc6774475ed67 + Partition Nodes + + + n_idle + hash_010103519f6fd9b557e36e291147e66ba62fb1 + hash_0801034ee85681f3a342270a28cfe40a031733 + + + n_allocated + hash_010103519f6fd9b557e36e291147e66ba62fb1 + hash_0801037fbc9dece25fe4b26a9f04cb0cd044a1 + + + n_mixed + hash_010103519f6fd9b557e36e291147e66ba62fb1 + hash_0801034b45508fd09493ccc08e922fbae0c27b + + + n_drained + hash_010103519f6fd9b557e36e291147e66ba62fb1 + hash_0801033b2d04342adceb65807c5519f2280e3d + + + n_down + hash_010103519f6fd9b557e36e291147e66ba62fb1 + hash_08010322cd1ac43ffb6061cefe8316e8ef0172 + + + n_maint + hash_010103519f6fd9b557e36e291147e66ba62fb1 + hash_08010308194a6e880efd8592b7883a9a2ba46a + + + n_powered_down + hash_010103519f6fd9b557e36e291147e66ba62fb1 + hash_080103fe459c327d326b8e04ebee4dea8f820c + + + n_other + hash_010103519f6fd9b557e36e291147e66ba62fb1 + hash_080103532745dbf13b13b7eea78cf659ff2523 + + + + + title + 1 + |host_description| - |query_hpcPartition| - Nodes + + + + + name + hash_010103519f6fd9b557e36e291147e66ba62fb1 + 1 + |host_description| - |query_hpcPartition| - Nodes + + + + + hash_00010350ebc39f4eebe66475a4252f1ace06d4 + Partition CPUs + + + cpus_alloc + hash_0101031bdbe89d2296b3cf2631c399bf5b8c19 + hash_080103466364a045f96d0750d0146b2f0196b6 + + + cpus_idle + hash_0101031bdbe89d2296b3cf2631c399bf5b8c19 + hash_08010366dfeb3a32ef68ae0f772daaf5612444 + + + cpus_other + hash_0101031bdbe89d2296b3cf2631c399bf5b8c19 + hash_0801036996ef8e015507ff92446a3b02049b71 + + + cpus_total + hash_0101031bdbe89d2296b3cf2631c399bf5b8c19 + hash_0801036fb6d39698b37d74c27d293707adea3c + + + + + title + 1 + |host_description| - |query_hpcPartition| - CPUs + + + + + name + hash_0101031bdbe89d2296b3cf2631c399bf5b8c19 + 1 + |host_description| - |query_hpcPartition| - CPUs + + + + + hash_000103b7985020b3992e74882a59aebe6e1f3d + Partition Utilization + + + cpu_util_pct + hash_0101036e819e58166ffb7fadaa950ac0b699c8 + hash_0801032a4689d55826d5a9bcbcc92c83d9b02e + + + node_util_pct + hash_0101036e819e58166ffb7fadaa950ac0b699c8 + hash_0801034c6f8a7ada8ed434a20faf1ca5409e1e + + + nodes_alloc + hash_0101036e819e58166ffb7fadaa950ac0b699c8 + hash_080103b2340aff73ce9708e5ae00b355bf67df + + + nodes_total + hash_0101036e819e58166ffb7fadaa950ac0b699c8 + hash_080103ee5df66878883a2f759c97a903ba88aa + + + + + title + 1 + |host_description| - |query_hpcPartition| - Utilization + + + + + name + hash_0101036e819e58166ffb7fadaa950ac0b699c8 + 1 + |host_description| - |query_hpcPartition| - Utilization + + + + + + \ No newline at end of file diff --git a/tests/Unit/SeriesTest.php b/tests/Unit/SeriesTest.php index 18aed3a..b842dc1 100644 --- a/tests/Unit/SeriesTest.php +++ b/tests/Unit/SeriesTest.php @@ -17,7 +17,6 @@ * more details. */ - use Somethingwithproof\Hpcsched\ClusterRepository; use Somethingwithproof\Hpcsched\ClusterSeries; use Somethingwithproof\Hpcsched\FixedClock; diff --git a/tests/Unit/TemplatesTest.php b/tests/Unit/TemplatesTest.php new file mode 100644 index 0000000..4921d19 --- /dev/null +++ b/tests/Unit/TemplatesTest.php @@ -0,0 +1,85 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_hpcsched, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_hpcsched + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +use Somethingwithproof\Hpcsched\Series; +use Somethingwithproof\Hpcsched\TemplateInstaller; + +/* + * The shipped template export and data query file agree with the code that + * finds and feeds them: every object the installer looks up by hash is in + * the export, the data query's fields are exactly the partition series, and + * every value the cluster input returns is stored (REQ-OBJ-001). + */ + +function hpcsched_templates_xml(): string { + return (string) file_get_contents(dirname(__DIR__, 2) . '/templates/hpcsched-templates.xml'); +} + +it('holds every object the installer finds by hash, with the type prefix Cacti gives it', function () { + $xml = hpcsched_templates_xml(); + $expect = [ + '02' => [TemplateInstaller::hash('host_template', TemplateInstaller::DEVICE_TEMPLATE)], + '03' => [TemplateInstaller::hash('data_input', TemplateInstaller::CLUSTER)], + '01' => [TemplateInstaller::hash('data_template', TemplateInstaller::CLUSTER)], + '04' => [TemplateInstaller::hash('data_query', TemplateInstaller::QUERY)], + '00' => [], + ]; + + foreach (TemplateInstaller::overview() as $name) { + $expect['00'][] = TemplateInstaller::hash('graph_template', $name); + } + + foreach (TemplateInstaller::partitionGraphs() as $name) { + $expect['00'][] = TemplateInstaller::hash('graph_template', $name); + $expect['01'][] = TemplateInstaller::hash('data_template', $name); + } + + foreach ($expect as $type => $hashes) { + foreach ($hashes as $hash) { + expect($xml)->toContain(''); + } + } + + // Core's data source profile is referenced, never shipped. + expect($xml)->not->toContain('fields->children() as $field) { + if ((string) $field->direction === 'output') { + $fields[] = (string) $field->query_name; + } + } + + expect($fields)->toBe(Series::names()) + ->and((string) $query->index_order)->toBe('hpcPartition') + ->and((string) $query->index_orphan_removal)->toBe('true') + ->and((string) $query->arg_prepend)->toBe('|host_id|'); +}); + +it('stores every cluster value and the age in the cluster data template', function () { + $xml = hpcsched_templates_xml(); + + foreach (array_merge(Series::names(), [Series::AGE]) as $name) { + expect($xml)->toContain('' . $name . ''); + } +}); diff --git a/tests/bin/build-templates.php b/tests/bin/build-templates.php new file mode 100644 index 0000000..2a77df9 --- /dev/null +++ b/tests/bin/build-templates.php @@ -0,0 +1,461 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_hpcsched, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_hpcsched + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + + +// Test code: refuse to run from a web request. +PHP_SAPI === 'cli' || exit(1); + +/* + * Build the HPC Scheduler templates in a disposable Cacti database with + * Cacti's own save function, and write Cacti's export of them (get_item_xml + * with dependencies) to templates/hpcsched-templates.xml. The plugin ships + * that export, not this script's data: + * + * HPCSCHED_TEST_DATABASE=disposable php plugins/hpcsched/tests/bin/build-templates.php [export-file] + * + * Hashes come from TemplateInstaller::hash(), so a rebuild updates the rows + * it made and exports the same hashes. Must parse on PHP 8.0. + * + * Every value is a GAUGE with minimum 0: the scheduler reports counts and + * the plugin keeps no counter. Percentages have maximum 100. + */ + +chdir(dirname(__DIR__, 4)); + +require('./include/cli_check.php'); +require_once($config['base_path'] . '/lib/functions.php'); +require_once($config['base_path'] . '/lib/export.php'); +require_once($config['base_path'] . '/plugins/hpcsched/setup.php'); + +if (getenv('HPCSCHED_TEST_DATABASE') !== 'disposable') { + fwrite(STDERR, "Set HPCSCHED_TEST_DATABASE=disposable\n"); + exit(2); +} + +if (!hpcsched_boot()) { + fwrite(STDERR, "PHP 8.2 or later is required\n"); + exit(2); +} + +use Somethingwithproof\Hpcsched\ReasonFamily; +use Somethingwithproof\Hpcsched\Series; +use Somethingwithproof\Hpcsched\TemplateInstaller as T; + +const HPCSCHED_GAUGE = 1; + +/** Core's "Get Script Server Data (Indexed)" input and its three index fields. */ +const HPCSCHED_INDEXED_INPUT = '332111d8b54ac8ce939af87a7eac0c06'; +const HPCSCHED_INDEXED_FIELDS = array('172b4b0eacee4948c6479f587b62e512', '30fb5d5bcf3d66bb5abe88596f357c26', '31112c85ae4ff821d3b288336288818c'); + +function tb_save($table, array $row) { + $id = (int) db_fetch_cell_prepared("SELECT id FROM `$table` WHERE hash = ?", array($row['hash'])); + + $row['id'] = $id > 0 ? $id : 0; + $saved = sql_save($row, $table); + + if (!$saved) { + fwrite(STDERR, "Saving $table {$row['hash']} failed\n"); + exit(1); + } + + return (int) $saved; +} + +function tb_color($hex) { + $hex = strtoupper($hex); + $id = (int) db_fetch_cell_prepared('SELECT id FROM colors WHERE hex = ?', array($hex)); + + if ($id === 0) { + db_execute_prepared('INSERT INTO colors (hex) VALUES (?)', array($hex)); + $id = (int) db_fetch_cell_prepared('SELECT id FROM colors WHERE hex = ?', array($hex)); + } + + return $id; +} + +function tb_gprint($name, $text) { + return tb_save('graph_templates_gprint', array('hash' => T::hash('gprint', $name), 'name' => $name, 'gprint_text' => $text)); +} + +/** + * A data template with one GAUGE item per name. + * + * @param array $items value name => input field id (0 for an indexed query) + */ +function tb_data_template($name, $inputId, $title, array $items, array $indexFields = array(), array $hostFields = array()) { + $dtId = tb_save('data_template', array('hash' => T::hash('data_template', $name), 'name' => $name)); + $dtdId = (int) db_fetch_cell_prepared('SELECT id FROM data_template_data WHERE data_template_id = ? AND local_data_id = 0', array($dtId)); + $dtdId = (int) sql_save(array( + 'id' => $dtdId, + 'data_template_id' => $dtId, + 'local_data_id' => 0, + 'local_data_template_data_id' => 0, + 'data_input_id' => $inputId, + 'name' => $title, + 'active' => 'on', + 'rrd_step' => 300, + 'data_source_profile_id' => 1, + ), 'data_template_data'); + + // The index fields are set per data source when Cacti creates one from + // the data query. + foreach ($indexFields as $fieldId) { + db_execute_prepared('REPLACE INTO data_input_data (data_input_field_id, data_template_data_id, t_value, value) VALUES (?, ?, ?, ?)', array($fieldId, $dtdId, 'on', '')); + } + + // A field with a device type code gets its value from the device when + // Cacti builds the poller cache, but only when the template has a row + // for it, left empty and not overridable per data source. + foreach ($hostFields as $fieldId) { + db_execute_prepared('REPLACE INTO data_input_data (data_input_field_id, data_template_data_id, t_value, value) VALUES (?, ?, ?, ?)', array($fieldId, $dtdId, '', '')); + } + + $rrd = array(); + + foreach ($items as $item => $fieldId) { + $rrd[$item] = tb_save('data_template_rrd', array( + 'hash' => T::hash('data_template_item', $name . ':' . $item), + 'data_template_id' => $dtId, + 'local_data_id' => 0, + 'rrd_maximum' => substr($item, -4) === '_pct' ? '100' : 'U', + 'rrd_minimum' => '0', + 'rrd_heartbeat' => 600, + 'data_source_type_id' => HPCSCHED_GAUGE, + 'data_source_name' => $item, + 'data_input_field_id' => $fieldId, + )); + } + + return array('id' => $dtId, 'rrd' => $rrd); +} + +/** + * A graph template from a list of items. Each item may carry legends: a + * list of [GPRINT type, label] printed after it; the last legend ends the + * line. An item with no rrd is a comment. + * + * @param list> $items + */ +function tb_graph_template($name, $title, $label, array $items, $upper = '', $rigid = false) { + $gtId = tb_save('graph_templates', array('hash' => T::hash('graph_template', $name), 'name' => $name)); + $gtgId = (int) db_fetch_cell_prepared('SELECT id FROM graph_templates_graph WHERE graph_template_id = ? AND local_graph_id = 0', array($gtId)); + + sql_save(array( + 'id' => $gtgId, + 'graph_template_id' => $gtId, + 'local_graph_id' => 0, + 'local_graph_template_graph_id' => 0, + 'image_format_id' => 1, + 't_title' => '', + 'title' => $title, + 'height' => 150, + 'width' => 600, + 'upper_limit' => $upper === '' ? '100' : $upper, + 'lower_limit' => '0', + 'vertical_label' => $label, + 'auto_scale' => $rigid ? '' : 'on', + 'auto_scale_opts' => 2, + 'auto_scale_rigid' => $rigid ? 'on' : '', + 'base_value' => 1000, + 'slope_mode' => 'on', + ), 'graph_templates_graph'); + + db_execute_prepared('DELETE FROM graph_templates_item WHERE graph_template_id = ? AND local_graph_id = 0', array($gtId)); + + $sequence = 0; + $first = 0; + + $add = function (array $row) use (&$sequence, $gtId, $name) { + $sequence++; + + return tb_save('graph_templates_item', $row + array( + 'hash' => T::hash('graph_template_item', $name . ':' . $sequence), + 'graph_template_id' => $gtId, + 'local_graph_id' => 0, + 'task_item_id' => 0, + 'color_id' => 0, + 'alpha' => 'FF', + 'graph_type_id' => GRAPH_ITEM_TYPE_COMMENT, + 'cdef_id' => 0, + 'consolidation_function_id' => 1, + 'text_format' => '', + 'value' => '', + 'hard_return' => '', + 'gprint_id' => 0, + 'sequence' => $sequence, + )); + }; + + foreach ($items as $item) { + if (!isset($item['rrd'])) { + $add(array('text_format' => $item['text'], 'hard_return' => 'on')); + + continue; + } + + $legends = isset($item['legends']) ? $item['legends'] : array(); + $id = $add(array( + 'task_item_id' => $item['rrd'], + 'graph_type_id' => $item['type'], + 'color_id' => isset($item['color']) ? tb_color($item['color']) : 0, + 'text_format' => $item['text'], + 'gprint_id' => in_array($item['type'], array(GRAPH_ITEM_TYPE_GPRINT_LAST, GRAPH_ITEM_TYPE_GPRINT_AVERAGE, GRAPH_ITEM_TYPE_GPRINT_MAX, GRAPH_ITEM_TYPE_GPRINT_MIN), true) ? $item['gprint'] : 0, + 'hard_return' => $legends === array() ? 'on' : '', + )); + + $first = $first === 0 && $item['type'] !== GRAPH_ITEM_TYPE_GPRINT_LAST ? $id : $first; + + foreach ($legends as $i => $legend) { + $add(array( + 'task_item_id' => $item['rrd'], + 'graph_type_id' => $legend[0], + 'text_format' => $legend[1], + 'gprint_id' => $item['gprint'], + 'hard_return' => $i === count($legends) - 1 ? 'on' : '', + )); + } + } + + // One graph template input, for the first item's color: Cacti 1.2.32 + // and later refuse a graph template export with no element. + $inputId = tb_save('graph_template_input', array( + 'hash' => T::hash('graph_template_input', $name . ':color'), + 'graph_template_id' => $gtId, + 'name' => 'First Item Color', + 'description' => 'The color of the first item', + 'column_name' => 'color_id', + )); + + db_execute_prepared('DELETE FROM graph_template_input_defs WHERE graph_template_input_id = ?', array($inputId)); + db_execute_prepared('INSERT INTO graph_template_input_defs (graph_template_input_id, graph_template_item_id) VALUES (?, ?)', array($inputId, $first)); + + return $gtId; +} + +$gCount = tb_gprint('HPC Scheduler Count', '%8.0lf'); +$gPct = tb_gprint('HPC Scheduler Percent', '%5.1lf %%'); +$gSec = tb_gprint('HPC Scheduler Seconds', '%8.0lf s'); + +$last = array(array(GRAPH_ITEM_TYPE_GPRINT_LAST, 'Current:'), array(GRAPH_ITEM_TYPE_GPRINT_AVERAGE, 'Average:'), array(GRAPH_ITEM_TYPE_GPRINT_MAX, 'Maximum:')); + +$palette = array( + 'pending' => 'F39C12', 'held' => '8E44AD', 'running' => '27AE60', 'completing' => '2E86C1', 'jobs_other' => '95A5A6', + 'n_idle' => '52BE80', 'n_allocated' => '2471A3', 'n_mixed' => '5DADE2', 'n_drained' => 'E67E22', 'n_down' => 'C0392B', 'n_maint' => '7D3C98', 'n_powered_down' => '566573', 'n_other' => 'BDC3C7', + 'cpus_alloc' => '2471A3', 'cpus_idle' => 'A9DFBF', 'cpus_other' => 'E6B0AA', 'cpus_total' => '17202A', + 'cpu_util_pct' => '2471A3', 'node_util_pct' => '27AE60', +); +$reasonColors = array('1F77B4', 'FF7F0E', '2CA02C', 'D62728', '9467BD', '8C564B', 'E377C2', '7F7F7F', 'BCBD22', '17BECF', '393B79'); + +foreach (ReasonFamily::cases() as $i => $family) { + $palette['r_' . $family->value] = $reasonColors[$i % count($reasonColors)]; +} + +$labels = array( + 'pending' => 'Pending (eligible)', 'held' => 'Held', 'running' => 'Running', 'completing' => 'Completing', 'jobs_other' => 'Other', + 'n_idle' => 'Idle', 'n_allocated' => 'Allocated', 'n_mixed' => 'Mixed', 'n_drained' => 'Drained or draining', 'n_down' => 'Down', 'n_maint' => 'Maintenance or reserved', 'n_powered_down' => 'Powered down', 'n_other' => 'Other', + 'cpus_alloc' => 'Allocated', 'cpus_idle' => 'Idle', 'cpus_other' => 'Unavailable', 'cpus_total' => 'Total', + 'cpu_util_pct' => 'CPUs allocated', 'node_util_pct' => 'Nodes with allocated CPUs', 'nodes_alloc' => 'Nodes with allocated CPUs', 'nodes_total' => 'Nodes', +); + +foreach (ReasonFamily::cases() as $family) { + $labels['r_' . $family->value] = $family->label(); +} + +/** + * The items of one group's graph: counts stacked, the CPU total as a line, + * utilization as lines with node counts printed, the denominator rule as a + * comment (REQ-NODEAGG-005). + * + * @param array $rrd value name => data template item id + */ +function tb_group_items($group, array $rrd) { + global $palette, $labels, $last, $gCount, $gPct; + + $items = array(); + + if ($group === 'Utilization') { + $items[] = array('rrd' => $rrd['cpu_util_pct'], 'type' => GRAPH_ITEM_TYPE_LINE2, 'color' => $palette['cpu_util_pct'], 'text' => $labels['cpu_util_pct'], 'gprint' => $gPct, 'legends' => $last); + $items[] = array('rrd' => $rrd['node_util_pct'], 'type' => GRAPH_ITEM_TYPE_LINE2, 'color' => $palette['node_util_pct'], 'text' => $labels['node_util_pct'], 'gprint' => $gPct, 'legends' => $last); + $items[] = array('rrd' => $rrd['nodes_alloc'], 'type' => GRAPH_ITEM_TYPE_GPRINT_LAST, 'text' => 'Nodes with allocated CPUs now', 'gprint' => $gCount); + $items[] = array('rrd' => $rrd['nodes_total'], 'type' => GRAPH_ITEM_TYPE_GPRINT_LAST, 'text' => 'of', 'gprint' => $gCount); + $items[] = array('text' => 'Allocated over all CPUs and nodes, down, drained, and maintenance ones included, as sinfo counts them'); + + return $items; + } + + $stackFirst = true; + + foreach ($rrd as $name => $id) { + if ($name === 'cpus_total') { + $items[] = array('rrd' => $id, 'type' => GRAPH_ITEM_TYPE_LINE1, 'color' => $palette[$name], 'text' => $labels[$name], 'gprint' => $gCount, 'legends' => array(array(GRAPH_ITEM_TYPE_GPRINT_LAST, 'Current:'))); + + continue; + } + + $items[] = array('rrd' => $id, 'type' => $stackFirst ? GRAPH_ITEM_TYPE_AREA : GRAPH_ITEM_TYPE_STACK, 'color' => $palette[$name], 'text' => $labels[$name], 'gprint' => $gCount, 'legends' => $last); + $stackFirst = false; + } + + if ($group === 'CPUs') { + $items[] = array('text' => 'Unavailable is the unallocated CPUs of nodes that are down, drained, draining, in maintenance, or powered down'); + } + + if ($group === 'Pending Reasons') { + $items[] = array('text' => 'Each job under the last reason the scheduler gave it; eligible and held jobs both count'); + } + + return $items; +} + +$vertical = array('Jobs' => 'jobs', 'Pending Reasons' => 'jobs', 'Nodes' => 'nodes', 'CPUs' => 'CPUs', 'Utilization' => 'percent'); + +/* ---- cluster data input, data template, and graphs ---- */ + +$inputId = tb_save('data_input', array( + 'hash' => T::hash('data_input', T::CLUSTER), + 'name' => T::CLUSTER, + 'input_string' => '/plugins/hpcsched/scripts/ss_hpcsched_cluster.php ss_hpcsched_cluster ', + 'type_id' => DATA_INPUT_TYPE_PHP_SCRIPT_SERVER, +)); + +$field = function ($dataName, $friendly, $inOut, $sequence, $typeCode = '') use ($inputId) { + return tb_save('data_input_fields', array( + 'hash' => T::hash('data_input_field', T::CLUSTER . ':' . $dataName), + 'data_input_id' => $inputId, + 'name' => $friendly, + 'data_name' => $dataName, + 'input_output' => $inOut, + 'update_rra' => $inOut === 'out' ? 'on' : '', + 'sequence' => $sequence, + 'type_code' => $typeCode, + 'regexp_match' => '', + 'allow_nulls' => '', + )); +}; + +$hostField = $field('host_id', 'Device ID', 'in', 0, 'host_id'); +$clusterItems = array(); + +foreach (array_merge(Series::names(), array(Series::AGE)) as $i => $name) { + $clusterItems[$name] = $field($name, $name === Series::AGE ? 'Snapshot age (seconds)' : $labels[$name], 'out', $i + 1); +} + +$cluster = tb_data_template(T::CLUSTER, $inputId, '|host_description| - HPC Scheduler Cluster', $clusterItems, array(), array($hostField)); +$overview = array(); + +foreach (Series::groups() as $group => $names) { + $overview[] = tb_graph_template(T::overview()[$group], '|host_description| - ' . $group, $vertical[$group], tb_group_items($group, array_intersect_key($cluster['rrd'], array_flip($names))), $group === 'Utilization' ? '100' : '', $group === 'Utilization'); +} + +$overview[] = tb_graph_template(T::AGE_GRAPH, '|host_description| - Snapshot Age', 'seconds', array( + array('rrd' => $cluster['rrd'][Series::AGE], 'type' => GRAPH_ITEM_TYPE_AREA, 'color' => '5D6D7E', 'text' => 'Age of the oldest section', 'gprint' => $gSec, 'legends' => $last), + array('text' => 'Grows while the reader is stopped; alert on it with a duration of at least one collection interval'), +)); + +/* ---- partition data templates, data query, and graphs ---- */ + +$indexedInput = (int) db_fetch_cell_prepared('SELECT id FROM data_input WHERE hash = ?', array(HPCSCHED_INDEXED_INPUT)); +$indexedFields = array(); + +foreach (HPCSCHED_INDEXED_FIELDS as $hash) { + $indexedFields[] = (int) db_fetch_cell_prepared('SELECT id FROM data_input_fields WHERE hash = ?', array($hash)); +} + +if ($indexedInput === 0 || in_array(0, $indexedFields, true)) { + fwrite(STDERR, "Cacti's script server indexed input is missing\n"); + exit(1); +} + +$queryId = tb_save('snmp_query', array( + 'hash' => T::hash('data_query', T::QUERY), + 'xml_path' => '/resource/script_server/' . T::QUERY_FILE, + 'name' => T::QUERY, + 'description' => 'Partitions of a scheduler cluster, from the HPC Scheduler plugin snapshot', + 'data_input_id' => $indexedInput, +)); + +foreach (Series::groups() as $group => $names) { + $name = T::partitionGraphs()[$group]; + $template = tb_data_template($name, $indexedInput, '|host_description| - |query_hpcPartition| - ' . $group, array_fill_keys($names, 0), $indexedFields); + $graphId = tb_graph_template($name, '|host_description| - |query_hpcPartition| - ' . $group, $vertical[$group], tb_group_items($group, $template['rrd']), $group === 'Utilization' ? '100' : '', $group === 'Utilization'); + + $sqgId = tb_save('snmp_query_graph', array( + 'hash' => T::hash('data_query_graph', T::QUERY . ':' . $group), + 'snmp_query_id' => $queryId, + 'name' => 'Partition ' . $group, + 'graph_template_id' => $graphId, + )); + + // Every item of the graph's data template maps to the query field of + // the same name. + db_execute_prepared('DELETE FROM snmp_query_graph_rrd WHERE snmp_query_graph_id = ?', array($sqgId)); + + foreach ($template['rrd'] as $item => $rrdId) { + db_execute_prepared('INSERT INTO snmp_query_graph_rrd (snmp_query_graph_id, data_template_id, data_template_rrd_id, snmp_field_name) VALUES (?, ?, ?, ?)', array($sqgId, $template['id'], $rrdId, $item)); + } + + tb_save('snmp_query_graph_sv', array( + 'hash' => T::hash('data_query_sv_graph', T::QUERY . ':' . $group . ':title'), + 'snmp_query_graph_id' => $sqgId, + 'sequence' => 1, + 'field_name' => 'title', + 'text' => '|host_description| - |query_hpcPartition| - ' . $group, + )); + + tb_save('snmp_query_graph_rrd_sv', array( + 'hash' => T::hash('data_query_sv_data_source', T::QUERY . ':' . $group . ':name'), + 'snmp_query_graph_id' => $sqgId, + 'data_template_id' => $template['id'], + 'sequence' => 1, + 'field_name' => 'name', + 'text' => '|host_description| - |query_hpcPartition| - ' . $group, + )); +} + +/* ---- device template ---- */ + +$htId = tb_save('host_template', array('hash' => T::hash('host_template', T::DEVICE_TEMPLATE), 'name' => T::DEVICE_TEMPLATE)); + +db_execute_prepared('DELETE FROM host_template_graph WHERE host_template_id = ?', array($htId)); +db_execute_prepared('DELETE FROM host_template_snmp_query WHERE host_template_id = ?', array($htId)); + +foreach ($overview as $gtId) { + db_execute_prepared('INSERT INTO host_template_graph (host_template_id, graph_template_id) VALUES (?, ?)', array($htId, $gtId)); +} + +// The reindex method is set per device when the provisioner attaches the +// query; 1.2.31's host_template_snmp_query has no column for it. +db_execute_prepared('INSERT INTO host_template_snmp_query (host_template_id, snmp_query_id) VALUES (?, ?)', array($htId, $queryId)); + +$xml = get_item_xml('host_template', $htId, true); + +// The export follows the data source profile the data templates use. The +// plugin must not overwrite a site's profile, so the shipped file leaves it +// out and import resolves the profile by its hash, which is Cacti's stock one. +$xml = preg_replace('#\s*.*?#s', '', $xml, -1, $removed); + +if ($removed !== 1) { + fwrite(STDERR, "Expected one data source profile in the export, found $removed\n"); + exit(1); +} + +$file = isset($argv[1]) ? $argv[1] : $config['base_path'] . '/plugins/hpcsched/templates/hpcsched-templates.xml'; + +file_put_contents($file, $xml); +print "Wrote $file\n"; From f69ad725a7ffb8288835333820a3e1ffe15c153e Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Sun, 15 Nov 2026 08:25:04 -0800 Subject: [PATCH 04/15] feat: create cluster devices and add the pending reasons view (#41, #43, #46) HPC Clusters gains a device page per cluster. It lists what a device adds before anything is created: the device, the partition data query, each graph, and the data sources, RRD files, and script server calls per poll they bring. Create Device saves a device from the HPC Scheduler Cluster template with a host name in the reserved .invalid domain, no availability check, and the cluster's poller; Map Device attaches the graphs to an existing device and leaves its settings alone. Both go through Cacti's own device, data query, and graph functions. Unmap keeps the device and graphs; deleting the device unmaps the cluster through the device_remove hook. The reader reindexes a mapped device when the snapshot's partitions differ from its indexes, which catches a renamed partition that Cacti's index count check misses (ADR 0011). Install and upgrade import the templates; a failed import is kept for the health page, which shows the template state and offers a POST-only Install Templates action, and is retried only from the Plugins page or that action. Schema 2 adds the cluster's device column and the node count table. The overview gains a pending reasons view per cluster: raw reasons with family, job count, and affected partitions, up to 200 rows, with the snapshot time, and nodes in states the plugin does not know, with names for the Admin realm only. No job, user, or account is shown. Every action on an existing cluster checks Cacti's device permission for its device first, and mapping also checks the target device. Lists, the export, the health page, and the overview leave out clusters on devices the user may not see. A cluster whose device was deleted while the hook could not run counts as unmapped, so it is not lost to everyone. Signed-off-by: Thomas Vincent --- hpcsched.php | 38 +++- hpcsched_clusters.php | 94 ++++++++-- hpcsched_health.php | 23 ++- lib/ClustersPage.php | 108 +++++++++-- lib/DeviceAccess.php | 75 ++++++++ lib/DeviceProvisioner.php | 266 ++++++++++++++++++++++++++++ lib/HealthPage.php | 37 +++- lib/OverviewPage.php | 95 +++++++++- lib/Schema.php | 1 + lib/ViewRepository.php | 56 +++++- locales/po/cacti.pot | 261 ++++++++++++++++++++++++++- poller_hpcsched.php | 6 + setup.php | 92 +++++++++- tests/Integration/LifecycleTest.php | 47 ++++- tests/Unit/PagesTest.php | 127 ++++++++++++- tests/bin/build-templates.php | 6 + tests/bin/lifecycle.php | 24 +++ tests/bin/php-guard-check.php | 2 +- 18 files changed, 1285 insertions(+), 73 deletions(-) create mode 100644 lib/DeviceAccess.php create mode 100644 lib/DeviceProvisioner.php diff --git a/hpcsched.php b/hpcsched.php index 946fe32..06af0bc 100644 --- a/hpcsched.php +++ b/hpcsched.php @@ -17,9 +17,12 @@ * more details. */ + /* * HPC Scheduler overview (HPC Scheduler View realm). Must parse on PHP 8.0; - * see hpcsched_clusters.php. Read only, counts only. + * see hpcsched_clusters.php. Read only, counts only. The pending reasons + * view of a cluster checks Cacti's device permission for the cluster's + * device first. */ chdir('../../'); @@ -30,16 +33,33 @@ exit; } -$hpcsched_clock = new \Somethingwithproof\Hpcsched\SystemClock(); - -top_header(); - -(new \Somethingwithproof\Hpcsched\OverviewPage( - new \Somethingwithproof\Hpcsched\ClusterRepository(false, $hpcsched_clock), +$hpcsched_clock = new \Somethingwithproof\Hpcsched\SystemClock(); +$hpcsched_clusters = new \Somethingwithproof\Hpcsched\ClusterRepository(false, $hpcsched_clock); +$hpcsched_access = hpcsched_device_access(); +$hpcsched_page = new \Somethingwithproof\Hpcsched\OverviewPage( + $hpcsched_clusters, new \Somethingwithproof\Hpcsched\ViewRepository(false), new \Somethingwithproof\Hpcsched\FreshnessEvaluator($hpcsched_clock), $hpcsched_clock, - hpcsched_poller_interval() -))->render(); + hpcsched_poller_interval(), + $hpcsched_access, + api_plugin_user_realm_auth('hpcsched_clusters.php') === true +); + +if (get_nfilter_request_var('action') === 'reasons') { + $hpcsched_cluster = $hpcsched_clusters->get((int) get_filter_request_var('id')); + if (!$hpcsched_access->cluster($hpcsched_cluster)) { + header('Location: hpcsched.php'); + exit; + } + + top_header(); + $hpcsched_page->renderReasons($hpcsched_cluster); + bottom_footer(); + exit; +} + +top_header(); +$hpcsched_page->render(); bottom_footer(); diff --git a/hpcsched_clusters.php b/hpcsched_clusters.php index cb38296..40ef122 100644 --- a/hpcsched_clusters.php +++ b/hpcsched_clusters.php @@ -17,12 +17,18 @@ * more details. */ + /* * HPC Clusters (HPC Scheduler Admin realm). This file must parse on PHP 8.0: * Cacti may include it on an unsupported runtime, and hpcsched_page_start() * refuses there before any plugin class loads. Request values are read * through Cacti's request helpers and validated by ClusterInput before * anything is stored. Nothing here contacts a scheduler. + * + * Every action that loads an existing cluster checks Cacti's device + * permission for the cluster's device first (DeviceAccess), and mapping also + * checks the device it maps to, so an administrator of the plugin allowed + * one device cannot see or change a cluster on another. */ chdir('../../'); @@ -33,25 +39,40 @@ exit; } -hpcsched_require_post('hpcsched_clusters.php', array('save', 'delete', 'enable', 'disable')); +hpcsched_require_post('hpcsched_clusters.php', array('save', 'delete', 'enable', 'disable', 'create_device', 'map_device', 'attach_device', 'unmap_device', 'reindex_device')); $hpcsched_clock = new \Somethingwithproof\Hpcsched\SystemClock(); $hpcsched_clusters = new \Somethingwithproof\Hpcsched\ClusterRepository(false, $hpcsched_clock); $hpcsched_pollers = new \Somethingwithproof\Hpcsched\PollerRepository(false); -$hpcsched_page = new \Somethingwithproof\Hpcsched\ClustersPage($hpcsched_clusters, $hpcsched_pollers); +$hpcsched_access = hpcsched_device_access(); +$hpcsched_devices = hpcsched_provisioner(); +$hpcsched_page = new \Somethingwithproof\Hpcsched\ClustersPage($hpcsched_clusters, $hpcsched_pollers, $hpcsched_access, new \Somethingwithproof\Hpcsched\CactiObjectRepository(false), $hpcsched_devices); $hpcsched_action = (string) get_nfilter_request_var('action'); -switch ($hpcsched_action) { - case 'save': - $hpcsched_id = (int) get_filter_request_var('id'); - $hpcsched_existing = $hpcsched_id > 0 ? $hpcsched_clusters->get($hpcsched_id) : null; +/** + * The cluster a request names, or back to the list when it does not exist + * or its device is not allowed to this user. + */ +function hpcsched_cluster_request(\Somethingwithproof\Hpcsched\ClusterRepository $clusters, \Somethingwithproof\Hpcsched\DeviceAccess $access): \Somethingwithproof\Hpcsched\Cluster { + $cluster = $clusters->get((int) get_filter_request_var('id')); - if ($hpcsched_id > 0 && $hpcsched_existing === null) { - header('Location: hpcsched_clusters.php'); - exit; + if (!$access->cluster($cluster)) { + if ($cluster !== null) { + raise_message('hpcsched_denied', __('You do not have permission for the device of that cluster.', 'hpcsched'), MESSAGE_LEVEL_ERROR); } - $hpcsched_input = array(); + header('Location: hpcsched_clusters.php'); + exit; + } + + return $cluster; +} + +switch ($hpcsched_action) { + case 'save': + $hpcsched_id = (int) get_filter_request_var('id'); + $hpcsched_existing = $hpcsched_id > 0 ? hpcsched_cluster_request($hpcsched_clusters, $hpcsched_access) : null; + $hpcsched_input = array(); foreach (array('name', 'poller_id', 'collect_interval', 'enabled', 'collect_reservations', 'collect_shares', 'transport', 'slurm_conf', 'rest_url', 'rest_user', 'token_file', 'updated_at') as $hpcsched_field) { $hpcsched_input[$hpcsched_field] = (string) get_nfilter_request_var($hpcsched_field); @@ -77,21 +98,66 @@ exit; case 'enable': case 'disable': - $hpcsched_clusters->setState((int) get_filter_request_var('id'), $hpcsched_action === 'enable' ? \Somethingwithproof\Hpcsched\AdminState::Enabled : \Somethingwithproof\Hpcsched\AdminState::Disabled); + $hpcsched_cluster = hpcsched_cluster_request($hpcsched_clusters, $hpcsched_access); + $hpcsched_clusters->setState($hpcsched_cluster->id, $hpcsched_action === 'enable' ? \Somethingwithproof\Hpcsched\AdminState::Enabled : \Somethingwithproof\Hpcsched\AdminState::Disabled); header('Location: hpcsched_clusters.php'); exit; case 'delete': - if ($hpcsched_clusters->delete((int) get_filter_request_var('id'))) { - raise_message('hpcsched_deleted', __('The cluster and its cached snapshot were deleted. The scheduler was not contacted.', 'hpcsched'), MESSAGE_LEVEL_INFO); + $hpcsched_cluster = hpcsched_cluster_request($hpcsched_clusters, $hpcsched_access); + + if ($hpcsched_clusters->delete($hpcsched_cluster->id)) { + raise_message('hpcsched_deleted', __('The cluster and its cached snapshot were deleted. Its device and graphs were kept. The scheduler was not contacted.', 'hpcsched'), MESSAGE_LEVEL_INFO); } header('Location: hpcsched_clusters.php'); exit; + case 'create_device': + case 'map_device': + case 'attach_device': + $hpcsched_cluster = hpcsched_cluster_request($hpcsched_clusters, $hpcsched_access); + $hpcsched_graphs = get_nfilter_request_var('partition_graphs') === 'on'; + $hpcsched_back = 'hpcsched_clusters.php?action=device&id=' . $hpcsched_cluster->id; + + if ($hpcsched_devices->refusal() !== null) { + raise_message('hpcsched_device', $hpcsched_devices->refusal(), MESSAGE_LEVEL_ERROR); + } elseif ($hpcsched_action === 'create_device') { + $hpcsched_ok = $hpcsched_cluster->hostId === 0 && $hpcsched_devices->create($hpcsched_cluster, $hpcsched_graphs) > 0; + raise_message('hpcsched_device', $hpcsched_ok ? __('The device and its graphs were created.', 'hpcsched') : __('The device was not created. See the Cacti log.', 'hpcsched'), $hpcsched_ok ? MESSAGE_LEVEL_INFO : MESSAGE_LEVEL_ERROR); + } elseif ($hpcsched_action === 'map_device') { + $hpcsched_host = (int) get_filter_request_var('host_id'); + $hpcsched_ok = $hpcsched_cluster->hostId === 0 && $hpcsched_access->device($hpcsched_host) && $hpcsched_devices->map($hpcsched_cluster, $hpcsched_host, $hpcsched_graphs); + raise_message('hpcsched_device', $hpcsched_ok ? __('The cluster was mapped to the device.', 'hpcsched') : __('The cluster was not mapped: the device does not exist, is not allowed to you, or already carries another cluster.', 'hpcsched'), $hpcsched_ok ? MESSAGE_LEVEL_INFO : MESSAGE_LEVEL_ERROR); + } elseif ($hpcsched_cluster->hostId > 0) { + $hpcsched_devices->attach($hpcsched_cluster->id, $hpcsched_cluster->hostId, $hpcsched_graphs); + raise_message('hpcsched_device', __('Missing graphs were added.', 'hpcsched'), MESSAGE_LEVEL_INFO); + } + + header('Location: ' . $hpcsched_back); + exit; + case 'unmap_device': + $hpcsched_cluster = hpcsched_cluster_request($hpcsched_clusters, $hpcsched_access); + $hpcsched_clusters->mapHost($hpcsched_cluster->id, 0); + raise_message('hpcsched_device', __('The cluster was unmapped. The device and its graphs were kept.', 'hpcsched'), MESSAGE_LEVEL_INFO); + header('Location: hpcsched_clusters.php?action=device&id=' . $hpcsched_cluster->id); + exit; + case 'reindex_device': + $hpcsched_cluster = hpcsched_cluster_request($hpcsched_clusters, $hpcsched_access); + $hpcsched_devices->reindex($hpcsched_cluster->hostId); + raise_message('hpcsched_device', __('The partitions were reindexed from the snapshot.', 'hpcsched'), MESSAGE_LEVEL_INFO); + header('Location: hpcsched_clusters.php?action=device&id=' . $hpcsched_cluster->id); + exit; + case 'device': + $hpcsched_cluster = hpcsched_cluster_request($hpcsched_clusters, $hpcsched_access); + + top_header(); + $hpcsched_page->renderDevice($hpcsched_cluster); + bottom_footer(); + exit; case 'edit': $hpcsched_id = (int) get_filter_request_var('id'); top_header(); - $hpcsched_page->renderEdit($hpcsched_id > 0 ? $hpcsched_clusters->get($hpcsched_id) : null); + $hpcsched_page->renderEdit($hpcsched_id > 0 ? hpcsched_cluster_request($hpcsched_clusters, $hpcsched_access) : null); bottom_footer(); exit; case 'export': diff --git a/hpcsched_health.php b/hpcsched_health.php index 1c76fbb..631b7dc 100644 --- a/hpcsched_health.php +++ b/hpcsched_health.php @@ -17,10 +17,13 @@ * more details. */ + /* * HPC Scheduler Health (HPC Scheduler Admin realm). Must parse on PHP 8.0; - * see hpcsched_clusters.php. Read only: nothing here contacts a scheduler - * or reads a token file. + * see hpcsched_clusters.php. Nothing here contacts a scheduler or reads a + * token file. The one action, installing the templates, is POST only and + * changes no cluster. Clusters on a device the user may not see are left + * out. */ chdir('../../'); @@ -31,7 +34,17 @@ exit; } -$hpcsched_clock = new \Somethingwithproof\Hpcsched\SystemClock(); +hpcsched_require_post('hpcsched_health.php', array('install_templates')); + +$hpcsched_clock = new \Somethingwithproof\Hpcsched\SystemClock(); +$hpcsched_templates = hpcsched_template_installer(); + +if (get_nfilter_request_var('action') === 'install_templates') { + $hpcsched_ok = $hpcsched_templates->install(); + raise_message('hpcsched_templates', $hpcsched_ok ? __('The HPC Scheduler templates are installed.', 'hpcsched') : __('The templates were not installed: %s', $hpcsched_templates->failure(), 'hpcsched'), $hpcsched_ok ? MESSAGE_LEVEL_INFO : MESSAGE_LEVEL_ERROR); + header('Location: hpcsched_health.php'); + exit; +} top_header(); @@ -42,7 +55,9 @@ hpcsched_settings(), new \Somethingwithproof\Hpcsched\FreshnessEvaluator($hpcsched_clock), $hpcsched_clock, - hpcsched_poller_interval() + hpcsched_poller_interval(), + hpcsched_device_access(), + $hpcsched_templates ))->render(); bottom_footer(); diff --git a/lib/ClustersPage.php b/lib/ClustersPage.php index 640d4fe..a7497d3 100644 --- a/lib/ClustersPage.php +++ b/lib/ClustersPage.php @@ -21,10 +21,12 @@ /** * HPC Clusters (HPC Scheduler Admin realm, REQ-UI-003): the cluster list, - * the edit form, and the export. Every action that changes state is a POST - * form that csrf-magic signs. Every stored string is escaped where it is - * printed. The form takes a token file path, never a token, and the export - * holds no credential. Nothing here contacts a scheduler. + * the edit form, the device page, and the export. Every action that changes + * state is a POST form that csrf-magic signs. Every stored string is escaped + * where it is printed. The form takes a token file path, never a token, and + * the export holds no credential. Clusters on a device the user may not see + * are left out of the list and the export (DeviceAccess). Nothing here + * contacts a scheduler. */ final class ClustersPage { public const FILE = 'hpcsched_clusters.php'; @@ -32,22 +34,26 @@ final class ClustersPage { public function __construct( private readonly ClusterRepository $clusters, private readonly PollerRepository $pollers, + private readonly DeviceAccess $access, + private readonly CactiObjectRepository $objects, + private readonly DeviceProvisioner $provisioner, ) { } public function renderList(): void { $pollers = $this->pollers->names(); - $clusters = $this->clusters->all(); + $clusters = $this->access->clusters($this->clusters->all()); html_start_box(__('HPC Clusters', 'hpcsched'), '100%', '', '3', 'center', self::FILE . '?action=edit'); - print Format::header([__('Name', 'hpcsched'), __('Poller', 'hpcsched'), __('Transport', 'hpcsched'), __('Interval', 'hpcsched'), __('Sections', 'hpcsched'), __('State', 'hpcsched'), __('Actions', 'hpcsched')]); + print Format::header([__('Name', 'hpcsched'), __('Poller', 'hpcsched'), __('Transport', 'hpcsched'), __('Interval', 'hpcsched'), __('Sections', 'hpcsched'), __('State', 'hpcsched'), __('Device', 'hpcsched'), __('Actions', 'hpcsched')]); if ($clusters === []) { - print '' . html_escape(__('No clusters configured yet.', 'hpcsched')) . ''; + print '' . html_escape(__('No clusters configured yet.', 'hpcsched')) . ''; } foreach ($clusters as $cluster) { $toggle = $cluster->enabled() ? ['disable', __('Disable', 'hpcsched')] : ['enable', __('Enable', 'hpcsched')]; + $device = $this->objects->device($cluster->hostId); print '' . '' . html_escape($cluster->name) . '' @@ -56,6 +62,7 @@ public function renderList(): void { . '' . html_escape(__('%d seconds', $cluster->interval, 'hpcsched')) . '' . '' . html_escape(implode(', ', array_map(static fn (Section $s): string => $s->label(), $cluster->sections()))) . '' . '' . html_escape($cluster->adminState->value) . '' + . '' . html_escape($device === null ? __('None', 'hpcsched') : $device['description']) . '' . '' . $this->actionForm($toggle[0], $cluster->id, $toggle[1]) . ' ' . $this->actionForm('delete', $cluster->id, __('Delete', 'hpcsched')) . '' . ''; } @@ -118,6 +125,77 @@ public function renderEdit(?Cluster $cluster, array $input = [], array $errors = . ''; } + /** + * The cluster's device: what creating or mapping one adds, before it is + * done (REQ-OBJ-002, REQ-OBJ-006), or the mapped device and what can be + * done to it. The caller has checked DeviceAccess for the cluster. + */ + public function renderDevice(Cluster $cluster): void { + $refusal = $this->provisioner->refusal(); + $device = $this->objects->device($cluster->hostId); + + html_start_box(__('Device for Cluster: %s', html_escape($cluster->name), 'hpcsched'), '100%', '', '3', 'center', ''); + + if ($refusal !== null) { + print '' . html_escape($refusal) . ''; + html_end_box(); + + return; + } + + if ($device !== null) { + print '' . html_escape(__('Mapped to device %s (id %d). Its graphs follow Cacti\'s device and graph permissions.', $device['description'], $device['id'], 'hpcsched')) . ''; + + print '' . html_escape(__('Adding the missing graphs adds:', 'hpcsched')) . ''; + + foreach ($this->provisioner->plan($cluster, $device['id'], true) as $line) { + print '' . html_escape($line) . ''; + } + + print '' + . $this->actionForm('attach_device', $cluster->id, __('Add Missing Graphs', 'hpcsched'), ['partition_graphs' => 'on']) . ' ' + . $this->actionForm('reindex_device', $cluster->id, __('Reindex Partitions', 'hpcsched')) . ' ' + . $this->actionForm('unmap_device', $cluster->id, __('Unmap', 'hpcsched')) + . ''; + print '' . html_escape(__('Unmapping keeps the device, its graphs, and their history.', 'hpcsched')) . ''; + html_end_box(); + + return; + } + + print '' . html_escape(__('Creating a device adds:', 'hpcsched')) . ''; + + foreach ($this->provisioner->plan($cluster, 0, true) as $line) { + print '' . html_escape($line) . ''; + } + + print '' . html_escape(__('Without partition graphs, only the cluster graphs are created, and the data sources and calls for the partitions above are left out.', 'hpcsched')) . ''; + print '
' + . '' + . ' ' + . '' + . '
'; + + $mapped = array_values(array_filter(array_map(static fn (Cluster $c): int => $c->hostId, $this->clusters->all()))); + $devices = array_filter($this->objects->mappableDevices($mapped), fn (int $id): bool => $this->access->device($id), ARRAY_FILTER_USE_KEY); + + if ($devices !== []) { + print '
' + . '' + . ' ' + . '' + . '
'; + } + + html_end_box(); + } + /** * The cluster configuration as data for the export download. Token file * paths only; no token is ever in the plugin's tables to export. @@ -141,14 +219,24 @@ public function export(string $version, int $now): array { 'token_file' => $c->tokenFile, 'collect_reservations' => $c->reservations, 'collect_shares' => $c->shares, - ], $this->clusters->all()), + 'host_id' => $c->hostId, + ], $this->access->clusters($this->clusters->all())), ]; } - private function actionForm(string $action, int $id, string $label): string { + /** + * @param array $extra more hidden fields + */ + private function actionForm(string $action, int $id, string $label, array $extra = []): string { + $hidden = ''; + + foreach ($extra as $name => $value) { + $hidden .= ''; + } + return '
' . '' - . '' + . '' . $hidden . '' . '
'; } diff --git a/lib/DeviceAccess.php b/lib/DeviceAccess.php new file mode 100644 index 0000000..299e76a --- /dev/null +++ b/lib/DeviceAccess.php @@ -0,0 +1,75 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_hpcsched, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_hpcsched + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + + +namespace Somethingwithproof\Hpcsched; + +/** + * Cacti device permissions applied to the plugin's own records (REQ-SEC-001, + * REQ-SEC-002). A cluster mapped to a device belongs to that device: a user, + * administrators of the plugin included, may see or change it only while + * Cacti allows them the device. An unmapped cluster belongs to no device and + * is left to the realm that opened the page. + * + * Every admin action checks the record it loads, on the request that + * changes it, before any write, mapping, reindex, or provisioning; mapping + * also checks the device it maps to. Lists, the export, and the health page + * show only clusters that pass. + */ +final class DeviceAccess { + /** + * @param \Closure(int): bool $deviceAllowed Cacti's is_device_allowed() for the current user + * @param \Closure(int): bool|null $deviceExists whether the device is still in Cacti + */ + public function __construct( + private readonly \Closure $deviceAllowed, + private readonly ?\Closure $deviceExists = null, + ) { + } + + public function device(int $hostId): bool { + return $hostId > 0 && ($this->deviceAllowed)($hostId) === true; + } + + /** + * A cluster whose device was deleted while the plugin's device_remove + * hook could not run (the plugin disabled) counts as unmapped, so it + * cannot become invisible to everyone. + */ + public function cluster(?Cluster $cluster): bool { + if ($cluster === null) { + return false; + } + + if ($cluster->hostId === 0 || $this->device($cluster->hostId)) { + return true; + } + + return $this->deviceExists !== null && ($this->deviceExists)($cluster->hostId) === false; + } + + /** + * @param list $clusters + * + * @return list + */ + public function clusters(array $clusters): array { + return array_values(array_filter($clusters, fn (Cluster $c): bool => $this->cluster($c))); + } +} diff --git a/lib/DeviceProvisioner.php b/lib/DeviceProvisioner.php new file mode 100644 index 0000000..8388da8 --- /dev/null +++ b/lib/DeviceProvisioner.php @@ -0,0 +1,266 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_hpcsched, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_hpcsched + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + + +namespace Somethingwithproof\Hpcsched; + +/** + * Creates or maps the Cacti device of a cluster and attaches the partition + * data query and the cluster graphs to it (REQ-OBJ-002 to REQ-OBJ-004, + * REQ-OBJ-006). + * + * Everything goes through Cacti's own functions: api_device_save() for the + * device, api_device_dq_add() for the data query (which runs the first + * index), create_complete_graph_from_template() for graphs, and + * run_data_query() for a reindex. The plugin writes only its own mapping. A + * mapped device that already existed keeps every setting; only the data + * query and missing graphs are added. + */ +final class DeviceProvisioner { + /** Script server calls one data source makes per poll: the cluster input answers in one call. */ + private const CLUSTER_CALLS = 1; + + public function __construct( + private readonly ClusterRepository $clusters, + private readonly SeriesRepository $series, + private readonly CactiObjectRepository $objects, + private readonly string $cactiPath, + ) { + } + + /** + * Why the plugin cannot provision now, or null when it can. + */ + public function refusal(): ?string { + if ($this->objects->deviceTemplateId() === 0 || $this->objects->queryId() === 0) { + return __('The HPC Scheduler templates are not installed. Install them from the health page.', 'hpcsched'); + } + + return null; + } + + /** + * What creating or mapping a device would add, for the confirmation page + * (REQ-OBJ-006): the device, the data query, each graph, and the data + * sources, RRD files, and script server calls per poll they bring. + * + * @return list + */ + public function plan(Cluster $cluster, int $hostId, bool $partitionGraphs): array { + $lines = []; + + if ($hostId === 0) { + $lines[] = __('A device "%s" from the %s device template, polled by poller %d, with availability checks off.', $this->description($cluster), TemplateInstaller::DEVICE_TEMPLATE, $cluster->pollerId, 'hpcsched'); + } + + $partitions = $this->series->partitions($cluster->id); + + if ($hostId === 0 || !$this->objects->hasQuery($hostId, $this->objects->queryId())) { + $lines[] = __('The data query "%s", indexing the %d partitions known now.', TemplateInstaller::QUERY, count($partitions), 'hpcsched'); + } + + $sources = 0; + $calls = 0; + + foreach (TemplateInstaller::overview() as $name) { + if ($hostId === 0 || $this->objects->graphCount($hostId, $this->objects->graphTemplateId($name)) === 0) { + $sources++; + $calls += self::CLUSTER_CALLS; + } + } + + if ($sources > 0) { + $lines[] = __('%d cluster graphs, each with its own "%s" data source.', $sources, TemplateInstaller::CLUSTER, 'hpcsched'); + } + + $perPartition = 0; + + if ($partitionGraphs) { + foreach ($partitions as $partition) { + foreach (Series::groups() as $group => $values) { + if ($hostId === 0 || $this->objects->graphCount($hostId, $this->objects->graphTemplateId(TemplateInstaller::partitionGraphs()[$group]), $partition) === 0) { + $perPartition++; + $sources++; + $calls += count($values); + } + } + } + + $lines[] = __('%d partition graphs, %d for each partition, each with its own data source.', $perPartition, count(Series::groups()), 'hpcsched'); + } + + $lines[] = __('In all: %d data sources and %d RRD files, and %d script server calls per poll. Partitions added later get graphs from the New Graphs page.', $sources, $sources, $calls, 'hpcsched'); + + return $lines; + } + + /** + * Create a device for a cluster that has none and attach the plugin's + * objects. Returns the new device id, or 0 with the reason logged. + */ + public function create(Cluster $cluster, bool $partitionGraphs): int { + $templateId = $this->objects->deviceTemplateId(); + + if ($templateId === 0 || $cluster->hostId > 0) { + return 0; + } + + $this->includeCore(); + + $hostId = (int) api_device_save(0, $templateId, $this->description($cluster), $this->hostname($cluster), '', 0, '', '', 161, 500, '', AVAIL_NONE, 0, 23, 400, 1, + __('Created by the HPC Scheduler plugin for cluster %s. Its values come from the plugin snapshot; the host name is a reserved name that is never contacted.', $cluster->name, 'hpcsched'), + 'MD5', '', 'DES', '', '', 5, 1, $cluster->pollerId, 0); + + if ($hostId <= 0) { + Log::error(sprintf('Cacti refused the device for cluster %d', $cluster->id)); + + return 0; + } + + if (!$this->clusters->mapHost($cluster->id, $hostId)) { + Log::error(sprintf('Device %d was created for cluster %d but could not be mapped', $hostId, $cluster->id)); + + return 0; + } + + $this->attach($cluster->id, $hostId, $partitionGraphs); + + return $hostId; + } + + /** + * Map an existing device to a cluster and attach the plugin's objects. + * The device's own settings, poller included, are left alone. + */ + public function map(Cluster $cluster, int $hostId, bool $partitionGraphs): bool { + if ($this->objects->device($hostId) === null || !$this->clusters->mapHost($cluster->id, $hostId)) { + return false; + } + + $this->attach($cluster->id, $hostId, $partitionGraphs); + + return true; + } + + /** + * Add the data query and any missing graph. Safe to repeat: the query + * is indexed again, and a graph template that already has a graph on + * the device (for a partition, on that index) is skipped. + */ + public function attach(int $clusterId, int $hostId, bool $partitionGraphs): void { + $this->includeCore(); + + $queryId = $this->objects->queryId(); + + if ($queryId > 0) { + api_device_dq_add($hostId, $queryId, DATA_QUERY_AUTOINDEX_INDEX_NUM_CHANGE); + } + + foreach (TemplateInstaller::overview() as $name) { + $this->graph($clusterId, $hostId, $name); + } + + if ($partitionGraphs && $queryId > 0) { + foreach ($this->objects->indexes($hostId, $queryId) as $partition) { + foreach (TemplateInstaller::partitionGraphs() as $name) { + $this->graph($clusterId, $hostId, $name, $queryId, $partition); + } + } + } + + // Fills the cluster data sources' host_id input and the poller cache. + push_out_host($hostId, 0); + } + + /** + * Run Cacti's reindex when the device's partition indexes differ from + * the snapshot's, which Cacti's own index count check misses for a + * renamed partition (ADR 0011). Returns whether a reindex ran. + */ + public function reindexIfChanged(Cluster $cluster): bool { + $queryId = $this->objects->queryId(); + + if ($cluster->hostId === 0 || $queryId === 0 || !$this->objects->hasQuery($cluster->hostId, $queryId)) { + return false; + } + + if ($this->objects->indexes($cluster->hostId, $queryId) === $this->series->partitions($cluster->id)) { + return false; + } + + $this->reindex($cluster->hostId); + + return true; + } + + public function reindex(int $hostId): void { + $queryId = $this->objects->queryId(); + + if ($hostId > 0 && $queryId > 0) { + $this->includeCore(); + run_data_query($hostId, $queryId); + } + } + + public function description(Cluster $cluster): string { + return 'HPC cluster ' . $cluster->name; + } + + /** + * A name in the reserved .invalid domain (RFC 6761), so no lookup or + * availability check of the device can reach a real host. Cluster names + * are validated against Cluster::NAME_PATTERN before they are stored. + */ + public function hostname(Cluster $cluster): string { + return strtolower($cluster->name) . '.hpcsched.invalid'; + } + + private function graph(int $clusterId, int $hostId, string $name, int $queryId = 0, string $partition = ''): void { + $templateId = $this->objects->graphTemplateId($name); + + if ($templateId === 0 || $this->objects->graphCount($hostId, $templateId, $partition) > 0) { + return; + } + + $query = []; + + if ($partition !== '') { + $query = ['snmp_query_id' => $queryId, 'snmp_index_on' => 'hpcPartition', 'snmp_query_graph_id' => $this->objects->queryGraphId($queryId, $templateId), 'snmp_index' => $partition]; + } + + $suggested = []; + $created = create_complete_graph_from_template($templateId, $hostId, $query, $suggested); + + if (!is_array($created) || !is_numeric($created['local_graph_id'] ?? null)) { + Log::error(sprintf('Cacti did not create the %s graph for cluster %d', $name, $clusterId)); + } + } + + private function includeCore(): void { + include_once($this->cactiPath . '/lib/api_automation_tools.php'); + include_once($this->cactiPath . '/lib/api_data_source.php'); + include_once($this->cactiPath . '/lib/api_graph.php'); + include_once($this->cactiPath . '/lib/api_tree.php'); + include_once($this->cactiPath . '/lib/api_device.php'); + include_once($this->cactiPath . '/lib/data_query.php'); + include_once($this->cactiPath . '/lib/template.php'); + include_once($this->cactiPath . '/lib/utility.php'); + include_once($this->cactiPath . '/lib/poller.php'); + } +} diff --git a/lib/HealthPage.php b/lib/HealthPage.php index cd78cd5..5265fcc 100644 --- a/lib/HealthPage.php +++ b/lib/HealthPage.php @@ -35,6 +35,8 @@ public function __construct( private readonly FreshnessEvaluator $evaluator, private readonly Clock $clock, private readonly int $pollerInterval, + private readonly DeviceAccess $access, + private readonly TemplateInstaller $templates, ) { } @@ -42,7 +44,7 @@ public function render(): void { $now = $this->clock->now(); $runs = $this->runs->all(); $sections = $this->view->sections(); - $clusters = $this->clusters->all(); + $clusters = $this->access->clusters($this->clusters->all()); html_start_box(__('Clusters', 'hpcsched'), '100%', '', '3', 'center', ''); print Format::header([__('Cluster', 'hpcsched'), __('State', 'hpcsched'), __('Freshness', 'hpcsched'), __('Last Run', 'hpcsched'), __('Outcome', 'hpcsched'), __('Duration', 'hpcsched'), __('Calls', 'hpcsched'), __('Slurm', 'hpcsched'), __('Transport', 'hpcsched'), __('Parser', 'hpcsched'), __('Last Success', 'hpcsched')]); @@ -57,6 +59,10 @@ public function render(): void { $warnings[] = [__('All clusters', 'hpcsched'), $warning]; } + foreach ($this->templateProblems() as $warning) { + $warnings[] = [__('All clusters', 'hpcsched'), $warning]; + } + foreach ($clusters as $cluster) { $run = $runs[$cluster->id] ?? null; $values = ClusterValues::of($cluster, $sections[$cluster->id] ?? [], [], [], $this->evaluator, $this->pollerInterval); @@ -95,6 +101,12 @@ public function render(): void { html_end_box(); + html_start_box(__('Templates', 'hpcsched'), '100%', '', '3', 'center', ''); + print '' . html_escape($this->templates->isCurrent() ? __('The device, data, and graph templates and the partition data query are installed.', 'hpcsched') : __('The templates are not installed or not current, so cluster devices cannot be created. See the warnings above.', 'hpcsched')) . '' + . '
' + . '
'; + html_end_box(); + html_start_box(__('Snapshot Sections', 'hpcsched'), '100%', '', '3', 'center', ''); print Format::header([__('Cluster', 'hpcsched'), __('Section', 'hpcsched'), __('Last Attempt', 'hpcsched'), __('State', 'hpcsched'), __('Error', 'hpcsched'), __('Records', 'hpcsched'), __('Data Age', 'hpcsched'), __('Freshness', 'hpcsched')]); @@ -117,4 +129,27 @@ public function render(): void { html_end_box(); } + + /** + * @return list + */ + private function templateProblems(): array { + $problems = []; + + if ($this->templates->failure() !== '') { + $problems[] = __('The last template install failed: %s', $this->templates->failure(), 'hpcsched'); + } + + if (!$this->templates->present()) { + $problems[] = __('Some HPC Scheduler templates are missing from Cacti. Install them below.', 'hpcsched'); + } + + $file = $this->templates->queryFileProblem(); + + if ($file !== null) { + $problems[] = $file; + } + + return $problems; + } } diff --git a/lib/OverviewPage.php b/lib/OverviewPage.php index aecd39e..a6f6e87 100644 --- a/lib/OverviewPage.php +++ b/lib/OverviewPage.php @@ -17,20 +17,34 @@ * more details. */ + namespace Somethingwithproof\Hpcsched; /** * HPC Scheduler (HPC Scheduler View realm): cluster-level counts and their - * freshness. A value the plugin cannot vouch for shows as a dash, never as - * zero. No job, user, or account appears (REQ-UI-004). + * freshness, and per cluster the pending reasons view. A value the plugin + * cannot vouch for shows as a dash, never as zero. No job, user, or account + * appears (REQ-UI-004, REQ-REASON-006). Clusters on a device the user may + * not see are left out (DeviceAccess). */ final class OverviewPage { + public const FILE = 'hpcsched.php'; + + /** Rows the reasons view lists at most per table (REQ-REASON-004). */ + public const ROW_LIMIT = 200; + + /** + * @param bool $admin whether the user also has the Admin realm, which + * adds node names to the reasons view + */ public function __construct( private readonly ClusterRepository $clusters, private readonly ViewRepository $view, private readonly FreshnessEvaluator $evaluator, private readonly Clock $clock, private readonly int $pollerInterval, + private readonly DeviceAccess $access, + private readonly bool $admin = false, ) { } @@ -39,19 +53,25 @@ public function render(): void { $sections = $this->view->sections(); $jobs = $this->view->jobStates(); $nodes = $this->view->nodeStates(); - $clusters = array_values(array_filter($this->clusters->all(), static fn (Cluster $c): bool => $c->enabled())); + $clusters = array_values(array_filter($this->access->clusters($this->clusters->all()), static fn (Cluster $c): bool => $c->enabled())); html_start_box(__('HPC Scheduler', 'hpcsched'), '100%', '', '3', 'center', ''); - print Format::header([__('Cluster', 'hpcsched'), __('Freshness', 'hpcsched'), __('Collected', 'hpcsched'), __('Running', 'hpcsched'), __('Pending', 'hpcsched'), __('Held', 'hpcsched'), __('Nodes', 'hpcsched'), __('Down', 'hpcsched'), __('Drained', 'hpcsched'), __('Idle', 'hpcsched')]); + print Format::header([__('Cluster', 'hpcsched'), __('Freshness', 'hpcsched'), __('Collected', 'hpcsched'), __('Running', 'hpcsched'), __('Pending', 'hpcsched'), __('Held', 'hpcsched'), __('Nodes', 'hpcsched'), __('Down', 'hpcsched'), __('Drained', 'hpcsched'), __('Idle', 'hpcsched'), __('Details', 'hpcsched')]); if ($clusters === []) { - print '' . html_escape(__('No clusters are collected yet.', 'hpcsched')) . ''; + print '' . html_escape(__('No clusters are collected yet.', 'hpcsched')) . ''; } foreach ($clusters as $cluster) { - $v = ClusterValues::of($cluster, $sections[$cluster->id] ?? [], $jobs[$cluster->id] ?? [], $nodes[$cluster->id] ?? [], $this->evaluator, $this->pollerInterval); + $v = ClusterValues::of($cluster, $sections[$cluster->id] ?? [], $jobs[$cluster->id] ?? [], $nodes[$cluster->id] ?? [], $this->evaluator, $this->pollerInterval); + $links = '' . html_escape(__('Pending reasons', 'hpcsched')) . ''; + + // Cacti decides which of the device's graphs the user sees. + if ($cluster->hostId > 0) { + $links .= ' ' . html_escape(__('Graphs', 'hpcsched')) . ''; + } - print Format::row([ + print '' . substr(Format::row([ $cluster->name, $v->freshness->label(), $v->age === null ? __('Never', 'hpcsched') : Format::age($now - $v->age, $now), @@ -62,11 +82,70 @@ public function render(): void { Format::count($v->values['nodes_down']), Format::count($v->values['nodes_drained']), Format::count($v->values['nodes_idle']), - ]); + ]), strlen(''), -strlen('')) . '' . $links . ''; } html_end_box(); print '

' . html_escape(__('A dash means the plugin has no current data for that value: the section failed, is stale, or was never collected. Pending excludes held jobs. Drained counts every node with the drain flag, including nodes that are also down.', 'hpcsched')) . '

'; } + + /** + * The raw pending reasons of one cluster with job counts and the + * partitions they affect, and nodes in states the plugin does not know + * (REQ-REASON-003 to REQ-REASON-005, REQ-NODEAGG-002). The caller has + * checked DeviceAccess for the cluster. + */ + public function renderReasons(Cluster $cluster): void { + $now = $this->clock->now(); + $record = $this->view->sections()[$cluster->id][Section::Jobs->value] ?? null; + $usable = ClusterValues::usable($cluster, $this->view->sections()[$cluster->id] ?? [], Section::Jobs, $this->evaluator, $this->pollerInterval); + $listed = $this->view->reasons($cluster->id, self::ROW_LIMIT); + $unknown = $this->view->otherNodes($cluster->id, self::ROW_LIMIT); + + html_start_box(__('Pending Reasons: %s', html_escape($cluster->name), 'hpcsched'), '100%', '', '3', 'center', ''); + + $observed = $record->observedAt ?? 0; + + print '' . html_escape($observed > 0 + ? __('Jobs snapshot taken %s (%s), %s.', date('Y-m-d H:i:s', $observed), Format::age($observed, $now), $usable ? __('current', 'hpcsched') : __('stale: the counts below are the last ones collected', 'hpcsched'), 'hpcsched') + : __('No jobs snapshot has been collected yet.', 'hpcsched')) . ''; + + print Format::header([__('Reason', 'hpcsched'), __('Family', 'hpcsched'), __('Jobs', 'hpcsched'), __('Partitions', 'hpcsched')]); + + if ($listed['reasons'] === []) { + print '' . html_escape(__('No pending jobs.', 'hpcsched')) . ''; + } + + foreach ($listed['reasons'] as $entry) { + print Format::row([$entry['name'], ReasonFamily::of($entry['name'])->label(), number_format($entry['jobs']), implode(', ', $entry['partitions'])]); + } + + if ($listed['more']) { + print '' . html_escape(__('Only the %d reasons with the most jobs are listed.', self::ROW_LIMIT, 'hpcsched')) . ''; + } + + html_end_box(); + + print '

' . html_escape(__('Each job counts under the last reason the scheduler examined for it, which need not be the only thing holding it back. A job in several partitions counts once here and once in each partition it names. Held jobs are listed with their hold reason.', 'hpcsched')) . '

'; + + html_start_box(__('Nodes in Unknown States', 'hpcsched'), '100%', '', '3', 'center', ''); + print Format::header($this->admin ? [__('Slurm State', 'hpcsched'), __('Nodes', 'hpcsched'), __('Names', 'hpcsched')] : [__('Slurm State', 'hpcsched'), __('Nodes', 'hpcsched')]); + + if ($unknown === []) { + print '' . html_escape(__('None. Every node maps to a known state.', 'hpcsched')) . ''; + } + + foreach ($unknown as $entry) { + $cells = [$entry['state'], number_format($entry['nodes'])]; + + if ($this->admin) { + $cells[] = implode(', ', $entry['names']); + } + + print Format::row($cells); + } + + html_end_box(); + } } diff --git a/lib/Schema.php b/lib/Schema.php index 5a6798a..c6b36ff 100644 --- a/lib/Schema.php +++ b/lib/Schema.php @@ -42,6 +42,7 @@ final class Schema { 'config_settings' => 'hpcsched_config_settings', 'draw_navigation_text' => 'hpcsched_draw_navigation_text', 'poller_bottom' => 'hpcsched_poller_bottom', + 'device_remove' => 'hpcsched_device_remove', ]; private const PLUGIN = 'hpcsched'; diff --git a/lib/ViewRepository.php b/lib/ViewRepository.php index af90fb8..5e55545 100644 --- a/lib/ViewRepository.php +++ b/lib/ViewRepository.php @@ -21,7 +21,7 @@ /** * Read-only queries the pages use. Counts only: no page in this release - * shows a job, user, or account (REQ-UI-004). + * shows a job, user, or account (REQ-UI-004, REQ-REASON-006). */ final class ViewRepository { public function __construct(private readonly \PDO|false $connection) { @@ -77,4 +77,58 @@ public function nodeStates(): array { return $out; } + + /** + * Raw pending reasons of a cluster with their job counts, most jobs + * first, at most $limit of them, and the partitions each affects. + * + * @return array{reasons: list}>, more: bool} + */ + public function reasons(int $clusterId, int $limit): array { + $rows = Row::rows(db_fetch_assoc_prepared("SELECT name, jobs FROM plugin_hpcsched_job_count WHERE cluster_id = ? AND kind = 'reason' AND partition_name = '' ORDER BY jobs DESC, name LIMIT " . ($limit + 1), [$clusterId], true, $this->connection)); + $more = count($rows) > $limit; + $out = []; + + foreach (array_slice($rows, 0, $limit) as $row) { + $out['r:' . Row::string($row, 'name')] = ['name' => Row::string($row, 'name'), 'jobs' => Row::int($row, 'jobs', 0, 0), 'partitions' => []]; + } + + if ($out !== []) { + $names = array_map(static fn (array $r): string => $r['name'], array_values($out)); + + foreach (Row::rows(db_fetch_assoc_prepared("SELECT name, partition_name FROM plugin_hpcsched_job_count WHERE cluster_id = ? AND kind = 'reason' AND partition_name <> '' AND name IN (" . implode(', ', array_fill(0, count($names), '?')) . ') ORDER BY partition_name', array_merge([$clusterId], $names), true, $this->connection)) as $row) { + $key = 'r:' . Row::string($row, 'name'); + + if (isset($out[$key])) { + $out[$key]['partitions'][] = Row::string($row, 'partition_name'); + } + } + } + + return ['reasons' => array_values($out), 'more' => $more]; + } + + /** + * Nodes in a state the plugin does not know (normalized Other), grouped + * by the raw state Slurm reported (REQ-NODEAGG-002). + * + * @return list}> + */ + public function otherNodes(int $clusterId, int $limit): array { + $out = []; + + foreach (Row::rows(db_fetch_assoc_prepared("SELECT raw_state, COUNT(*) AS nodes FROM plugin_hpcsched_node WHERE cluster_id = ? AND state = 'other' GROUP BY raw_state ORDER BY nodes DESC, raw_state LIMIT " . $limit, [$clusterId], true, $this->connection)) as $row) { + $out['s:' . Row::string($row, 'raw_state')] = ['state' => Row::string($row, 'raw_state'), 'nodes' => Row::int($row, 'nodes', 0, 0), 'names' => []]; + } + + foreach (Row::rows(db_fetch_assoc_prepared("SELECT name, raw_state FROM plugin_hpcsched_node WHERE cluster_id = ? AND state = 'other' ORDER BY name LIMIT " . $limit, [$clusterId], true, $this->connection)) as $row) { + $key = 's:' . Row::string($row, 'raw_state'); + + if (isset($out[$key])) { + $out[$key]['names'][] = Row::string($row, 'name'); + } + } + + return array_values($out); + } } diff --git a/locales/po/cacti.pot b/locales/po/cacti.pot index 21fc31b..802d63a 100644 --- a/locales/po/cacti.pot +++ b/locales/po/cacti.pot @@ -16,6 +16,10 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: hpcsched_clusters.php +msgid "You do not have permission for the device of that cluster." +msgstr "" + #: hpcsched_clusters.php msgid "Name: another cluster already uses this name." msgstr "" @@ -29,7 +33,44 @@ msgid "The cluster was saved." msgstr "" #: hpcsched_clusters.php -msgid "The cluster and its cached snapshot were deleted. The scheduler was not contacted." +msgid "The cluster and its cached snapshot were deleted. Its device and graphs were kept. The scheduler was not contacted." +msgstr "" + +#: hpcsched_clusters.php +msgid "The device and its graphs were created." +msgstr "" + +#: hpcsched_clusters.php +msgid "The device was not created. See the Cacti log." +msgstr "" + +#: hpcsched_clusters.php +msgid "The cluster was mapped to the device." +msgstr "" + +#: hpcsched_clusters.php +msgid "The cluster was not mapped: the device does not exist, is not allowed to you, or already carries another cluster." +msgstr "" + +#: hpcsched_clusters.php +msgid "Missing graphs were added." +msgstr "" + +#: hpcsched_clusters.php +msgid "The cluster was unmapped. The device and its graphs were kept." +msgstr "" + +#: hpcsched_clusters.php +msgid "The partitions were reindexed from the snapshot." +msgstr "" + +#: hpcsched_health.php +msgid "The HPC Scheduler templates are installed." +msgstr "" + +#: hpcsched_health.php +#, php-format +msgid "The templates were not installed: %s" msgstr "" #: lib/ClusterInput.php @@ -86,6 +127,10 @@ msgstr "" msgid "Actions" msgstr "" +#: lib/ClustersPage.php +msgid "Device" +msgstr "" + #: lib/ClustersPage.php msgid "Interval" msgstr "" @@ -132,6 +177,10 @@ msgstr "" msgid "%d seconds" msgstr "" +#: lib/ClustersPage.php +msgid "None" +msgstr "" + #: lib/ClustersPage.php msgid "Delete" msgstr "" @@ -193,6 +242,94 @@ msgstr "" msgid "Save" msgstr "" +#: lib/ClustersPage.php +#, php-format +msgid "Device for Cluster: %s" +msgstr "" + +#: lib/ClustersPage.php +#, php-format +msgid "Mapped to device %s (id %d). Its graphs follow Cacti's device and graph permissions." +msgstr "" + +#: lib/ClustersPage.php +msgid "Adding the missing graphs adds:" +msgstr "" + +#: lib/ClustersPage.php +msgid "Add Missing Graphs" +msgstr "" + +#: lib/ClustersPage.php +msgid "Reindex Partitions" +msgstr "" + +#: lib/ClustersPage.php +msgid "Unmap" +msgstr "" + +#: lib/ClustersPage.php +msgid "Unmapping keeps the device, its graphs, and their history." +msgstr "" + +#: lib/ClustersPage.php +msgid "Creating a device adds:" +msgstr "" + +#: lib/ClustersPage.php +msgid "Without partition graphs, only the cluster graphs are created, and the data sources and calls for the partitions above are left out." +msgstr "" + +#: lib/ClustersPage.php +msgid "Also create the partition graphs" +msgstr "" + +#: lib/ClustersPage.php +msgid "Create Device" +msgstr "" + +#: lib/ClustersPage.php +msgid "Or map an existing device" +msgstr "" + +#: lib/ClustersPage.php +msgid "Map Device" +msgstr "" + +#: lib/DeviceProvisioner.php +msgid "The HPC Scheduler templates are not installed. Install them from the health page." +msgstr "" + +#: lib/DeviceProvisioner.php +#, php-format +msgid "A device \"%s\" from the %s device template, polled by poller %d, with availability checks off." +msgstr "" + +#: lib/DeviceProvisioner.php +#, php-format +msgid "The data query \"%s\", indexing the %d partitions known now." +msgstr "" + +#: lib/DeviceProvisioner.php +#, php-format +msgid "%d cluster graphs, each with its own \"%s\" data source." +msgstr "" + +#: lib/DeviceProvisioner.php +#, php-format +msgid "%d partition graphs, %d for each partition, each with its own data source." +msgstr "" + +#: lib/DeviceProvisioner.php +#, php-format +msgid "In all: %d data sources and %d RRD files, and %d script server calls per poll. Partitions added later get graphs from the New Graphs page." +msgstr "" + +#: lib/DeviceProvisioner.php +#, php-format +msgid "Created by the HPC Scheduler plugin for cluster %s. Its values come from the plugin snapshot; the host name is a reserved name that is never contacted." +msgstr "" + #: lib/ErrorClass.php msgid "configuration: a path, URL, or setting is missing or not allowed" msgstr "" @@ -337,6 +474,22 @@ msgstr "" msgid "No warnings." msgstr "" +#: lib/HealthPage.php +msgid "Templates" +msgstr "" + +#: lib/HealthPage.php +msgid "The device, data, and graph templates and the partition data query are installed." +msgstr "" + +#: lib/HealthPage.php +msgid "The templates are not installed or not current, so cluster devices cannot be created. See the warnings above." +msgstr "" + +#: lib/HealthPage.php +msgid "Install Templates" +msgstr "" + #: lib/HealthPage.php msgid "Snapshot Sections" msgstr "" @@ -361,6 +514,15 @@ msgstr "" msgid "Section" msgstr "" +#: lib/HealthPage.php +#, php-format +msgid "The last template install failed: %s" +msgstr "" + +#: lib/HealthPage.php +msgid "Some HPC Scheduler templates are missing from Cacti. Install them below." +msgstr "" + #: lib/HealthWarnings.php #, php-format msgid "Maximum Answer Size is %d MiB, but a decoded answer of that size does not fit in the Collection Memory of %d MiB; the reader allows %d MiB. Raise Collection Memory or lower Maximum Answer Size in Settings." @@ -501,6 +663,10 @@ msgstr "" msgid "Collected" msgstr "" +#: lib/OverviewPage.php +msgid "Details" +msgstr "" + #: lib/OverviewPage.php lib/Section.php msgid "Nodes" msgstr "" @@ -509,10 +675,85 @@ msgstr "" msgid "No clusters are collected yet." msgstr "" +#: lib/OverviewPage.php +msgid "Pending reasons" +msgstr "" + +#: lib/OverviewPage.php +msgid "Graphs" +msgstr "" + #: lib/OverviewPage.php msgid "A dash means the plugin has no current data for that value: the section failed, is stale, or was never collected. Pending excludes held jobs. Drained counts every node with the drain flag, including nodes that are also down." msgstr "" +#: lib/OverviewPage.php +#, php-format +msgid "Pending Reasons: %s" +msgstr "" + +#: lib/OverviewPage.php +#, php-format +msgid "Jobs snapshot taken %s (%s), %s." +msgstr "" + +#: lib/OverviewPage.php +msgid "current" +msgstr "" + +#: lib/OverviewPage.php +msgid "stale: the counts below are the last ones collected" +msgstr "" + +#: lib/OverviewPage.php +msgid "No jobs snapshot has been collected yet." +msgstr "" + +#: lib/OverviewPage.php +msgid "Family" +msgstr "" + +#: lib/OverviewPage.php lib/Section.php +msgid "Jobs" +msgstr "" + +#: lib/OverviewPage.php lib/Section.php +msgid "Partitions" +msgstr "" + +#: lib/OverviewPage.php +msgid "Reason" +msgstr "" + +#: lib/OverviewPage.php +msgid "No pending jobs." +msgstr "" + +#: lib/OverviewPage.php +#, php-format +msgid "Only the %d reasons with the most jobs are listed." +msgstr "" + +#: lib/OverviewPage.php +msgid "Each job counts under the last reason the scheduler examined for it, which need not be the only thing holding it back. A job in several partitions counts once here and once in each partition it names. Held jobs are listed with their hold reason." +msgstr "" + +#: lib/OverviewPage.php +msgid "Nodes in Unknown States" +msgstr "" + +#: lib/OverviewPage.php +msgid "Names" +msgstr "" + +#: lib/OverviewPage.php +msgid "Slurm State" +msgstr "" + +#: lib/OverviewPage.php +msgid "None. Every node maps to a known state." +msgstr "" + #: lib/Pages.php msgid "HPC Scheduler View" msgstr "" @@ -561,14 +802,6 @@ msgstr "" msgid "Node availability" msgstr "" -#: lib/Section.php -msgid "Jobs" -msgstr "" - -#: lib/Section.php -msgid "Partitions" -msgstr "" - #: lib/Section.php msgid "Reservations" msgstr "" @@ -697,6 +930,16 @@ msgstr "" msgid "When checked, uninstalling the plugin keeps its clusters and snapshots. Clear it to have the uninstall drop them; export the clusters first from HPC Clusters. The plugin creates no Cacti devices or Maint schedules in this release, and the scheduler is never contacted either way." msgstr "" +#: lib/TemplateInstaller.php +#, php-format +msgid "The data query file %s is not installed in Cacti's resource/script_server directory." +msgstr "" + +#: lib/TemplateInstaller.php +#, php-format +msgid "The data query file %s in Cacti's resource/script_server directory differs from the one the plugin ships." +msgstr "" + #: lib/TokenState.php msgid "readable only by the poller user" msgstr "" diff --git a/poller_hpcsched.php b/poller_hpcsched.php index 8ae7a9e..e413fb4 100644 --- a/poller_hpcsched.php +++ b/poller_hpcsched.php @@ -139,6 +139,12 @@ unregister_process('hpcsched', 'reader', $hpcsched_cluster); } +// A partition added, removed, or renamed reaches the cluster device through +// Cacti's reindex; its index count check alone misses a rename (ADR 0011). +if ($hpcsched_row->hostId > 0 && $hpcsched_run->outcome !== \Somethingwithproof\Hpcsched\RunOutcome::Failed && hpcsched_provisioner()->reindexIfChanged($hpcsched_row)) { + cacti_log('NOTE: The partitions of cluster ' . $hpcsched_cluster . ' changed; its device was reindexed', false, 'HPCSCHED', POLLER_VERBOSITY_MEDIUM); +} + cacti_log(sprintf('STATS: Cluster:%d Outcome:%s Calls:%d Time:%.2f', $hpcsched_cluster, $hpcsched_run->outcome->value, $hpcsched_run->calls, (float) $hpcsched_run->duration), false, 'HPCSCHED', POLLER_VERBOSITY_MEDIUM); exit(0); diff --git a/setup.php b/setup.php index 53c409e..e5aad46 100644 --- a/setup.php +++ b/setup.php @@ -160,10 +160,15 @@ function plugin_hpcsched_upgrade(bool $grant = false): bool { return false; } - $info = plugin_hpcsched_version(); - $schema = new \Somethingwithproof\Hpcsched\Schema(false); + $info = plugin_hpcsched_version(); + $schema = new \Somethingwithproof\Hpcsched\Schema(false); + $templates = hpcsched_template_installer(); + + // A template install that failed for this template version is retried + // only from the Plugins page or the health page, not on every request. + $templatesSettled = $templates->isCurrent() || ($templates->failure() !== '' && !$grant); - if ($schema->isCurrent() && $schema->recordedPluginVersion() === $info['version'] && $schema->hooksRegistered()) { + if ($schema->isCurrent() && $schema->recordedPluginVersion() === $info['version'] && $schema->hooksRegistered() && $templatesSettled) { return true; } @@ -175,6 +180,12 @@ function plugin_hpcsched_upgrade(bool $grant = false): bool { hpcsched_setup_hooks($grant); + // A missing template only stops device provisioning, which the health + // page reports; the plugin's pages and reader still work. + if (!$templates->isCurrent() && ($grant || $templates->failure() === '')) { + $templates->install(); + } + $schema->recordPluginVersion($info['version'], $info['author'], $info['homepage']); return true; @@ -222,11 +233,12 @@ function hpcsched_uninstall_stop(): void { } /** - * Uninstall never contacts a scheduler (REQ-LIFE-004). This release creates - * no Cacti device, data source, graph, or Maint schedule, so there is - * nothing of core's to remove. Core drops the tracked plugin tables - * afterwards unless the administrator left "Keep Plugin Tables on - * Uninstall" checked, which is the default. + * Uninstall never contacts a scheduler (REQ-LIFE-004). It removes only the + * data query file the plugin wrote and nobody changed; the templates, + * cluster devices, data sources, and graphs stay, because they are the + * site's once created. Core drops the tracked plugin tables afterwards + * unless the administrator left "Keep Plugin Tables on Uninstall" checked, + * which is the default. */ function plugin_hpcsched_uninstall(): void { if (!hpcsched_boot()) { @@ -238,6 +250,8 @@ function plugin_hpcsched_uninstall(): void { $schema = new \Somethingwithproof\Hpcsched\Schema(false); + hpcsched_template_installer()->uninstall(); + if (hpcsched_settings()->keepTablesOnUninstall) { if (!$schema->untrackTables()) { hpcsched_uninstall_stop(); @@ -357,6 +371,68 @@ function hpcsched_due_clusters(int $poller_id): array { ))->due($poller_id, hpcsched_poller_interval()); } +function hpcsched_template_installer(): \Somethingwithproof\Hpcsched\TemplateInstaller { + global $config; + + return new \Somethingwithproof\Hpcsched\TemplateInstaller(__DIR__, $config['base_path'], new \Somethingwithproof\Hpcsched\CactiObjectRepository(false)); +} + +function hpcsched_provisioner(): \Somethingwithproof\Hpcsched\DeviceProvisioner { + global $config; + + return new \Somethingwithproof\Hpcsched\DeviceProvisioner( + new \Somethingwithproof\Hpcsched\ClusterRepository(false, new \Somethingwithproof\Hpcsched\SystemClock()), + new \Somethingwithproof\Hpcsched\SeriesRepository(false), + new \Somethingwithproof\Hpcsched\CactiObjectRepository(false), + $config['base_path'] + ); +} + +/** + * Cacti's device permission for the user of this request. + */ +function hpcsched_device_access(): \Somethingwithproof\Hpcsched\DeviceAccess { + $objects = new \Somethingwithproof\Hpcsched\CactiObjectRepository(false); + + return new \Somethingwithproof\Hpcsched\DeviceAccess( + function (int $host_id): bool { + return is_device_allowed($host_id) === true; + }, + function (int $host_id) use ($objects): bool { + return $objects->device($host_id) !== null; + } + ); +} + +/** + * device_remove hook: a deleted device no longer carries a cluster. The + * cluster and its snapshot stay, and other devices are untouched. + * + * @param mixed $host_ids + * @return mixed + */ +function hpcsched_device_remove($host_ids) { + if (!hpcsched_boot()) { + return $host_ids; + } + + $ids = array(); + + foreach (is_array($host_ids) ? $host_ids : array($host_ids) as $id) { + if (is_numeric($id) && (int) $id > 0) { + $ids[] = (int) $id; + } + } + + $count = (new \Somethingwithproof\Hpcsched\ClusterRepository(false, new \Somethingwithproof\Hpcsched\SystemClock()))->unmapHosts($ids); + + if ($count > 0) { + \Somethingwithproof\Hpcsched\Log::info(sprintf('%d clusters lost their device when it was deleted; they can be given a device again from HPC Clusters', $count)); + } + + return $host_ids; +} + /** * The answerer behind scripts/ss_hpcsched_cluster.php and * scripts/ss_hpcsched_partitions.php. diff --git a/tests/Integration/LifecycleTest.php b/tests/Integration/LifecycleTest.php index 6096dad..28d15d7 100644 --- a/tests/Integration/LifecycleTest.php +++ b/tests/Integration/LifecycleTest.php @@ -27,6 +27,7 @@ 'plugin_hpcsched_cluster', 'plugin_hpcsched_job_count', 'plugin_hpcsched_node', + 'plugin_hpcsched_node_count', 'plugin_hpcsched_partition', 'plugin_hpcsched_reservation', 'plugin_hpcsched_run', @@ -34,7 +35,7 @@ 'plugin_hpcsched_share', ]; -const HPCSCHED_HOOKS = ['config_arrays', 'config_settings', 'draw_navigation_text', 'poller_bottom']; +const HPCSCHED_HOOKS = ['config_arrays', 'config_settings', 'device_remove', 'draw_navigation_text', 'poller_bottom']; const HPCSCHED_T = 1800000000; @@ -51,7 +52,7 @@ expect($state['plugin']['status'])->toEqual('4') ->and($state['plugin']['version'])->toEqual(HPCSCHED_VERSION) - ->and($state['schema'])->toEqual('1') + ->and($state['schema'])->toEqual('2') ->and(array_keys($state['tables']))->toBe(HPCSCHED_TABLES) ->and($state['tracked'])->toBe(HPCSCHED_TABLES) ->and(array_keys($state['hooks']))->toBe(HPCSCHED_HOOKS) @@ -122,7 +123,7 @@ expect($state['result'])->toBeTrue() ->and(array_keys($state['tables']))->toBe(HPCSCHED_TABLES) ->and($state['tables']['plugin_hpcsched_cluster'])->toBe(1) - ->and($state['schema'])->toEqual('1') + ->and($state['schema'])->toEqual('2') ->and($state['plugin']['version'])->toEqual(HPCSCHED_VERSION); }); @@ -134,7 +135,45 @@ expect($stopped['result'])->toBeTrue() ->and($stopped['schema'])->toEqual('0'); - expect(lifecycle('upgrade')['schema'])->toEqual('1'); + expect(lifecycle('upgrade')['schema'])->toEqual('2'); +}); + +it('upgrades a schema 1 install, adding the device column and the node counts, keeping its clusters', function () { + lifecycle('install'); + lifecycle('seed'); + lifecycle('make_schema_1'); + lifecycle('set_schema', '1'); + lifecycle('set_version', '0.0'); + + expect(lifecycle('state')['columns'])->not->toContain('host_id'); + + $state = lifecycle('upgrade'); + + expect($state['result'])->toBeTrue() + ->and($state['schema'])->toEqual('2') + ->and(array_keys($state['tables']))->toBe(HPCSCHED_TABLES) + ->and($state['tracked'])->toBe(HPCSCHED_TABLES) + ->and($state['tables']['plugin_hpcsched_cluster'])->toBe(1) + ->and($state['columns'])->toContain('host_id'); +}); + +it('imports the templates and the query file on install, and a reinstall creates no Cacti object (REQ-OBJ-001)', function () { + $first = lifecycle('install'); + + expect($first['templates_current'])->toBeTrue() + ->and($first['query_file'])->toBeTrue(); + + $uninstalled = lifecycle('uninstall'); + + // The query file the plugin wrote goes; the templates are the site's. + expect($uninstalled['query_file'])->toBeFalse() + ->and($uninstalled['templates'])->toBe($first['templates']); + + $again = lifecycle('install'); + + expect($again['templates_current'])->toBeTrue() + ->and($again['templates'])->toBe($first['templates']) + ->and(lifecycle('upgrade')['templates'])->toBe($first['templates']); }); it('refuses a schema newer than the code and leaves the recorded version alone', function () { diff --git a/tests/Unit/PagesTest.php b/tests/Unit/PagesTest.php index 9cc8662..2eb0676 100644 --- a/tests/Unit/PagesTest.php +++ b/tests/Unit/PagesTest.php @@ -18,6 +18,11 @@ */ use Somethingwithproof\Hpcsched\AdminState; +use Somethingwithproof\Hpcsched\CactiObjectRepository; +use Somethingwithproof\Hpcsched\DeviceAccess; +use Somethingwithproof\Hpcsched\DeviceProvisioner; +use Somethingwithproof\Hpcsched\SeriesRepository; +use Somethingwithproof\Hpcsched\TemplateInstaller; use Somethingwithproof\Hpcsched\Cluster; use Somethingwithproof\Hpcsched\ClusterInput; use Somethingwithproof\Hpcsched\ClusterRepository; @@ -51,6 +56,19 @@ $GLOBALS['__hpcsched_db_rows'] = []; }); +/** + * Cacti's device permission, allowing only the listed devices. + */ +function hpcsched_access(int ...$allowed): DeviceAccess { + return new DeviceAccess(static fn (int $id): bool => in_array($id, $allowed, true)); +} + +function hpcsched_clusters_page(FixedClock $clock, ?DeviceAccess $access = null): ClustersPage { + $clusters = new ClusterRepository(false, $clock); + + return new ClustersPage($clusters, new PollerRepository(false), $access ?? hpcsched_access(), new CactiObjectRepository(false), new DeviceProvisioner($clusters, new SeriesRepository(false), new CactiObjectRepository(false), '/nonexistent')); +} + function hpcsched_render(callable $render): string { ob_start(); $render(); @@ -60,7 +78,7 @@ function hpcsched_render(callable $render): string { it('escapes every stored string the health page prints, and shows the token warning', function () { $clock = new FixedClock(100000); - $html = hpcsched_render(fn () => (new HealthPage(new ClusterRepository(false, $clock), new RunRepository(false, $clock), new ViewRepository(false), Settings::fromRow([]), new FreshnessEvaluator($clock), $clock, 60))->render()); + $html = hpcsched_render(fn () => (new HealthPage(new ClusterRepository(false, $clock), new RunRepository(false, $clock), new ViewRepository(false), Settings::fromRow([]), new FreshnessEvaluator($clock), $clock, 60, hpcsched_access(), new TemplateInstaller('/nonexistent', '/nonexistent', new CactiObjectRepository(false))))->render()); expect($html)->not->toContain('