Skip to content

[Documentation] User story: harvest idle compute time with workers on an overflow queue - #1130

Draft
jan-janssen wants to merge 1 commit into
slurm-cluster-restart-limitfrom
story-overflow-queue-workers
Draft

jan-janssen wants to merge 1 commit into
slurm-cluster-restart-limitfrom
story-overflow-queue-workers

Conversation

@jan-janssen

Copy link
Copy Markdown
Member

Stacked on #1129, so the base is slurm-cluster-restart-limit. Please merge #1129 first; GitHub then retargets this PR to main.

Closes #1128 together with #1129.

Summary

New user story notebooks/story-13-overflow-queue-workers.ipynb: Harvest Idle Compute Time with Workers on an Overflow Queue. It covers the SlurmClusterExecutor with block_allocation=True, which no story notebook covered before (#1128), and the new restart_limit from #1129:

  1. Start the workers: SlurmClusterExecutor(max_workers=2, block_allocation=True, restart_limit=10, ...). Eight calls are executed by two SLURM jobs; the SLURM_JOB_ID returned by each call shows which worker ran it.
  2. A worker is preempted while idle: scancel on one worker job; the next calls run on the remaining worker and on a replacement job with a new job ID.
  3. A worker is preempted mid-calculation: the worker running a 10 s call is cancelled. The future does not fail, and an attempt log shows that the call ran a second time in a different SLURM job. Includes advice to keep calls short and safe to repeat, and to use checkpoints for long calculations.
  4. When restart_limit is reached (text only): the remaining workers take over, then the futures fail with ExecutorlibSocketError. Also covers that the login-node process must keep running, that the cache keeps completed results, and that init_function reruns in every replacement worker (with the Cache returns stale results with block_allocation + init_function: worker memory is not part of the cache key #1084 caveat about init_function + cache_directory).

The cluster-settings cell adds two lines specific to overflow queues:

  • ##SBATCH --partition=overflow, disabled because the test cluster has only one partition
  • #SBATCH --no-requeue: with PreemptMode=REQUEUE, SLURM requeues a preempted job under the same job ID. pysqa then reports it as pending, so PysqaSpawner.poll() treats the worker as alive and the executor waits forever for the interrupted call. With --no-requeue, the preempted job ends and executorlib submits the replacement itself. The notebook explains this.

The story is added to docs/_toc.yml and to both story lists in README.md.

Testing

  • The notebook follows the existing story conventions (parameters-tagged settings cell, runs on the login node, no executorlib_ci allocation flag). The notebooks_slurm CI job therefore runs it on the single-node SLURM test cluster with real sbatch/scancel. This is the first CI run of the SlurmClusterExecutor block-allocation path and of the worker resubmission through PysqaSpawner, which [Feature] Restart cancelled block allocation workers in SlurmClusterExecutor #1129 could not test without SLURM.
  • Locally, without SLURM, I only checked that the notebook is valid nbformat, that every code cell parses, that the submission template renders with Jinja2, and that .ci_support/run_notebooks.py --scheduler slurm keeps all cells and runs it without salloc. The notebook has not been executed yet; the CI result is the real test.

🤖 Generated with Claude Code

Story 13 demonstrates the SlurmClusterExecutor with block_allocation=True
and restart_limit: long-lived worker jobs which are replaced when SLURM
preempts them, for harvesting idle compute time on an overflow partition.
The notebook cancels a worker with scancel while it is idle and while it
executes a call, and shows that the calls are executed by the remaining
and the replacement workers. It recommends #SBATCH --no-requeue, as a
requeued job keeps its job ID and would be considered alive.

Part of #1128

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@review-notebook-app

Copy link
Copy Markdown

Review Notebooks

Notebooks changed:

Review visual diffs and comment on any notebook cell. All comments sync back to this PR.


Powered by ReviewNB

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codecov

codecov Bot commented Dec 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.18%. Comparing base (3720cf7) to head (50386af).

Additional details and impacted files
@@                     Coverage Diff                      @@
##           slurm-cluster-restart-limit    #1130   +/-   ##
============================================================
  Coverage                        94.18%   94.18%           
============================================================
  Files                               39       39           
  Lines                             2220     2220           
============================================================
  Hits                              2091     2091           
  Misses                             129      129           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

1 participant