-
Notifications
You must be signed in to change notification settings - Fork 6
Use nerc-rates for billing #89
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
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
requests>=2.18.4 | ||
boto3>=1.34.40 | ||
https://github.com/CCI-MOC/nerc-rates/archive/main.zip |
Oops, something went wrong.
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.
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.
The way things are currently structured, it's legal to run with, say,
--use-nerc-rates --rate-cpu-su=1
, even though the second argument would be ignored. This would be a good use case for a mutually exclusive group. Alternately, should it be possible to override individual rates from nerc-rates with a command line options?Since none of the rate options have defaults, they will be
0
if unspecified. Practically, that means that when not using--use-nerc-rates
, all the rate options need to be set explicitly. Should we raise an error if only some of them are set explicitly?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.
@larsks right, I did look into using mutually exclusive group but couldn't get it to work with my use case. I'll take another look at it.
I tested this behavior and it's actually NoneType if unspecified and then when I cast it to Decimal it'll throw an error.
So it raises an ugly error if not all of the rates are set but it doesn't silently set it
0
. And now that I think about it, I actually don't need to manually cast it as Decimal since the type is already specified. So, if one of the rates is not specified the program will fail at a later stage when it tries to use this NoneType rate (which would be ugly).I did think of these scenarios when I was creating this PR and I had a function to manually validate all these conditions but I felt it's getting too complicated for a tool that will mostly be run automatically. But I'd be happy to add the validation back. I am going to first see if I can use the mutually exclusive groups, if not I'll had some custom argument validation for these.
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.
Yeah, there's a reason I marked the PR as "approved" :).
On second thought, it might be tricky to make this behave the way I was thinking.
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.
In that case, I am going to go ahead and merge this.