diff --git a/.github/workflows/plugin-ci-workflow.yml b/.github/workflows/plugin-ci-workflow.yml index 9bf3f86..a8fd20d 100644 --- a/.github/workflows/plugin-ci-workflow.yml +++ b/.github/workflows/plugin-ci-workflow.yml @@ -63,7 +63,7 @@ jobs: run: | set -euo pipefail php -v - for f in *.php include/*.php locales/*.php tests/bin/*.php; do + for f in *.php include/*.php locales/*.php scripts/*.php tests/bin/*.php; do php -l "$f" done # The Slurm client stand-ins the tests run are POSIX sh. @@ -239,10 +239,41 @@ jobs: sleep 1 done php plugins/hpcsched/tests/bin/page-permissions.php http://127.0.0.1:8080/cacti/ + php plugins/hpcsched/tests/bin/device-permissions.php http://127.0.0.1:8080/cacti/ if grep -E "Fatal error|Warning:|Uncaught" "$RUNNER_TEMP/php-server.log"; then exit 1 fi + # Creates a cluster device from the shipped templates, polls it with + # Cacti's poller, and compares the RRD files with the fixtures. It + # provokes the refusal of a foreign data query file, which the plugin + # logs as an error, so the lines it adds are set aside like the + # integration tests' log. The lines before it stay in cacti.log for + # the final check. + - name: Check the cluster device flow + working-directory: cacti + env: + HPCSCHED_TEST_DATABASE: disposable + run: | + touch log/cacti.log + before=$(wc -l < log/cacti.log) + php plugins/hpcsched/tests/bin/device-flow.php + tail -n "+$((before + 1))" log/cacti.log >> log/integration.log + head -n "$before" log/cacti.log > "$RUNNER_TEMP/cacti-before-device-flow.log" + cat "$RUNNER_TEMP/cacti-before-device-flow.log" > log/cacti.log + + # The export is rebuilt from the builder and must match the shipped + # file, so the two cannot drift. 1.2.31 only: the export is what that + # release writes. + - name: Check the template export is current + if: matrix.cacti == 'release/1.2.31' + working-directory: cacti + env: + HPCSCHED_TEST_DATABASE: disposable + run: | + php plugins/hpcsched/tests/bin/build-templates.php "$RUNNER_TEMP/hpcsched-templates.xml" + diff -u plugins/hpcsched/templates/hpcsched-templates.xml "$RUNNER_TEMP/hpcsched-templates.xml" + - name: Check Cacti log for errors if: always() run: | diff --git a/README.md b/README.md index 5fa89be..f5d2812 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A Cacti 1.2 plugin that graphs the state of an HPC batch scheduler next to the devices Cacti already monitors: queue depth, pending versus running jobs, why jobs are pending, node states, and partition utilization. Slurm is the first backend. Thold alerts on the resulting data sources, and Maint can be driven by drained nodes and maintenance reservations. -> **Status: in development, no release yet.** Milestone 2 (foundation) is merged on `main`. The code installs, upgrades, and uninstalls through Cacti's plugin API and refuses PHP below 8.2. It keeps a registry of Slurm clusters, each assigned to one Cacti poller. A background reader on the main poller collects one snapshot per cluster per interval, either by running `squeue`, `scontrol`, and `sshare` with `--json` or by reading `slurmrestd` over HTTPS, and stores job counts by state and pending reason, node states, partitions, reservations, and fair-share usage with their freshness. A read-only overview page shows job and node counts per cluster with their freshness, and an admin-only health page shows what each collection returned. It creates no Cacti devices, data sources, or graphs yet, and it has no Thold or Maint integration; those start in milestone 3. The test suite runs against stand-in Slurm commands and a stand-in `slurmrestd` with synthetic data. It has not run against a real Slurm cluster. Below the operator notes, this README describes the design, not shipped behavior. +> **Status: in development, no release yet.** Milestone 2 (foundation) is merged on `main`, and this branch adds milestone 3 (cluster graphs and pending reasons). The code installs, upgrades, and uninstalls through Cacti's plugin API and refuses PHP below 8.2. It keeps a registry of Slurm clusters, each assigned to one Cacti poller. A background reader on the main poller collects one snapshot per cluster per interval, either by running `squeue`, `scontrol`, and `sshare` with `--json` or by reading `slurmrestd` over HTTPS, and stores job counts by state and pending reason, node states, partitions, reservations, and fair-share usage with their freshness. The plugin ships Cacti templates and, on an administrator's confirmation, creates or maps one Cacti device per cluster with graphs of jobs by state, pending jobs by reason family, nodes by state, CPUs, and utilization, for the cluster and for each partition, plus the snapshot age. A read-only overview page shows counts per cluster with their freshness and a pending reasons view per cluster, and an admin-only health page shows what each collection returned and whether the templates are installed. Every page and action follows Cacti's device permissions. The data sources are ones Thold can alert on, but no Thold or Maint integration has been tested yet; that is milestone 4 and later. The test suite runs against stand-in Slurm commands and a stand-in `slurmrestd` with synthetic data. It has not run against a real Slurm cluster. Below the operator notes, this README describes the design, not shipped behavior. This is an independent project and is not affiliated with the Cacti project. @@ -29,6 +29,18 @@ mv -f "$tmp" "$dir/cluster1.token" The next collection reads the new file. Generating tokens with `scontrol token` needs a Slurm administrator; run it where that is allowed and copy the file to the poller. +## Operator notes for milestone 3 + +**Templates.** Install and upgrade import the HPC Scheduler device, data, and graph templates and copy the partition data query to Cacti's `resource/script_server/` directory. If that directory is not writable by the user that installs the plugin, a different file of the same name is already there and was not written by the plugin, or the name is a symbolic link, the import stops, the file is left alone, and the health page says what to do; Install Templates on the health page retries. An identical copy made by hand is used but stays yours. Uninstall removes the query file only if the plugin wrote it and it is unchanged, and keeps the templates, devices, and graphs. + +**Cluster devices.** HPC Clusters > Device shows what a device will add (graphs, data sources, RRD files, and script server calls per poll) before anything is created. Create Device makes a device with a host name in the reserved `.invalid` domain and no availability check; Map Device instead attaches the graphs to an existing device and leaves its settings alone. Each cluster graph and each partition graph has its own data source: six for the cluster and five per partition, one script server call per cluster data source and one per value of a partition (32) per poll. Partitions added later are indexed when the reader sees them and get graphs from Cacti's New Graphs page; a removed partition stops being polled and keeps its graphs. Deleting the device unmaps the cluster and keeps it. + +**What the graphs count.** Pending excludes held jobs, which have their own series. A pending array counts its remaining tasks. A job or node in several partitions counts once in the cluster graphs and once in each partition, so partition graphs need not add up to the cluster's. Pending reasons are grouped into eleven families ([ADR 0011](docs/decisions/0011-pending-reason-families-and-counting.md)); the pending reasons view lists the raw reasons, including those in Other. Each job reports only the last reason the scheduler examined. The utilization denominator includes drained, down, and other unavailable nodes. Stale or failed data is `U`, never zero; `age` stays numeric. + +**Alerting.** Thold can alert on any of these data sources; set Thold durations to at least one collection interval, and alert on `age` to catch a stopped reader. The end-to-end Thold check is milestone 4. + +**Permissions.** A cluster on a device is shown, exported, and changed only for users Cacti allows that device, on every plugin page; mapping a device also needs permission for the target device. A cluster without a device is visible to everyone with the plugin realm. A cluster still mapped to a device that was deleted while the plugin was disabled is shown only to users with the HPC Scheduler Admin realm, who can create or map a device for it. Graph access is Cacti's own. + ## Why Operators who run Cacti already graph their compute nodes. The scheduler's view is missing from those graphs, which leaves two gaps: 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/docs/PLAN.md b/docs/PLAN.md index ff7c554..e13cf54 100644 --- a/docs/PLAN.md +++ b/docs/PLAN.md @@ -1,6 +1,6 @@ # Cacti 1.2 HPC Scheduler Plugin Plan -Status: in development, plan revision 2 (2026-11-15). Revision 2 adds the documentation and source results of milestone 1 ([research index](#milestone-1-research-status)); items that need a cluster, accounts, or a remote collector are marked *live* and are not done. Milestone 2 (foundation) is merged on `main`: the lifecycle and PHP guard, realms and settings, the cluster registry, both Slurm transports, the per-poller reader, and the overview and health pages; where the build differs from this plan, the text says "Milestone 2 diverges". Milestone 3 and later are not done: no Cacti device, data source, graph, Thold or Maint integration exists, and there is no release. Statements about Slurm, Cacti core, Maint, and Thold describe upstream behavior and cite the document or source file that was checked, with the checked version or commit. Anything not checked is listed as an assumption and tracked as a research issue. Owner and estimates are not assigned; milestone 1 produces the estimates. +Status: in development, plan revision 2 (2026-11-15). Revision 2 adds the documentation and source results of milestone 1 ([research index](#milestone-1-research-status)); items that need a cluster, accounts, or a remote collector are marked *live* and are not done. Milestone 2 (foundation) is merged on `main`: the lifecycle and PHP guard, realms and settings, the cluster registry, both Slurm transports, the per-poller reader, and the overview and health pages; where the build differs from this plan, the text says "Milestone 2 diverges". Milestone 3 (cluster graphs and pending reasons) adds the templates, the cluster device, the cluster and partition graphs, the pending reasons view, device permissions, and synthetic performance measurements; where it differs from this plan, the text says so. Milestone 4 and later are not done: Thold has not been tested end to end, no Maint integration exists, and there is no release. Statements about Slurm, Cacti core, Maint, and Thold describe upstream behavior and cite the document or source file that was checked, with the checked version or commit. Anything not checked is listed as an assumption and tracked as a research issue. Owner and estimates are not assigned; milestone 1 produces the estimates. `plugin_hpcsched` brings the state of an HPC batch scheduler into Cacti 1.2: queue depth, pending versus running jobs, why jobs are pending, node states, and partition utilization, as ordinary Cacti devices, data sources, and graphs. Slurm is the first backend. PBS Pro, OpenPBS, and LSF are later backends behind the same interface. The plugin is read-only toward the scheduler. @@ -257,13 +257,13 @@ Raw state and reason strings are kept beside the normalized values so a Slurm re | Object | Created from | Notes | |---|---|---| -| Cluster device | "HPC Scheduler Cluster" device template; the device is saved with `availability_method` 0 (a device template has no availability field) and the `poller_id` of the poller that runs the reader | Created on administrator confirmation; carries the cluster-wide graphs | -| Data queries | Script server queries indexed by partition and by reason family | Index sets follow the snapshot; new indexes appear on reindex, and removed ones become orphans that are deleted only if the query XML sets `index_orphan_removal` | -| Data templates | Jobs by state, pending by reason family, nodes by state, partition utilization, cluster `age` | One RRD per template per index | -| Graph templates | One per data template, plus stacked overviews | Graph permissions apply as for any Cacti graph | +| Cluster device | "HPC Scheduler Cluster" device template; the device is saved with `availability_method` 0 (a device template has no availability field), the `poller_id` of the cluster, and a host name in the reserved `.invalid` domain, so nothing ever contacts it | Created, or an existing device mapped, from the cluster's device page after it shows what will be added; carries the cluster-wide graphs. Deleting the device unmaps the cluster and keeps it | +| Data query | One script server query, "HPC Scheduler Partitions", indexed by partition name | Reason families are values, not indexes ([ADR 0011](decisions/0011-pending-reason-families-and-counting.md)). The reader reindexes when the snapshot's partitions differ from the device's indexes, which catches a rename that Cacti's index count check misses. The query sets `index_orphan_removal`, so a removed partition stops being polled; its graphs stay | +| Data templates | "HPC Scheduler Cluster Values" (every cluster value plus `age`, from one script server input), and one per partition graph: Jobs, Pending Reasons, Nodes, CPUs, Utilization | Cacti creates an RRD with only the items a graph draws, so each graph has its own data source: six per cluster and five per partition | +| Graph templates | Cluster: Jobs, Pending Reasons, Nodes, CPUs, Utilization, Snapshot Age. Partition: the same five | Graph permissions apply as for any Cacti graph; partition graphs are created with the device, and partitions added later get theirs from New Graphs | | Node data template (phase 2) | "HPC Scheduler Node" on mapped devices | State code, drain flag, down flag, `age` | -Templates ship as Cacti template XML and are imported with `import_xml_data()` at install and upgrade, matched by hash so re-imports update rather than duplicate. Data query XML is installed under `resource/script_server/`, the location core uses for its own script server queries. The sibling plugin `plugin_cloudflare` follows the same pattern, with one device per account and the tunnels as data query indexes. +Templates ship as Cacti template XML (`templates/hpcsched-templates.xml`, rebuilt by `tests/bin/build-templates.php`) and are imported with `import_xml_data()` at install and upgrade, matched by hash so re-imports update rather than duplicate. Data query XML is copied to `resource/script_server/`, the location core uses for its own script server queries, with its sha256 recorded; a file there the plugin did not write, or one changed since, is never overwritten, and the health page says why the install stopped. Uninstall removes the file only if it is unchanged and keeps the templates and graphs. The sibling plugin `plugin_cloudflare` follows the same pattern, with one device per account and the tunnels as data query indexes. Whether the cluster device is visible everywhere or hidden from device lists is an open decision for Cacti maintainers. The proposal is a template-marked device that appears like any other. @@ -304,19 +304,22 @@ Graphs are Cacti graphs. Trees, zoom, time spans, permissions, and export work a - Jobs by state: pending (eligible), held, running, completing, other. Held jobs are shown apart from eligible pending jobs, because the Slurm metrics guide notes that its pending count includes held jobs. - Pending jobs by reason family. -- Nodes by normalized state: idle, allocated, mixed, drained, down, maintenance or reserved, other. -- Partition utilization as allocated over total CPUs, and as allocated over total nodes. +- Nodes by normalized state: idle, allocated, mixed, drained (drained and draining), down, maintenance or reserved, powered down, other. +- CPUs as allocated, idle, and other, following `sinfo`'s `%C`: other is the unallocated CPUs of nodes that cannot take work. +- Utilization as allocated over total CPUs, and as nodes with allocated CPUs over total nodes. -**Counting rules.** A node in several partitions is counted once in cluster totals and once per partition. A pending job submitted to several partitions is counted once in cluster totals and once per partition it targets. A pending array contributes its task count (`squeue` collapses pending array elements unless `-r` is given; the metrics plugin adds the array count); held jobs are pending jobs whose reason is `JobHeldAdmin` or `JobHeldUser`. The rule for whether drained and down nodes stay in the utilization denominator is chosen with milestone 1 and shown on the graph template. +Each partition has 32 values in 5 RRD files; the cluster has the same 32 plus `age` in 6. -**Plugin pages.** The cluster overview shows the latest snapshot and its age. The pending reason page lists raw reasons with counts and affected partitions. Job IDs appear only for administrators and only up to a row limit. A node page (phase 2) shows state, reason, reason time, and the mapped device. +**Counting rules.** A node in several partitions is counted once in cluster totals and once per partition. A pending job submitted to several partitions is counted once in cluster totals and once per partition it targets. A pending array contributes its task count (`squeue` collapses pending array elements unless `-r` is given; the metrics plugin adds the array count); held jobs are pending jobs whose reason is `JobHeldAdmin` or `JobHeldUser`. Drained, down, and other unavailable nodes stay in the utilization denominator, so lost capacity shows as lower utilization; the Utilization graph template says so in a comment line. + +**Plugin pages.** The cluster overview shows the latest snapshot and its age. The pending reason page lists raw reasons with their family, job counts, and affected partitions, up to 200 rows, with the snapshot time; it also lists nodes in states the plugin does not know by raw state, with node names for the Admin realm only. Milestone 3 shows no job IDs; per-job detail is left for a later milestone. Every plugin page and action follows Cacti's device permission for the cluster's device. A node page (phase 2) shows state, reason, reason time, and the mapped device. ## Pending reasons Pending reasons are the plugin's main differentiator, and they are the place where series counts can grow without bound ([ADR 0010](decisions/0010-bound-series-cardinality.md)). - The raw reason is stored per job count, not per job. -- Reasons are grouped into a fixed family set with an Other bucket. The set, confirmed against source at 24.11, 25.05, 25.11, 26.05, and the 26.11 candidate: Priority, Resources, Dependency, Association limits, QOS limits, Held, Reservation, Node availability, Partition limits, Begin time, Other. A draft prefix rule maps all 216 distinct reason strings at 26.05 (Association limits 61, QOS limits 109, Other 25; counts per family are in [slurm-states-reasons.md](research/slurm-states-reasons.md)). The decision on splitting Other is #12. +- Reasons are grouped into a fixed family set with an Other bucket. The set, confirmed against source at 24.11, 25.05, 25.11, 26.05, and the 26.11 candidate: Priority, Resources, Dependency, Association limits, QOS limits, Held, Reservation, Node availability, Partition limits, Begin time, Other. A draft prefix rule maps all 216 distinct reason strings at 26.05 (Association limits 61, QOS limits 109, Other 25; counts per family are in [slurm-states-reasons.md](research/slurm-states-reasons.md)). [ADR 0011](decisions/0011-pending-reason-families-and-counting.md) decides #12: the eleven families, Other unsplit, with the raw reasons listed on the pending reason page. - The Slurm reason list changes between releases (two to four names differ across 24.11 to 26.11) and the documentation page omits 23 strings present in source. Families are matched by name pattern and prefix, with a fixture test that every reason in the source list at each supported release maps to a family and an unknown reason maps to Other. - Reason attribution is the scheduler's: a job reports only the reason found by the last scheduling method that examined it. The documentation says so, so operators do not read the breakdown as a complete cause analysis. - No series exist for users or jobs. Per-job detail is a plugin page for administrators. @@ -333,7 +336,7 @@ Every value an operator may alert on is a polled data source ([ADR 0002](decisio | `age` | Seconds since the cluster's last successful snapshot | Always numeric once collected | | Node state code, drain flag, down flag (phase 2) | Per mapped node | `U` | -Thold thresholds and Maint device schedules work on these with no change to either plugin. +Thold thresholds and Maint device schedules work on these with no change to either plugin. Milestone 3 ships the data sources Thold reads, cluster and per partition; the end-to-end Thold test (fire and recover on a fixture cluster) is milestone 4. Stated limits: @@ -414,7 +417,20 @@ Capacity is stated in clusters, nodes, jobs, and series. Fixtures cover 1,000 an **Milestone 2: memory.** Decoding a JSON answer took about 10 times its text size in PHP arrays for synthetic job records with Slurm's shape (PHP 8.5, measured locally); with the text itself the reader budgets 12 times. The answer size the reader allows is the smaller of Maximum Answer Size and (Collection Memory - 64 MiB) / 12, and the health page warns when the configured size is larger. With the 1024 MiB default that is 80 MiB per answer, which a 100,000 job queue with full records may exceed; the section then fails as too large rather than reporting zero. A run that runs out of memory anyway is recorded as failed with the memory error class by a shutdown function. -Series arithmetic for one cluster with 50 partitions and 15 reason families, from the template design (not measured): +**Milestone 3: measured on synthetic snapshots** (#47). `tests/bin/perf.php` builds snapshots with 8 partitions, the 25.11 fixture shape, and a fixed seed, sends them through the stand-in client commands and the full reader, creates a cluster device with every partition graphed, and times one script server poll cycle and the two plugin pages. Median of three runs, on one machine: an Apple M3 Max laptop running OrbStack (14 CPUs, 16 GiB for the Linux VM), PHP 8.2.35 in the `cloud-ci:8.2` container, MariaDB 11.8.9 in a second container, 2026-11-15. Other hardware, a remote database, or real `squeue` answers (which carry many more fields per job) will give different numbers; treat these as the shape of the cost, not a capacity guarantee. + +| Nodes | Jobs | Answer MiB (jobs, nodes) | Parse ms | Reader run ms | Rows written | Reader peak MiB | Script server cycle ms (calls) | Overview ms | Reasons view ms | +|---|---|---|---|---|---|---|---|---|---| +| 1,000 | 10,000 | 2.2, 0.2 | 29 | 87 | 1,395 | 21 | 1 (262) | 1 | 1 | +| 1,000 | 100,000 | 22.1, 0.2 | 362 | 413 | 1,395 | 210 | 1 (262) | 1 | 1 | +| 10,000 | 10,000 | 2.2, 2.0 | 61 | 206 | 10,395 | 29 | 1 (262) | 6 | 2 | +| 10,000 | 100,000 | 22.1, 2.0 | 347 | 503 | 10,395 | 210 | 1 (262) | 10 | 2 | + +What this shows: job count drives decode time and memory (about 9.5 times the answer size at 100,000 jobs, inside the 12 times budget), and node count drives the rows written, since every node is stored; the job tables hold counts, not jobs. The script server answers a full cycle (6 cluster calls and 32 per partition) from one snapshot read, so its cost does not grow with jobs or nodes; the cycle figure excludes Cacti's own script server process and poller overhead, which the plugin does not control. Both pages stay far below the two second target. Not measured: a real 100,000 job `squeue` answer, the Cacti poller cycle with many cluster devices, and Cacti's own pages at these series counts. + +Series arithmetic, revised with the milestone 3 templates: 32 values in 5 RRD files per partition, plus 33 values (with `age`) in 6 files per cluster, so 50 partitions are 256 RRD files and 1,633 values per cluster, and 1,606 script server calls per poll. + +Series arithmetic for one cluster with 50 partitions and 15 reason families, from the template design (revision 2, before milestone 3; kept for the record): - Per partition, four RRD files (jobs by state, pending by reason, nodes by state, utilization) holding 25 values in total with 11 reason families (29 with 15; the family count is decision #12), so 200 RRD files and 1,250 (or 1,450) values for 50 partitions, plus a handful of cluster-level files. Revision 1 said about 31 values and 1,550, which the plan's own lists do not reproduce. - Per-node series exist only for mapped nodes, with one RRD of 4 values each: 10,000 mapped nodes add 10,000 RRD files and 40,000 values to poll. @@ -493,7 +509,7 @@ No calendar duration is claimed: the comparison plugins' commit spans measure as | Node matching keys | Hostname, address, description with rules (proposed); `external_id` only; rules only | Milestone 5 | Naming fixtures and core confirmation | | Repository and name | `Cacti/plugin_hpcsched` (proposed), `Cacti/plugin_slurm`, community plugin | Before any code is published | Cacti maintainers | | Test harness | Whatever maintained plugins use | Milestone 2 | Cacti maintainers | -| Pending reason families | Fixed families (proposed); per raw reason; operator-defined | Milestone 3 | Reason research | +| Pending reason families | Decided: eleven fixed families, Other unsplit ([ADR 0011](decisions/0011-pending-reason-families-and-counting.md)) | Milestone 3 | Reason research | | Maintenance mechanism | Direct rows (proposed); Maint function; none | Milestone 5 | Maint maintainers | | Fair-share account selection | Chosen list plus top-N (proposed); all; top-level only | Milestone 6 | sshare research | 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/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..82fdf99 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_access->unmapped($hpcsched_cluster) && $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: the cluster already has a device, it was changed by someone else since the page was opened, or Cacti refused it. 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_access->unmapped($hpcsched_cluster) && $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, already carries another cluster, or the cluster was changed by someone else since the page was opened.', 'hpcsched'), $hpcsched_ok ? MESSAGE_LEVEL_INFO : MESSAGE_LEVEL_ERROR); + } elseif ($hpcsched_cluster->hostId > 0 && !$hpcsched_access->orphaned($hpcsched_cluster)) { + $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_ok = $hpcsched_clusters->mapHost($hpcsched_cluster->id, 0, $hpcsched_cluster->hostId); + raise_message('hpcsched_device', $hpcsched_ok ? __('The cluster was unmapped. The device and its graphs were kept.', 'hpcsched') : __('The cluster was not unmapped: it was changed by someone else since the page was opened.', 'hpcsched'), $hpcsched_ok ? MESSAGE_LEVEL_INFO : MESSAGE_LEVEL_ERROR); + 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/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/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..1e0c4b7 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,56 @@ 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. + * + * A compare-and-set: the mapping changes only while the stored device is + * still $expected, the one the request loaded, so of two requests that + * loaded the same cluster only one wins and the other gets false. + */ + public function mapHost(int $id, int $hostId, int $expected): bool { + $ok = db_execute_prepared( + 'UPDATE plugin_hpcsched_cluster SET host_id = ?, updated_at = GREATEST(updated_at + 1, ?) + WHERE id = ? AND host_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, $expected, $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..6613a0b --- /dev/null +++ b/lib/ClusterSeries.php @@ -0,0 +1,176 @@ + + * 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; + + /** + * The stored rows per device, read at most once per CACHE_SECONDS. + * Freshness and age are worked out from them on every answer, so a + * section that turns stale inside that window answers U at once. + * + * @var array, partitions: list, jobs: array>, nodes: array>}> + */ + 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{partitions: list, values: array>, age: ?int} + */ + private function load(int $hostId): array { + $raw = $this->rows($hostId); + $data = ['partitions' => $raw['partitions'], 'values' => [], 'age' => null]; + + if ($raw['cluster'] === null) { + return $data; + } + + $cluster = $raw['cluster']; + $sections = $raw['sections']; + $jobsOk = ClusterValues::usable($cluster, $sections, Section::Jobs, $this->evaluator, $this->pollerInterval); + $nodesOk = ClusterValues::usable($cluster, $sections, Section::Nodes, $this->evaluator, $this->pollerInterval); + + $data['age'] = ClusterValues::of($cluster, $sections, [], [], $this->evaluator, $this->pollerInterval)->age; + + foreach (array_merge([''], $raw['partitions']) as $partition) { + $data['values']["p:$partition"] = Series::values($jobsOk, $nodesOk, $raw['jobs']["p:$partition"] ?? [], $raw['nodes']["p:$partition"] ?? []); + } + + return $data; + } + + /** + * The device's stored rows, from the cache while it is younger than + * CACHE_SECONDS. Counts are read only for a section usable at read + * time: one that is not cannot become usable again until the next + * collection, which a later read picks up. + * + * @return array{at: int, cluster: ?Cluster, sections: array, partitions: list, jobs: array>, nodes: array>} + */ + private function rows(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); + $raw = ['at' => $now, 'cluster' => $cluster, 'sections' => [], 'partitions' => [], 'jobs' => [], 'nodes' => []]; + + if ($cluster !== null) { + $raw['sections'] = $this->series->sections($cluster->id); + $raw['partitions'] = $this->series->partitions($cluster->id); + $raw['jobs'] = ClusterValues::usable($cluster, $raw['sections'], Section::Jobs, $this->evaluator, $this->pollerInterval) ? $this->series->jobs($cluster->id) : []; + $raw['nodes'] = ClusterValues::usable($cluster, $raw['sections'], Section::Nodes, $this->evaluator, $this->pollerInterval) ? $this->series->nodes($cluster->id) : []; + } + + return $this->cache[$hostId] = $raw; + } + + /** + * @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..912e64e 100644 --- a/lib/ClusterValues.php +++ b/lib/ClusterValues.php @@ -24,8 +24,10 @@ * and the data input will serve them (REQ-STATE-001, REQ-STATE-003). * * The cluster's snapshot age is the age of its oldest configured section. - * A value whose section is stale or was never collected is null (U), never - * zero; age stays numeric once anything was collected. Rendering a page + * A value whose section is stale, was never collected, or whose last + * attempt did not complete is null (U), never zero: a failed attempt keeps + * the previous rows and their observation time, and those are not served + * as current. Age stays numeric once anything was collected. Rendering a page * reads stored observation times only, so a page view is never an * observation (REQ-STATE-005). */ @@ -71,20 +73,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 +92,19 @@ 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: its last attempt + * completed, and they are 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 + && $record->state === SectionState::Completed + && $evaluator->evaluate($record->observedAt, max($cluster->effectiveInterval($pollerInterval), $record->interval))->usable(); + } } diff --git a/lib/ClustersPage.php b/lib/ClustersPage.php index 640d4fe..47ab256 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,81 @@ 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; + } + + if ($cluster->hostId > 0) { + print '' . html_escape(__('The cluster is still mapped to device %d, which no longer exists. Creating or mapping a device replaces that mapping.', $cluster->hostId, 'hpcsched')) . ''; + } + + 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 +223,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..9aed6c6 --- /dev/null +++ b/lib/DeviceAccess.php @@ -0,0 +1,93 @@ + + * 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. + * + * A cluster still mapped to a device that no longer exists (deleted while + * the plugin's device_remove hook could not run) has no device permission + * left to check. It is left to users with the Admin realm, who can see it + * and give it a device again; the View realm does not see it. + */ +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 + * @param bool $admin whether the user has the Admin realm + */ + public function __construct( + private readonly \Closure $deviceAllowed, + private readonly ?\Closure $deviceExists = null, + private readonly bool $admin = false, + ) { + } + + public function device(int $hostId): bool { + return $hostId > 0 && ($this->deviceAllowed)($hostId) === true; + } + + public function cluster(?Cluster $cluster): bool { + if ($cluster === null) { + return false; + } + + if ($cluster->hostId === 0 || $this->device($cluster->hostId)) { + return true; + } + + return $this->admin && $this->orphaned($cluster); + } + + /** + * Whether the cluster's device was deleted while the plugin's + * device_remove hook could not run (the plugin disabled). + */ + public function orphaned(Cluster $cluster): bool { + return $cluster->hostId > 0 && $this->deviceExists !== null && ($this->deviceExists)($cluster->hostId) === false; + } + + /** + * Whether a device may be created for the cluster or mapped to it: it + * has none, or (for an administrator) the one it had is gone. + */ + public function unmapped(Cluster $cluster): bool { + return $cluster->hostId === 0 || ($this->admin && $this->orphaned($cluster)); + } + + /** + * @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..e1e4164 --- /dev/null +++ b/lib/DeviceProvisioner.php @@ -0,0 +1,269 @@ + + * 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, or whose device no longer + * exists, and attach the plugin's objects. Returns the new device id, or + * 0 with the reason logged. When another request mapped the cluster + * first, the device made here is removed again. + */ + public function create(Cluster $cluster, bool $partitionGraphs): int { + $templateId = $this->objects->deviceTemplateId(); + + if ($templateId === 0 || ($cluster->hostId > 0 && $this->objects->device($cluster->hostId) !== null)) { + 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, $cluster->hostId)) { + api_device_remove($hostId); + Log::error(sprintf('Cluster %d was mapped by another request; device %d created for it was removed again', $cluster->id, $hostId)); + + 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, $cluster->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/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/OverviewPage.php b/lib/OverviewPage.php index aecd39e..a78ba5f 100644 --- a/lib/OverviewPage.php +++ b/lib/OverviewPage.php @@ -17,41 +17,61 @@ * 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, ) { } public function render(): void { - $now = $this->clock->now(); - $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())); + $now = $this->clock->now(); + + [$sections, $jobs, $nodes] = $this->view->consistent(fn (): array => [$this->view->sections(), $this->view->jobStates(), $this->view->nodeStates()]); + + $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,97 @@ 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 { + [$sections, $listed, $unknown] = $this->view->consistent(fn (): array => [ + $this->view->sections()[$cluster->id] ?? [], + $this->view->reasons($cluster->id, self::ROW_LIMIT), + $this->view->otherNodes($cluster->id, self::ROW_LIMIT), + ]); + + html_start_box(__('Pending Reasons: %s', html_escape($cluster->name), 'hpcsched'), '100%', '', '3', 'center', ''); + + print '' . $this->snapshotLine($cluster, $sections, Section::Jobs) . ''; + + 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')) . '

'; + + $nodesObserved = ($sections[Section::Nodes->value] ?? null)->observedAt ?? 0; + + html_start_box(__('Nodes in Unknown States', 'hpcsched'), '100%', '', '3', 'center', ''); + print '' . $this->snapshotLine($cluster, $sections, Section::Nodes) . ''; + print Format::header($this->admin ? [__('Slurm State', 'hpcsched'), __('Nodes', 'hpcsched'), __('Names', 'hpcsched')] : [__('Slurm State', 'hpcsched'), __('Nodes', 'hpcsched')]); + + if ($unknown === [] && $nodesObserved > 0) { + 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(); + } + + /** + * When a section's rows were observed and whether they are current, as + * one escaped line. + * + * @param array $sections section value => record + */ + private function snapshotLine(Cluster $cluster, array $sections, Section $section): string { + $now = $this->clock->now(); + $observed = ($sections[$section->value] ?? null)->observedAt ?? 0; + $jobs = $section === Section::Jobs; + + if ($observed <= 0) { + return html_escape($jobs ? __('No jobs snapshot has been collected yet.', 'hpcsched') : __('No nodes snapshot has been collected yet, so the node states are unknown.', 'hpcsched')); + } + + $taken = date('Y-m-d H:i:s', $observed); + $age = Format::age($observed, $now); + $current = ClusterValues::usable($cluster, $sections, $section, $this->evaluator, $this->pollerInterval); + + if ($current) { + return html_escape($jobs ? __('Jobs snapshot taken %s (%s), current.', $taken, $age, 'hpcsched') : __('Nodes snapshot taken %s (%s), current.', $taken, $age, 'hpcsched')); + } + + return '' . html_escape($jobs + ? __('Jobs snapshot taken %s (%s), not current: it is stale or the last collection failed, and the counts below are the last ones collected.', $taken, $age, 'hpcsched') + : __('Nodes snapshot taken %s (%s), not current: it is stale or the last collection failed, and the nodes below are the last ones collected.', $taken, $age, 'hpcsched')) . ''; + } } 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/lib/Schema.php b/lib/Schema.php index e878bb0..c6b36ff 100644 --- a/lib/Schema.php +++ b/lib/Schema.php @@ -35,13 +35,14 @@ * schedule, or contacts the scheduler. */ final class Schema { - public const VERSION = 1; + public const VERSION = 2; public const HOOKS = [ 'config_arrays' => 'hpcsched_config_arrays', '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'; @@ -155,9 +156,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 +230,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 +245,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 +304,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/lib/TemplateInstaller.php b/lib/TemplateInstaller.php new file mode 100644 index 0000000..293c376 --- /dev/null +++ b/lib/TemplateInstaller.php @@ -0,0 +1,334 @@ + + * 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_link($target) && 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; + } + + /** + * Copy the data query file into Cacti's resource tree. + * + * Ownership is recorded only for a file this method wrote: a file that is + * already there with the right content, for example one an administrator + * copied by hand, is used but not recorded, so uninstall never removes + * it. A file is replaced only when the plugin wrote it and nobody changed + * it since. The destination must not be a symbolic link, dangling or not; + * the file is written to a temporary file in the same directory and + * renamed into place, and rename() replaces a path without following it. + * + * @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); + } + + clearstatcache(true, $target); + + if (is_link($target)) { + return sprintf('%s is a symbolic link; it was left as it is. Replace it with a copy of plugins/hpcsched/resource/script_server/%s', $target, self::QUERY_FILE); + } + + $want = (string) hash_file('sha256', $source); + + if (file_exists($target)) { + $have = is_file($target) ? (string) hash_file('sha256', $target) : ''; + + if ($have === $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 (!$this->writeQueryFile($source, $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; + } + + /** + * Write $source to $target through a temporary file in the target's + * directory, checking the copy's hash before the rename. + */ + private function writeQueryFile(string $source, string $target, string $want): bool { + $dir = dirname($target); + + if (!is_dir($dir) || !is_writable($dir)) { + return false; + } + + // tempnam() falls back to the system temporary directory when it + // cannot create the file here, and a rename from there is not atomic. + $temp = @tempnam($dir, '.hpcsched-'); + + if ($temp === false || realpath(dirname($temp)) !== realpath($dir)) { + if (is_string($temp)) { + @unlink($temp); + } + + return false; + } + + $ok = @copy($source, $temp) && hash_file('sha256', $temp) === $want && @chmod($temp, 0644) && @rename($temp, $target); + + if (!$ok) { + @unlink($temp); + } + + return $ok; + } + + /** + * @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/lib/ViewRepository.php b/lib/ViewRepository.php index af90fb8..0e9a5c0 100644 --- a/lib/ViewRepository.php +++ b/lib/ViewRepository.php @@ -21,12 +21,41 @@ /** * 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) { } + /** + * Run several reads against one snapshot of the tables. The reader + * replaces a cluster's rows in one transaction; separate reads outside + * one could pair one snapshot's counts with another's observation time. + * Under REPEATABLE READ (InnoDB's default, set here for the transaction + * in case the server's differs) every read in the transaction sees the + * tables as of its first read. When no transaction can be started the + * reads run as they are. + * + * @template T + * + * @param \Closure(): T $read + * + * @return T + */ + public function consistent(\Closure $read): mixed { + db_execute_prepared('SET TRANSACTION ISOLATION LEVEL REPEATABLE READ', [], true, $this->connection); + + $started = db_begin_transaction($this->connection); + + try { + return $read(); + } finally { + if ($started) { + db_commit_transaction($this->connection); + } + } + } + /** * @return array> cluster id => section value => record */ @@ -77,4 +106,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..a8ce813 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,48 @@ 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: the cluster already has a device, it was changed by someone else since the page was opened, or Cacti refused it. 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, already carries another cluster, or the cluster was changed by someone else since the page was opened." +msgstr "" + +#: hpcsched_clusters.php +msgid "Missing graphs were added." +msgstr "" + +#: hpcsched_clusters.php +msgid "The cluster was not unmapped: it was changed by someone else since the page was opened." +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 +131,10 @@ msgstr "" msgid "Actions" msgstr "" +#: lib/ClustersPage.php +msgid "Device" +msgstr "" + #: lib/ClustersPage.php msgid "Interval" msgstr "" @@ -132,6 +181,10 @@ msgstr "" msgid "%d seconds" msgstr "" +#: lib/ClustersPage.php +msgid "None" +msgstr "" + #: lib/ClustersPage.php msgid "Delete" msgstr "" @@ -193,6 +246,99 @@ 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 +#, php-format +msgid "The cluster is still mapped to device %d, which no longer exists. Creating or mapping a device replaces that mapping." +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 +483,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 +523,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 +672,10 @@ msgstr "" msgid "Collected" msgstr "" +#: lib/OverviewPage.php +msgid "Details" +msgstr "" + #: lib/OverviewPage.php lib/Section.php msgid "Nodes" msgstr "" @@ -509,10 +684,96 @@ 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 +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/OverviewPage.php +msgid "No jobs snapshot has been collected yet." +msgstr "" + +#: lib/OverviewPage.php +msgid "No nodes snapshot has been collected yet, so the node states are unknown." +msgstr "" + +#: lib/OverviewPage.php +#, php-format +msgid "Jobs snapshot taken %s (%s), current." +msgstr "" + +#: lib/OverviewPage.php +#, php-format +msgid "Nodes snapshot taken %s (%s), current." +msgstr "" + +#: lib/OverviewPage.php +#, php-format +msgid "Jobs snapshot taken %s (%s), not current: it is stale or the last collection failed, and the counts below are the last ones collected." +msgstr "" + +#: lib/OverviewPage.php +#, php-format +msgid "Nodes snapshot taken %s (%s), not current: it is stale or the last collection failed, and the nodes below are the last ones collected." +msgstr "" + #: lib/Pages.php msgid "HPC Scheduler View" msgstr "" @@ -561,14 +822,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 +950,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/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/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/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..2bd0a86 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,85 @@ 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; + }, + api_plugin_user_realm_auth('hpcsched_clusters.php') === true + ); +} + +/** + * 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. + */ +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/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/Integration/LifecycleTest.php b/tests/Integration/LifecycleTest.php index 6096dad..9accc48 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 () { @@ -219,7 +258,7 @@ ->and($r['due_after'])->toBeTrue(); }); -it('keeps a failed section\'s rows and their time, and ages a stopped reader into unknown', function () { +it('keeps a failed section\'s rows and their time without serving them, and ages a stopped reader into unknown', function () { lifecycle('install'); $r = lifecycle('reader_flow')['result']; @@ -228,7 +267,9 @@ ->and($r['sections2']['jobs'])->toBe(['failed', 'failed', HPCSCHED_T]) ->and($r['sections2']['nodes'])->toBe(['completed', '', HPCSCHED_T + 60]) ->and($r['jobs2'])->toBeGreaterThan(0) - ->and($r['values_delayed'])->toMatchArray(['freshness' => 'delayed', 'age' => 160, 'pending' => 63, 'nodes' => 8]) + // The failed jobs section is U although its rows are only delayed; + // the completed nodes section is still served. + ->and($r['values_delayed'])->toMatchArray(['freshness' => 'delayed', 'age' => 160, 'pending' => null, 'held' => null, 'nodes' => 8]) ->and($r['values_stale'])->toMatchArray(['freshness' => 'stale', 'pending' => null, 'nodes' => null]) ->and($r['values_stale']['age'])->toBeGreaterThan($r['values_delayed']['age']); }); diff --git a/tests/Unit/PagesTest.php b/tests/Unit/PagesTest.php index 9cc8662..c9c4f12 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('