Skip to content
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

Implements the command to generate storage invoices #110

Merged
merged 10 commits into from
Sep 27, 2023

Conversation

knikolla
Copy link
Collaborator

@knikolla knikolla commented Aug 1, 2023

This PR implements the management command coldfront calculate_quota_unit_hours --start <start> --end <end> that generates the CSV invoice for the given period.

Some minor polish is still missing but it's operational.

@knikolla knikolla force-pushed the storage_decreasing branch 3 times, most recently from 5244147 to 7db861d Compare August 3, 2023 19:57
@knikolla knikolla changed the base branch from main to fix/cmd August 25, 2023 16:25
@knikolla knikolla changed the base branch from fix/cmd to main August 25, 2023 16:25
This PR implements the command `coldfront calculate_storage_gb_hours`
which generates the invoices.

Adds a calculate_quota_unit_hours function to utils which
cycles through the history of an allocation attribute and the states
of its allocation to calculate the quota hour values between a time
period.
@knikolla knikolla changed the title [WIP] Invoicing Invoicing Aug 25, 2023
@knikolla knikolla changed the title Invoicing Implements the command to generate invoices Aug 25, 2023
@knikolla knikolla changed the title Implements the command to generate invoices Implements the command to generate storage invoices Aug 25, 2023
src/coldfront_plugin_cloud/utils.py Show resolved Hide resolved
src/coldfront_plugin_cloud/utils.py Outdated Show resolved Hide resolved
src/coldfront_plugin_cloud/utils.py Outdated Show resolved Hide resolved
Previously a CR that happened in the previous billing cycle
wouldn't get picked up.

This fixes that by iterating over change requests in reverse order
and removing the need for it to fall between the billing window.
This is an edge case that is unlikely to be hit because we only
change attributes with a CR.

In the case that an attribute has been changed to a lower value without a
corresponding CR, the code may find a previous CR and therefore
undercount.
@joachimweyl
Copy link

@naved001 & @larsks it looks like all of the Change Requests have been resolved. Are there any other changes you wish to make before approving this PR?

@knikolla knikolla merged commit 7e64868 into nerc-project:main Sep 27, 2023
4 checks passed
@knikolla knikolla deleted the storage_decreasing branch September 27, 2023 21:44
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.

4 participants