-
Notifications
You must be signed in to change notification settings - Fork 10
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
Conversation
This file contains 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
knikolla
force-pushed
the
storage_decreasing
branch
3 times, most recently
from
August 3, 2023 19:57
5244147
to
7db861d
Compare
knikolla
force-pushed
the
storage_decreasing
branch
from
August 25, 2023 16:25
7db861d
to
0532d08
Compare
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
force-pushed
the
storage_decreasing
branch
from
August 25, 2023 16:26
0532d08
to
a9f41dd
Compare
knikolla
changed the title
Implements the command to generate invoices
Implements the command to generate storage invoices
Aug 25, 2023
naved001
reviewed
Aug 28, 2023
larsks
reviewed
Aug 28, 2023
src/coldfront_plugin_cloud/management/commands/calculate_storage_gb_hours.py
Show resolved
Hide resolved
src/coldfront_plugin_cloud/management/commands/calculate_storage_gb_hours.py
Outdated
Show resolved
Hide resolved
src/coldfront_plugin_cloud/management/commands/calculate_storage_gb_hours.py
Outdated
Show resolved
Hide resolved
src/coldfront_plugin_cloud/tests/unit/test_calculate_quota_unit_hours.py
Show resolved
Hide resolved
- Now uses a dataclass - Same writing logic for both openshift and openstack.
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.
larsks
approved these changes
Sep 22, 2023
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 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.