Skip to content

Conversation

@myersCody
Copy link
Contributor

@myersCody myersCody commented Jan 9, 2026

Jira Ticket

COST-7114

Description

This change will make it to where the current month will not distribute GPU unallocated costs.

Testing

Instructions in Jira issue.

koku-worker-1  | [2026-01-16 14:56:59,817] INFO 9d8c5d02-0300-4163-a4d1-3f6e5683d196 9d8c5d02-0300-4163-a4d1-3f6e5683d196 6a4ecbe1-dd8a-4ec7-9e71-6fde18859d2a 76 {'message': 'Skipping gpu_unallocated distribution requires full month', 'tracing_id': '', 'schema': 'org1234567', 'cost_model_key': 'gpu_unallocated'}

Release Notes

  • proposed release note
* [COST-####](https://issues.redhat.com/browse/COST-####) Fix some things

@gemini-code-assist
Copy link

Summary of Changes

Hello @myersCody, 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 refines the cost distribution mechanism, specifically for unallocated GPU costs, by introducing a requires_full_month flag. This flag ensures that certain distributions are only performed when a full month's data is available, preventing inaccurate calculations based on incomplete data. The system will now process these distributions for the previous month on the first day of the current month, guaranteeing data completeness and accuracy.

Highlights

  • New Configuration Field: Introduced a requires_full_month boolean field to the DistributionConfig class, allowing specific cost distributions to be marked as requiring complete monthly data.
  • GPU Unallocated Cost Distribution Logic: Modified the GPU unallocated cost distribution to utilize the new requires_full_month flag. This ensures that the distribution for a given month is processed only on the first day of the subsequent month, using the complete data from the previous month.
  • Conditional Execution for Monthly Distributions: Implemented logic within populate_distributed_cost_sql to conditionally execute distributions marked with requires_full_month. If the current date is not the first day of the month, and the distribution is for the current month, it will be skipped to prevent premature calculations. If it is the first day, the distribution will run for the previous month.
  • Enhanced Test Coverage: Added new unit tests to validate the behavior of the requires_full_month field and the conditional execution logic for GPU unallocated cost distribution, covering scenarios where it should run and where it should be skipped.

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

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.

@github-actions github-actions bot added the smokes-required Label to show that smokes tests should be run against these changes. label Jan 9, 2026
Copy link

@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 introduces a mechanism to delay GPU cost distribution until a full month's data is available, triggering it on the first of the following month. The implementation, however, contains a critical bug where loop variables are modified, which could cause subsequent distributions in the same run to use incorrect date ranges. I've provided a fix for this. Additionally, the new tests have significant code duplication that should be refactored for better maintainability.

@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

❌ Patch coverage is 89.51613% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.4%. Comparing base (322b963) to head (de2e8c7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #5846   +/-   ##
=====================================
  Coverage   94.3%   94.4%           
=====================================
  Files        345     345           
  Lines      29756   29819   +63     
  Branches    3237    3238    +1     
=====================================
+ Hits       28073   28137   +64     
- Misses      1098    1100    +2     
+ Partials     585     582    -3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@myersCody myersCody added the ocp-smoke-tests pr_check will run ocp + ocp on cloud smoke tests, used when changes affect ocp. label Jan 13, 2026
@myersCody
Copy link
Contributor Author

/retest

@myersCody myersCody marked this pull request as ready for review January 13, 2026 14:54
@myersCody myersCody requested review from a team as code owners January 13, 2026 14:54
@myersCody myersCody enabled auto-merge (squash) January 16, 2026 03:49
@myersCody myersCody added full-run-smoke-tests pr_check will run all smoke tests. Used for large or wider reaching changes. and removed ocp-smoke-tests pr_check will run ocp + ocp on cloud smoke tests, used when changes affect ocp. labels Jan 19, 2026
@esebesto
Copy link
Contributor

/retest

@myersCody myersCody merged commit e52d771 into main Jan 21, 2026
13 checks passed
@myersCody myersCody deleted the COST-7114-current-month-gpu branch January 21, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-run-smoke-tests pr_check will run all smoke tests. Used for large or wider reaching changes. smokes-required Label to show that smokes tests should be run against these changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants