-
Notifications
You must be signed in to change notification settings - Fork 13
Management command to fetch daily service invoices #278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR introduces a new management command `coldfront fetch_daily_billable_usage --date <YYYY-MM>`. This management command fetches the daily billable usage reports stored in BackBlaze S3 under the following location /Invoices/<YYYY-MM>/Service Invoices/<CLUSTER> <YYYY-MM-DD>.csv For each allocation in either Active or Active (Needs Renewal) state of the 3 production clusters (NERC, NERC-OCP and NERC-EDU), the attribute named "Cumulative Daily Charges for Month" is updated with the latest total billable cost for that allocation for that given month. The attribute stores the total in the following format: <YYYY-MM-DD>: <TOTAL> USD If an allocation has the attribute Monthly Allocation Alert set to a value different than zero, an email is going to be sent to the PI ONCE after the total billable cost for that allocation has been exceeded.
naved001
reviewed
Dec 8, 2025
src/coldfront_plugin_cloud/management/commands/fetch_daily_billable_usage.py
Outdated
Show resolved
Hide resolved
src/coldfront_plugin_cloud/management/commands/fetch_daily_billable_usage.py
Show resolved
Hide resolved
naved001
reviewed
Dec 8, 2025
Contributor
naved001
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me
src/coldfront_plugin_cloud/management/commands/fetch_daily_billable_usage.py
Outdated
Show resolved
Hide resolved
src/coldfront_plugin_cloud/management/commands/fetch_daily_billable_usage.py
Show resolved
Hide resolved
knikolla
commented
Dec 9, 2025
src/coldfront_plugin_cloud/management/commands/fetch_daily_billable_usage.py
Show resolved
Hide resolved
QuanMPhm
requested changes
Dec 9, 2025
Contributor
QuanMPhm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor comments
src/coldfront_plugin_cloud/management/commands/fetch_daily_billable_usage.py
Outdated
Show resolved
Hide resolved
src/coldfront_plugin_cloud/management/commands/fetch_daily_billable_usage.py
Outdated
Show resolved
Hide resolved
src/coldfront_plugin_cloud/management/commands/fetch_daily_billable_usage.py
Outdated
Show resolved
Hide resolved
src/coldfront_plugin_cloud/management/commands/fetch_daily_billable_usage.py
Show resolved
Hide resolved
- Rename service_usage variable to storage_usage - Changed comparison of class type via type(a) is type(b) - Added a test for class type comparison - Added try, except for parsing attribute value. Return none as fallback.
Collaborator
Author
|
I'm keeping the commits separate for now. Before this should be merged I'll squash. |
naved001
approved these changes
Dec 10, 2025
QuanMPhm
approved these changes
Dec 15, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new management command
coldfront fetch_daily_billable_usage --date <YYYY-MM>.This management command fetches the daily billable usage reports stored in BackBlaze S3 under the following location /Invoices//Service Invoices/ .csv
For each allocation in either Active or Active (Needs Renewal) state of the 3 production clusters (NERC, NERC-OCP and NERC-EDU), the attribute named "Cumulative Daily Charges for Month" is updated with the latest total billable cost for that allocation for that given month.
The attribute stores the total in the following format:
<YYYY-MM-DD>: <TOTAL> USDIf an allocation has the attribute Monthly Allocation Alert set to a value different than zero, an email is going to be sent to the PI ONCE after the total billable cost for that allocation has been exceeded.
Closes #274