fix(fairshare): incorrect allocated slots#276
Conversation
Summary of ChangesHello @jinzhejz, 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 bug in the fair share scheduling mechanism where allocated slots were being incorrectly calculated. The changes ensure that all executors linked to a session contribute to its allocated slot count, irrespective of their operational state, and that new executors are correctly associated with their respective sessions from the moment of creation. Highlights
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.
Code Review
This pull request correctly fixes an issue with the calculation of allocated slots in the fair-share scheduler. The changes ensure that newly created executors are properly associated with their session and that all executors for a session, regardless of their state, are counted towards its allocated resources. The logic seems sound. I've added a few suggestions to improve performance by reducing string allocations and to enhance code clarity.
| // Go through all the executors here (VOID, IDLE,BOUND, BINDING, UNBINDING, RELEASING, RELEASED) | ||
| // If the executor is related to a session, add the slots to the session. |
There was a problem hiding this comment.
The comment is a bit verbose. The list of all executor states is not necessary and could be removed to improve readability and maintainability.
| // Go through all the executors here (VOID, IDLE,BOUND, BINDING, UNBINDING, RELEASING, RELEASED) | |
| // If the executor is related to a session, add the slots to the session. | |
| // If the executor is related to a session, add the slots to the session. |
| slots, | ||
| task_id: None, | ||
| ssn_id: None, | ||
| ssn_id: Some(ssn_id.clone()), |
There was a problem hiding this comment.
The ssn_id variable is owned by this function. It is cloned for the get_session_ptr call, so the original ssn_id can be moved into the Executor struct here without needing another clone. This avoids an unnecessary string allocation.
| ssn_id: Some(ssn_id.clone()), | |
| ssn_id: Some(ssn_id), |
071f22d to
a5bec58
Compare
b4233bf to
13d23ed
Compare
13d23ed to
664d3e3
Compare
No description provided.