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

Raising error for reserved keywords under function parameter options in get_allocation #325

Merged
merged 25 commits into from
Jul 31, 2023

Conversation

juliaputko
Copy link
Contributor

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.

Copy link
Member

@MattToast MattToast left a 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!!

smartsim/wlm/slurm.py Outdated Show resolved Hide resolved
tests/full_wlm/test_slurm_allocation.py Outdated Show resolved Hide resolved
tests/full_wlm/test_slurm_allocation.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

Merging #325 (295ae72) into develop (4c741be) will decrease coverage by 0.13%.
Report is 2 commits behind head on develop.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@             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     
Files Changed Coverage Δ
smartsim/error/__init__.py 100.00% <ø> (ø)
smartsim/error/errors.py 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

smartsim/wlm/slurm.py Outdated Show resolved Hide resolved
Copy link
Member

@ashao ashao left a 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
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

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"""

Copy link
Member

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?

Copy link
Contributor

@ankona ankona left a 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.

Copy link
Member

@ashao ashao left a 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

@juliaputko juliaputko merged commit b3484b6 into CrayLabs:develop Jul 31, 2023
10 checks passed
@juliaputko juliaputko deleted the jp116 branch July 31, 2023 20:29
@MattToast MattToast added area: launcher Issues related to any of the launchers within SmartSim type: usability Issues related to ease of use labels Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: launcher Issues related to any of the launchers within SmartSim type: usability Issues related to ease of use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants