Skip to content

Print the scheduler configurations into logs for easier debugging#5128

Open
Tau721 wants to merge 1 commit intovolcano-sh:masterfrom
Tau721:fix_log_scheduler_conf
Open

Print the scheduler configurations into logs for easier debugging#5128
Tau721 wants to merge 1 commit intovolcano-sh:masterfrom
Tau721:fix_log_scheduler_conf

Conversation

@Tau721
Copy link
Copy Markdown
Contributor

@Tau721 Tau721 commented Mar 23, 2026

What type of PR is this?

/kind Enhancement

What this PR does / why we need it:

Currently, the scheduler only prints the names of its actions and plugins into logs, and such information is usually insufficient for users to debug.

To facilitate debugging, the scheduler would better print the detailed configurations as the users edit, including the arguments and configurations of each plugin.

Which issue(s) this PR fixes:

Fixes #5127

Special notes for your reviewer:

The scheduler saves its detailed configurations and prints them into logs whenever they are changed.

Does this PR introduce a user-facing change?

NONE

Copilot AI review requested due to automatic review settings March 23, 2026 12:36
@volcano-sh-bot
Copy link
Copy Markdown
Contributor

@Tau721: The label(s) kind/enhancement cannot be applied, because the repository doesn't have them.

Details

In response to this:

What type of PR is this?

/kind Enhancement

What this PR does / why we need it:

Currently, the scheduler only prints the names of its actions and plugins into logs, and such information is usually insufficient for users to debug.

To facilitate debugging, the scheduler would better print the detailed configurations as the users edit, including the arguments and configurations of each plugin.

Which issue(s) this PR fixes:

Fixes #5127

Special notes for your reviewer:

The scheduler saves its detailed configurations and prints them into logs whenever they are changed.

Does this PR introduce a user-facing change?

NONE

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@volcano-sh-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign monokaix for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@volcano-sh-bot volcano-sh-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 23, 2026
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, 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 enhances the scheduler's debugging capabilities by printing detailed configurations to the logs. It addresses issue #5127 by providing more information about the scheduler's state, including plugin arguments and configurations. The changes involve modifying the scheduler's configuration loading process and updating the logging output.

Highlights

  • Configuration Logging: The scheduler now prints detailed configurations to logs, including arguments and configurations for each plugin, to facilitate easier debugging.
  • Configuration Loading: The scheduler loads its detailed configurations and prints them into logs whenever they are changed.
  • Code Changes: The pull request includes modifications to pkg/scheduler/conf/scheduler_conf.go to correct a typo in a field name and updates to pkg/scheduler/scheduler.go to store and log the scheduler configuration content.

🧠 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.

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

@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

The pull request introduces a schedulerConfContent field to the Scheduler struct to store the raw configuration content. The loadSchedulerConf function is updated to populate this field with mutex protection, both for default and custom configurations, and to log the raw content, replacing the getSchedulerConf helper function. A minor YAML tag casing fix for EnabledClusterOrder is also included. A review comment suggests refactoring the logging of schedulerConfContent in loadSchedulerConf to minimize lock contention by copying the content to a local variable before releasing the mutex and performing I/O.

Comment on lines +142 to +146
pc.mutex.Lock()
for _, line := range strings.Split(pc.schedulerConfContent, "\n") {
klog.V(2).Infoln(strings.TrimSpace(line))
}
pc.mutex.Unlock()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

To minimize lock contention, it's better to not hold the lock during I/O operations like logging. You can copy pc.schedulerConfContent to a local variable under the lock, release the lock, and then perform the logging.

pc.mutex.Lock()
confContent := pc.schedulerConfContent
pc.mutex.Unlock()
for _, line := range strings.Split(confContent, "\n") {
    klog.V(2).Infoln(strings.TrimSpace(line))
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the scheduler's debugging capabilities by printing detailed configuration content to logs whenever the scheduler configuration is loaded or changed. Previously, the scheduler only logged the names of its actions and plugins, which was insufficient for debugging. Now it logs the full configuration content, making it easier for users to understand and debug scheduler behavior.

Changes:

  • Added a new schedulerConfContent field to the Scheduler struct to store the full configuration as a string
  • Modified the loadSchedulerConf() function's defer block to print the complete configuration content line-by-line instead of just action and plugin names
  • Updated all places where scheduler configuration is set to also update schedulerConfContent with proper mutex protection
  • Removed the getSchedulerConf() helper function that extracted action and plugin names (no longer needed)
  • Fixed YAML tag for EnabledClusterOrder field from uppercase "EnabledClusterOrder" to lowercase (though with potential naming inconsistency)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/scheduler/scheduler.go Added configuration content storage and printing; enhanced mutex protection for thread-safe concurrent access
pkg/scheduler/conf/scheduler_conf.go Fixed YAML tag naming for EnabledClusterOrder field

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Tau721 Tau721 force-pushed the fix_log_scheduler_conf branch 2 times, most recently from 55f84e6 to b3c0784 Compare March 23, 2026 12:54
@Tau721 Tau721 force-pushed the fix_log_scheduler_conf branch 2 times, most recently from 68ed992 to 7ca9938 Compare April 1, 2026 01:36
…bugging

Signed-off-by: caotuo721 <caotuo721@yeah.net>
@Tau721
Copy link
Copy Markdown
Contributor Author

Tau721 commented Apr 6, 2026

/retest

@volcano-sh-bot
Copy link
Copy Markdown
Contributor

@Tau721: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scheduler should print its detailed configurations into logs for easier debugging

3 participants