From 1d420b967cdb19ac145b90a626acfff8604d3e3b Mon Sep 17 00:00:00 2001 From: "Jason C. Nucciarone" Date: Tue, 4 Jun 2024 08:28:42 -0400 Subject: [PATCH 1/3] feat: Add part to build slurm prometheus exporter `CPATH` must be set in build environment as the exporter uses `swig` to bind the Golang code to slurm/slurm.h Signed-off-by: Jason C. Nucciarone --- snap/snapcraft.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 0d2f573..11e9717 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -75,6 +75,13 @@ apps: daemon: simple install-mode: disable after: [munged] + slurm-prometheus-exporter: + command: bin/prometheus-slurm-exporter + daemon: simple + install-mode: disable + after: [munged] + restart-condition: always + restart-delay: 15s sacct: command: bin/sacct @@ -296,3 +303,15 @@ parts: - --with-freeipmi - --with-ofed - --with-pmix + + slurm-prometheus-exporter: + after: [slurm] + source: "https://github.com/rivosinc/prometheus-slurm-exporter.git" + source-tag: "v1.4.1" + plugin: go + build-environment: + - CPATH: ${CRAFT_STAGE}/include + build-packages: + - swig + build-snaps: + - go/1.22/stable From adcfb4088f9d1d423246de8ad198cf0482553ab5 Mon Sep 17 00:00:00 2001 From: "Jason C. Nucciarone" Date: Tue, 4 Jun 2024 08:30:19 -0400 Subject: [PATCH 2/3] fix(ci): Bump cyclomatic complexity to 15 15 is the standard number used by HPC Engineering Signed-off-by: Jason C. Nucciarone --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 26cb52b..eba334c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,5 +64,5 @@ extend-exclude = ["__pycache__", "*.egg_info"] per-file-ignores = {"tests/*" = ["D100","D101","D102","D103","D104"]} [tool.ruff.mccabe] -max-complexity = 10 +max-complexity = 15 From 4280aa5e6f00880afbb1760ea8d5fa91ae9bb2a1 Mon Sep 17 00:00:00 2001 From: "Jason C. Nucciarone" Date: Tue, 4 Jun 2024 08:45:23 -0400 Subject: [PATCH 3/3] refactor: Declare `SLURM_CONF` as global env var Better than dozens of individual declarations for each command. If change needs to be made to the `slurm.conf` path, only one env var needs to be updated instead of many. Signed-off-by: Jason C. Nucciarone --- snap/snapcraft.yaml | 43 +------------------------------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 11e9717..583005f 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -35,6 +35,7 @@ environment: # the necessary dependencies packaged in `site-packages`. # yamllint disable-line rule:line-length PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$SNAP/usr/local/bin:$SNAP/usr/local/sbin:$PATH + SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf apps: logrotate: @@ -85,88 +86,46 @@ apps: sacct: command: bin/sacct - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf sacctmgr: command: bin/sacctmgr - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf salloc: command: bin/salloc - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf sattach: command: bin/sattach - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf sbatch: command: bin/sbatch - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf sbcast: command: bin/sbcast - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf scancel: command: bin/scancel - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf scontrol: command: bin/scontrol - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf scrontab: command: bin/scrontab - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf scrun: command: bin/scrun - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf sdiag: command: bin/sdiag - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf sh5util: command: bin/sh5util - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf sinfo: command: bin/sinfo - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf sprio: command: bin/sprio - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf squeue: command: bin/squeue - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf sreport: command: bin/sreport - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf srun: command: bin/srun - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf sshare: command: bin/sshare - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf sstat: command: bin/sstat - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf strigger: command: bin/strigger - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf sview: command: bin/sview - environment: - SLURM_CONF: $SNAP_COMMON/etc/slurm/slurm.conf parts: overlay: