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

Validate Slurm Timing format #471

Merged
merged 5 commits into from
Jan 31, 2024

Conversation

amandarichardsonn
Copy link
Contributor

@amandarichardsonn amandarichardsonn commented Jan 30, 2024

This PR merges in functionality to validate the timing format when requesting a slurm allocation. Previously, no check was required leading to the WLM responsibility to throw an error. With the new code, SmartSim will catch and throw.

@amandarichardsonn amandarichardsonn changed the title test Validate Slurm Timing format Jan 30, 2024
Copy link

codecov bot commented Jan 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7803f4d) 90.81% compared to head (e340b24) 90.72%.
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #471      +/-   ##
===========================================
- Coverage    90.81%   90.72%   -0.10%     
===========================================
  Files           60       60              
  Lines         3834     3837       +3     
===========================================
- Hits          3482     3481       -1     
- Misses         352      356       +4     

see 5 files with indirect coverage changes

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.

One small question/suggestion! Otherwise, LGTM!!

Comment on lines 293 to 297
delta = datetime.timedelta(hours=hours, minutes=minutes, seconds=seconds)
fmt_str = str(delta)
if delta.seconds // 3600 < 10:
fmt_str = "0" + fmt_str
return fmt_str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on breaking these lines out into a helper function that can be used both here and in smartsim.settings.slurmSettings.SrunSettings._fmt_walltime? That way if we have to update how to format the walltime for slurm we only need to touch one spot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm hm _fmt_walltime in smartsim.settings.slurmSettings.SrunSettings is never used, so Ill add it to set_walltime and break it out into a helper func, I was hesitant on that at first bc I wasnt sure about using helper funcs in outside folders but that makes more sense

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!! Thanks for making sure our slurm rules stay consistent!!

@@ -256,13 +256,9 @@ def _fmt_walltime(hours: int, minutes: int, seconds: int) -> str:
:param seconds: number of seconds to run job
:type seconds: int
:returns: Formatted walltime
:rtype
:rtype: str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!! Thanks for fix!!

@amandarichardsonn amandarichardsonn merged commit 948d97c into CrayLabs:develop Jan 31, 2024
34 checks passed
@amandarichardsonn amandarichardsonn deleted the slurm-time branch January 31, 2024 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants