Integrate nerc-rates for dynamic outage information loading#261
Integrate nerc-rates for dynamic outage information loading#261knikolla merged 1 commit intonerc-project:mainfrom
Conversation
e19501e to
ef716a1
Compare
|
Based on previous discussions I think the service mapping was something like OpenStack resources → stack Is there also other services that need to be included? |
The rest aren't in ColdFront at the moment. Please create a map as a global variable in the |
|
Created a related issue as a second step, after this PR is merged, to remove the PR and have the mapping be stored as attributes in the Resources themselves. For now, a dict map in |
knikolla
left a comment
There was a problem hiding this comment.
Review in prior comments. Please implement a dictionary map to fetch the appropriate outage based on cluster name map.
cf42501 to
f687493
Compare
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
|
@jimmysway actually, seeing the asymmetry between providing CLI args (apply to all resources) and loaded from |
@knikolla Are there any downstream consequences for something like this that I should be aware of? |
No, the command is either executed manually through a terminal, or through a cronjob that doesn't provide any excluded intervals when executing the command. EDIT TO ADD: Furthermore the command is very specific to how we bill, so I'm not worried about potentially breaking someone who might be using it. |
src/coldfront_plugin_cloud/tests/unit/test_calculate_quota_unit_hours.py
Outdated
Show resolved
Hide resolved
2bc9771 to
634e3f2
Compare
knikolla
left a comment
There was a problem hiding this comment.
I don't think the current testing is sufficient. You haven't added any new test while adding functionality.
Please add a test that mocks nerc-rates and verifies that get_outages_during is called with the appropriate parameters. You can patch the mapping dictionary to make things easier for resources that don't exist.
You can also test that the mocked output of get_outages_during is correctly used.
d307f6b to
01d2815
Compare
knikolla
left a comment
There was a problem hiding this comment.
One final comment, otherwise looks ready to go. Good work.
src/coldfront_plugin_cloud/tests/unit/test_calculate_quota_unit_hours.py
Outdated
Show resolved
Hide resolved
|
@QuanMPhm were your comments resolved? |
|
@knikolla I've resolved my comments and approved |
- Add load_outages_from_nerc_rates() to fetch outages from nerc-rates repository - Update calculate_storage_gb_hours to use mapping dict that matches the ColdFront Resource name to the nerc-rates service name - Added functools cache so outages load once per run - Added testing for nerc-rates integration.Mocks cached nerc-rates data directly Closes nerc-project#256
85d324b to
17754fa
Compare
Closes #256