Skip to content

sdf-cli Migration to slurmrest#13

Open
2Ryan09 wants to merge 30 commits into
mainfrom
sdf-cli-to-slurmrest
Open

sdf-cli Migration to slurmrest#13
2Ryan09 wants to merge 30 commits into
mainfrom
sdf-cli-to-slurmrest

Conversation

@2Ryan09

@2Ryan09 2Ryan09 commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Documentation showing how the existing four calls to sacctmgr and sacct could be migrated to use slurmrest, a stepping stone towards sdf-cli containerization.

Refer to docs/slurmrest_migration.md for thought process

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements a migration away from direct sacct/sacctmgr subprocess reads toward Slurm REST (slurmrest) using an autogenerated OpenAPI Python client, supporting containerization goals and reducing reliance on SLURM CLI binaries for read paths.

Changes:

  • Added SlurmrestClient and updated run_sacct / slurmdump / slurmimport flow to emit and ingest newline-delimited JSON job objects.
  • Updated facility hold-state reads to use slurmrest association endpoints, while keeping sacctmgr modify for the (currently) non-migratable write path.
  • Added CI + Makefile steps and documentation for generating the OpenAPI client; updated tests accordingly.

Reviewed changes

Copilot reviewed 11 out of 14 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
modules/slurmrest.py Introduces a REST client wrapper + helpers to translate REST responses into importer-friendly job/hold-state data.
modules/coact.py Switches job collection/import to REST + JSON line protocol; replaces association reads with REST calls.
tests/test_slurm_import.py Adds behavioral test ensuring REST memory TRES gets an M suffix for correct downstream unit conversion.
tests/test_node_allocation.py Updates facility hold-state tests to mock REST association responses instead of sacctmgr output parsing.
.github/workflows/ci-cd.yaml Generates the OpenAPI client in CI prior to dependency install/test.
Makefile Adds generate-client target for local OpenAPI client generation.
pyproject.toml Adds local editable OpenAPI client source and dependency changes to support the migration.
uv.lock Locks updated dependency set including the editable OpenAPI client and related packages.
README.md Documents local OpenAPI client generation workflow.
docs/slurmrest_migration.md Adds rationale and migration notes (including unit/format differences).
import-jobs.sh Removes slurmremap step now that import path consumes job objects/JSON lines.
.gitignore Ignores generated OpenAPI client output and .env.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread modules/coact.py Outdated
Comment thread docs/slurmrest_migration.md Outdated
Comment thread docs/slurmrest_migration.md Outdated
Comment thread docs/slurmrest_migration.md Outdated
Comment thread docs/slurmrest_migration.md Outdated
Comment on lines +50 to +51
# Setup JWT token for REST client
os.environ["SLURMREST_JWT"] = "test_token"
Comment on lines +207 to +209
# Clean up JWT token
if "SLURMREST_JWT" in os.environ:
del os.environ["SLURMREST_JWT"]
Comment on lines +1 to +3
# Migration of `sacctmgr` and `sacct` Calls to `slurmrest`

Currently, `sdf-cli` runs `sacctmgr` and `sacct` CLI tools directly via `subprocess` in order to gather account association information, job accounting information, and toggling the number of nodes assigned to a facility in the event of an overage. In a step towards containerization and more robust interaction with SLURM, it is desired to migrate these CLI tool usages to `slurmrest` endpoints.
Comment thread README.md Outdated
Comment thread README.md Outdated
2Ryan09 and others added 2 commits June 8, 2026 11:59
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2Ryan09 and others added 3 commits June 8, 2026 12:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants