Skip to content

feat: Implement slurm scheduler#767

Merged
rchardx merged 3 commits intomainfrom
fw/slurm
Dec 26, 2025
Merged

feat: Implement slurm scheduler#767
rchardx merged 3 commits intomainfrom
fw/slurm

Conversation

@garrett4wade
Copy link
Collaborator

Description

Implement a slurm scheduler to run single-controller experiments in our cluster.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not
    work as expected)
  • Documentation update
  • Code refactoring (no functional changes)
  • Performance improvement
  • Test coverage improvement

Checklist

  • I have read the Contributing Guide
  • I have run formatting tools (pre-commit or manual)
  • I have run relevant unit tests and they pass
  • I have added tests for new functionality
  • I have updated documentation if needed
  • My branch is up to date with main
  • This PR introduces breaking changes (if yes, fill out details below)
  • If this PR changes documentation, I have built and previewed it locally with
    jb build docs
  • No critical issues raised by AI reviewers (/gemini review)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @garrett4wade, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly extends the system's capabilities by integrating a Slurm scheduler. This allows for the orchestration of single-controller experiments on Slurm-managed clusters, providing robust worker management, resource allocation, and inter-process communication tailored for HPC environments. The changes also refine default resource specifications and enhance the resilience of engine imports and RPC server operations.

Highlights

  • Slurm Scheduler Implementation: A new SlurmScheduler class has been added, enabling the system to manage and run experiments on Slurm clusters. This includes functionalities for creating, monitoring, and deleting workers, as well as handling RPC communication within a Slurm environment.
  • Resource Specification Defaults: The default CPU and memory requirements in SchedulingSpec have been updated from 0 to 2 CPU cores and 1 GB of memory, respectively, providing more sensible defaults for resource allocation.
  • Conditional torch_memory_saver Import: The torch_memory_saver library is now imported conditionally and lazily in fsdp_engine.py, megatron_engine.py, and offload.py. This change prevents import errors if the library is not installed and allows for a mock implementation when unavailable.
  • RPC Server Enhancements: The RPC server (rpc_server.py) has been improved with new features, including an endpoint to allocate multiple free ports, better error logging with function names and tracebacks, and dynamic worker index resolution from Slurm environment variables.
  • New Slurm Scheduler Tests: A comprehensive test suite (test_slurm_scheduler.py) has been introduced to validate the functionality of the new SlurmScheduler, covering worker lifecycle, RPC communication, and error handling in various scenarios.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a SlurmScheduler to enable running experiments on a Slurm-managed cluster. The implementation is comprehensive, covering job submission, monitoring, worker lifecycle management, and RPC communication. It also includes a good set of integration tests. I've identified a critical bug in the RPC server's thread initialization logic that needs to be addressed. Additionally, there are a few areas for improvement regarding the Slurm script generation and code duplication that would enhance the robustness and maintainability of the new scheduler. Overall, this is a solid feature addition.

garrett4wade and others added 2 commits December 26, 2025 10:52
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@garrett4wade garrett4wade added the safe-to-test Ready to run unit-tests in a PR. label Dec 26, 2025
Copy link
Collaborator

@rchardx rchardx left a comment

Choose a reason for hiding this comment

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

LGTM

@rchardx rchardx merged commit 38b3a1b into main Dec 26, 2025
7 checks passed
@rchardx rchardx deleted the fw/slurm branch December 26, 2025 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe-to-test Ready to run unit-tests in a PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants