Skip to content

fix(fairshare): incorrect allocated slots#276

Merged
k82cn merged 1 commit into
xflops:mainfrom
jinzhejz:fairshare-bug-fix
Jan 13, 2026
Merged

fix(fairshare): incorrect allocated slots#276
k82cn merged 1 commit into
xflops:mainfrom
jinzhejz:fairshare-bug-fix

Conversation

@jinzhejz
Copy link
Copy Markdown

@jinzhejz jinzhejz commented Jan 7, 2026

No description provided.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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

  • Fair Share Slot Calculation: Modified the fair share plugin to correctly account for allocated slots by considering all executors associated with a session, regardless of their current state, rather than only Bound executors.
  • Executor Session ID Assignment: Ensured that newly created executors are immediately assigned their session ID (ssn_id) upon creation, preventing potential miscounts in fair share allocation due to delayed ID assignment.
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
Copy Markdown
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 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.

Comment on lines +180 to +181
// 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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The comment is a bit verbose. The list of all executor states is not necessary and could be removed to improve readability and maintainability.

Suggested change
// 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.

Comment thread session_manager/src/storage/mod.rs Outdated
slots,
task_id: None,
ssn_id: None,
ssn_id: Some(ssn_id.clone()),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
ssn_id: Some(ssn_id.clone()),
ssn_id: Some(ssn_id),

@k82cn k82cn self-requested a review January 8, 2026 05:36
Copy link
Copy Markdown
Contributor

@k82cn k82cn left a comment

Choose a reason for hiding this comment

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

lgtm

@jinzhejz jinzhejz force-pushed the fairshare-bug-fix branch 5 times, most recently from b4233bf to 13d23ed Compare January 13, 2026 03:40
@k82cn k82cn merged commit ab81856 into xflops:main Jan 13, 2026
4 checks passed
@jinzhejz jinzhejz deleted the fairshare-bug-fix branch January 14, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants