Skip to content

Add a HyperQueue based scheduler - #3760

Draft
pranav-sivaraman wants to merge 18 commits into
reframe-hpc:masterfrom
pranav-sivaraman:feat/hyperqueue-scheduler-take2
Draft

pranav-sivaraman wants to merge 18 commits into
reframe-hpc:masterfrom
pranav-sivaraman:feat/hyperqueue-scheduler-take2

Conversation

@pranav-sivaraman

Copy link
Copy Markdown

This PR adds a new HyperQueue scheduler. Currently requires a nightly build of HyperQueue which has some fixes for SLURM and running on multi-node.

While trying to tackle the following issue, I noticed that SLURM job arrays do not help when prologue and epilogue can be very long.

One workaround is to get an interactive allocation and run all tests inside it as job steps. This avoids paying the prologue and epilogue cost for every test, but it has its own problems:

  • Mixed node counts are awkward. If your tests need different numbers of nodes, you have two options. You can request one allocation big enough for the largest test, which leaves nodes idle while smaller tests run. Or you can keep several allocations of different sizes, but then you need a way to make sure each test lands in the right one.
  • Busy systems. When the system is busy, a single large allocation can wait in the queue for a long time. If it crashes or hits its time limit partway through, you lose all the progress made so far.
  • Idle systems. When the system is mostly free, a fixed allocation can't grow to use the extra nodes, so tests wait in line inside your allocation even though there's spare capacity.

HyperQueue avoids these problems. It requests allocations automatically based on the tasks that are waiting. Its autoscaling requests more allocations when there's more work and capacity, and it keeps scheduling tasks into whatever allocations are available. Tasks of different sizes go to allocations that fit them. If one allocation fails, only the tasks running in it are affected.

Implementation details

Supported backends

Only SLURM is supported for now.

HyperQueue also recently added a FirecREST backend, which could be useful on ALPS and is a possible follow-up.

Servers and allocations

The scheduler currently starts one HyperQueue server, with its own allocation queue, for each unique access pattern. For example, a single-node test and a multi-node test with the same access options end up with two servers and two allocation requests.

A bigger improvement would need help from ReFrame. Each job and the scheduler instance that submits it know nothing about the other jobs in the run. If ReFrame could tell the scheduler which jobs can share an allocation (a kind of
group by"), the scheduler could pack them together more efficiently. That goes beyond this PR.

Testing

I've made sure that it passes the psuedo-cluster tests along with validating this on ALPS and a couple of internal systems at HPE. Right now it's based of the following PR, but will rebase it again after that goes in.

Signed-off-by: Pranav Sivaraman <[email protected]>
@vkarak

vkarak commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Right now it's based of the following #3752, but will rebase it again after that goes in.

A technicality: since now #3752 is rebased on master you won't be able to rebase this PR onto that one until we release 4.11.1 and merge master into develop.

@vkarak
vkarak requested a review from victorusu December 1, 2026 22:43
@gppezzi

gppezzi commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

I tested this PR on santis (production family, Slurm 25.05.9) and, for comparison, on the TDS machines starlex and pilatus; the TDS machines fail out of the box only because their login-node hostname has no DNS/FQDN entry, so this report focuses on santis, where the PR works end to end unpatched. HyperQueue was built from source at the commit pinned by the PR's CI (2a05d6da), and everything below ran on the PR branch with ReFrame 4.11.0.

What was tested

  • The PR unit test suite (unittests/test_schedulers.py, unittests/test_launchers.py) on starlex and santis.
  • A subset of the CSCS system integration checks (eth-cscs/cscs-reframe-tests, checks/system/integration/alps.py): twelve single-node checks covering timeout, filesystem, ping, curl, DNS, network interfaces and OS version, on santis.
  • Multi-node checks (2-node and 4-node) on santis, the TIMEOUT state mapping (sleep 300 with a 10 s limit), and the atexit cleanup path.

Results

  • Unit tests: 204 passed / 3 failed on starlex, 203 passed / 4 failed on santis. The three consistent failures are the hqsrun launcher tests (test_run_command[hqsrun], test_run_command_minimal[hqsrun-*]): they hardcode --overlap in the expected srun command, but the launcher only emits --overlap for Slurm < 22.05 (via slurm_version()), so on Slurm 25.05.9 the launcher correctly omits it and only the test expectations fail. The additional failure on santis (test_cancel_term_ignore[local]) looks flaky and unrelated to this PR.
  • All twelve integration checks passed in 45 s through the hyperqueue scheduler on santis with the default configuration (no host overrides, no patches). The sacct trace shows the intended behavior: one shared allocation served all twelve single-node checks, a second allocation was spawned on overflow, and the trial allocations were cancelled as designed.
  • Multi-node checks passed: the 2-node and 4-node checks produced correctly sized 2- and 4-node sbatch allocations, and the hqsrun launcher's HQ_NUM_NODES/HQ_NODE_FILE mapping ran the srun steps on exactly the expected number of nodes.
  • The TIMEOUT mapping works as designed: a job killed at its time limit maps HQ's "Time limit reached" to a TIMEOUT state, and a sanity function asserting on job.state fails with TIMEOUT != FINISHED as expected.
  • Cleanup is robust: after every run, including runs with failing tests, there were no leftover server directories under ~/.reframe/hq, no hq processes, and an empty squeue.
  • Minor cosmetic issue: the worker-launch step inside each allocation reports FAILED at teardown because the workers are killed when the server stops; it is non-fatal and all checks complete normally, but it looks alarming in sacct output.

Suggested changes before merge

  1. Make the hqsrun launcher unit tests version-aware (or mock slurm_version) so they pass on systems running Slurm ≥ 22.05; the launcher code itself is correct.
  2. Optionally document that the default sanity of run-only tests is trivially true: a job that exits nonzero does not fail a test unless the sanity function checks job.state/job.exitcode or general/0/trap_job_errors is enabled. Users migrating from the Slurm backend may expect automatic job-failure detection.

Verdict

The core design — one HQ server per distinct allocation-queue spec, workers started through Slurm autoalloc, per-spec allocation sizing, and state mapping including TIMEOUT — works as intended on production hardware. With the test-expectation fix and the documentation addition above, I see no blocker for merging.

@pranav-sivaraman

pranav-sivaraman commented Dec 3, 2026 •

Copy link
Copy Markdown
Author

@gppezzi Thank you for testing this out! Will incorporate your feedback. I will be opening a PR that tackles the following issue, and then rebase this branch on top of that. That way the behavior for SLURM and HyperQueue stays consistent and then I can easily extend HyperQueue to a PBS backend.

I need to fix an issue where reframe crashes because this scheduler does not handle the case where a server has failed/crashed. So I will be marking this as a draft for now

@pranav-sivaraman
pranav-sivaraman marked this pull request as draft December 3, 2026 15:14

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants