-
Notifications
You must be signed in to change notification settings - Fork 262
Modifying fetching method of slurm state job #5042
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: develop
Are you sure you want to change the base?
Modifying fetching method of slurm state job #5042
Conversation
Summary of ChangesHello @vikramvs-gg, 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 enhances the stability and reliability of Slurm integration tests by refactoring the job state fetching mechanism. By switching from 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 race condition in Slurm job status fetching by switching from scontrol to sacct. This is a solid improvement for test reliability. The updated assertion messages are also more informative. I've added one suggestion to make the parsing of sacct output more robust by explicitly searching for the main job ID instead of assuming it's the first entry in the list, which will further prevent potential flakiness.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
| self.assertIn("COMPLETED", self.job_state(job_id), f"Something went wrong with JobID:{job_id}.") | ||
| state = self.job_state(job_id) | ||
| self.assertIn("COMPLETED", state, f"Job {job_id} did not complete successfully. Final state is {state}.") | ||
| print(f"JobID {job_id} finished successfully.") |
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.
Nit: s/print/log.info ?
What is the change
This change modifies the way the slurm job status is fetched in the slurm_simple_job_completion.py script. This script is used in multiple integration tests to trigger jobs on slurm cluster and validate jobs completed successfully.
Why is it needed
There were transient test failures because the job status could not be fetched. This is because the command used within the job_state function to fetch the job status returned an empty list of jobs (json.loads(stdout)["jobs"] is empty). The script expected to find details for a specific job_id, but none were found. This transient issue that can happen if the job completes and is purged from the slurm controller's active memory before the test has a chance to check its final state.
Fix done
Fixing this issue by using sacct instead of scontrol.
scontrol queries the state of jobs that are currently active or recently completed in the Slurm controller's memory. If a job finishes and is quickly purged, scontrol will find no record of it, leading to the IndexError (race condition).
sacct queries the slurm accounting database, which stores a historical record of all jobs. It is specifically designed to get the final status, exit code, and resource usage of jobs that have already finished.
NOTE: Community submissions can take up to 2 weeks to be reviewed.
Please take the following actions before submitting this pull request.