-
Notifications
You must be signed in to change notification settings - Fork 881
[Slurm] Fix autodown #8362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[Slurm] Fix autodown #8362
Conversation
Summary of ChangesHello @kevinmingtarja, 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 addresses a critical issue preventing Highlights
🧠 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 AssistThe 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
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 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
|
There was a problem hiding this 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 addresses a bug in the autodown functionality for Slurm clusters, which was failing due to an incorrect check for whether the code was executing within a Slurm job. The previous method of checking the SLURM_JOB_ID environment variable was unreliable. The new approach, which uses a marker file created during provisioning, is a more robust solution. The changes are well-contained and the accompanying test updates are appropriate. My review includes a suggestion to further improve the robustness of the marker file check and clarify its behavior in the code comments.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this 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 addresses a bug in the Slurm autodown feature, which was failing due to an incorrect check for whether it's running inside a Slurm cluster. The fix is well-implemented, replacing the environment variable check with a more robust marker file mechanism. The introduction of a local execution mode for SlurmClient using LocalProcessCommandRunner is a clean solution for the autodown case. The code changes are clear, correct, and the accompanying test updates are appropriate. I have one suggestion to improve maintainability by refactoring duplicated code for SlurmClient instantiation.
| class SlurmClient: | ||
| """Client for Slurm control plane operations.""" | ||
|
|
||
| def __init__( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about just adding a boolean argument is_local_execution_mode: bool = False and pass that in from sky/provision/slurm/instance.py to make the intent more explicit?
SeungjinYang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment, take it or leave it
Previously, autodown would error with:
# skylet.log AutostopEvent error: SSH private key not found: /root/.ssh/id_rsa FileNotFoundError: SSH private key not found: /root/.ssh/id_rsaBecause we don't copy the SSH private key file to the remote cluster for Slurm, which is intentional for the time being, as it's not necessary to do so.
skypilot/sky/provision/slurm/instance.py
Lines 495 to 504 in fec5787
We have this detection specifically for when skylet tries to autodown itself, where we check if this code is being executed on the remote slurm cluster or not. If so, don't pass in the private key path to SSHCommandRunner (because the private only exists on the API server and thus the path is only valid within that context).
But the way we were checking is wrong. This PR fixes this by using a marker file instead of checking the
SLURM_JOB_IDenvironment variable. Since SlurmCommandRunner uses SSH (not srun, for now at least) to connect to compute nodes, Slurm environment variables aren't available to the skylet, and so the check always fails, and autodown wouldn't happen.The sbatch provision script now creates a
.sky_slurm_clustermarker file in the cluster's home directory during provisioning.On top of that, we now use
LocalProcessCommandRunnerfor the autodown case, since it is being run from inside the Slurm cluster.Tested (run the relevant ones):
bash format.sh/smoke-test(CI) orpytest tests/test_smoke.py(local)/smoke-test -k test_name(CI) orpytest tests/test_smoke.py::test_name(local)/quicktest-core(CI) orpytest tests/smoke_tests/test_backward_compat.py(local)