-
Notifications
You must be signed in to change notification settings - Fork 37
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
Raising error for reserved keywords under function parameter options in get_allocation #325
Conversation
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.
LGTM pending a couple of knit picks and stripping the whitespace!!
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #325 +/- ##
===========================================
- Coverage 87.30% 87.18% -0.13%
===========================================
Files 59 59
Lines 3522 3519 -3
===========================================
- Hits 3075 3068 -7
- Misses 447 451 +4
|
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.
Very small change requested. Otherwise thanks for fixing this silent, but very weird piece of behavior!
@@ -28,7 +28,7 @@ | |||
|
|||
import pytest | |||
|
|||
from smartsim.error import AllocationError | |||
from smartsim.error import AllocationError, SSConfigError |
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.
Were you intending to raise the ValueError
on line 58 with a SSConfigError
? That's probably a more accurate and specific error
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.
I have gotten mixed reviews on which error I should throw. I believe it was @MattToast that suggested I switch to a value error
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.
@ashao, my argument was that in the past the SSConfigError
has been used for when SmartSim has not been correctly built (e.g. the user has not run smart build
). For example:
raise SSConfigError(
"RedisAI dependency not found. Build with `smart` cli "
"or specify RAI_PATH"
)
I'd be okay as creating a new, more appropriate error, but I'm going to strongly push against using SSConfigError
as it is a subclass of an SSInternalError
and we raise here due to bad user input, not due to something wrong within SmartSim:
class SSInternalError(Exception):
"""
SSInternalError is raised when an internal error is encountered.
"""
class SSConfigError(SSInternalError):
"""Raised when there is an error in the configuration of SmartSim"""
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.
Ah I see. I'd prefer a new error class just to give us a bit better granularity on the exceptions we can catch. ValueError
seems a bit too generic for this one for my liking. @juliaputko , @MattToast how do you feel about SSReservedKeyword
?
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.
I see Matt's req for a ticket to handle the TODO, but otherwise looks great to me.
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.
Looks great! Thank you for the change
Added error if a user calls get_allocation with reserved keywords (nodes, account, time) as options eg. get_allocation(options={"account"="ACCOUNT"}).
Added test to ensure error is correctly thrown.