Skip to content

Conversation

Kyrie336
Copy link
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

add podinfos in DeviceUsage struct to enhance scheduling decision. When scheduling, we can know tasks(Pods) on a device

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

@hami-robot hami-robot bot requested review from Shouren and archlitchi September 23, 2025 06:02
@github-actions github-actions bot removed the kind/feature new function label Sep 23, 2025
@hami-robot hami-robot bot added the size/L label Sep 23, 2025
Copy link
Contributor

Summary of Changes

Hello @Kyrie336, 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 improves the scheduling mechanism by integrating comprehensive pod information directly into device usage data. By introducing a dedicated PodInfo struct that embeds Kubernetes' native pod object and associating it with DeviceUsage, the system gains deeper insight into which pods are consuming specific device resources. This enhanced data availability is crucial for making more intelligent and optimized scheduling decisions, particularly in resource-constrained environments.

Highlights

  • New PodInfo Struct: Introduced a new PodInfo struct in pkg/device/devices.go to encapsulate detailed pod information, including an embedded corev1.Pod object, NodeID, Devices, and CtrIDs.
  • Refactored Pod Information Handling: Refactored podInfo usage across pkg/scheduler/pod_test.go and pkg/scheduler/pods.go to leverage the newly defined device.PodInfo struct, removing redundant fields and improving consistency.
  • Enhanced DeviceUsage with Pod Context: Enhanced the DeviceUsage struct in pkg/scheduler/scheduler.go to store a list of PodInfo objects within its CustomInfo field, providing richer context about pods utilizing a specific device.
  • Improved Scheduling Decision Data: Updated the scheduler's getNodesUsage function to actively collect and associate PodInfo with specific device usages, enabling more informed and optimized scheduling decisions.
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

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
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 refactors the podInfo struct into the device package as device.PodInfo and enhances it by embedding *corev1.Pod. This change centralizes the pod information structure and makes it more comprehensive. The scheduler is then updated to use this new struct to associate pods with the devices they are using, which will improve scheduling decisions. The changes are logical and well-structured. I've found one area for improvement in pkg/scheduler/scheduler.go regarding the robustness of adding pod information to the device's custom info map, which could fail silently in an edge case.

Copy link

codecov bot commented Sep 23, 2025

Codecov Report

❌ Patch coverage is 72.97297% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/scheduler/scheduler.go 66.66% 5 Missing and 1 partial ⚠️
pkg/device/pods.go 78.94% 4 Missing ⚠️
Flag Coverage Δ
unittests 63.06% <72.97%> (-0.65%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/device/devices.go 78.65% <ø> (ø)
pkg/device/pods.go 41.05% <78.94%> (ø)
pkg/scheduler/scheduler.go 47.29% <66.66%> (+2.53%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.