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

Add new RunSettings Methods #170

Merged
merged 20 commits into from Mar 28, 2022
Merged

Add new RunSettings Methods #170

merged 20 commits into from Mar 28, 2022

Conversation

MattToast
Copy link
Member

Adds new RunSettings methods to grow the list of interface functions that are available across all RunSettings objects where possible. Methods added for similar arguments that are shared by two or more of the existing RunSettings sub-classes.

Do let me know if I am missing any additional methods for arguments that should be included, or implementations for existing RunSettings.

@MattToast MattToast linked an issue Mar 14, 2022 that may be closed by this pull request
7 tasks
Copy link
Collaborator

@al-rigazzi al-rigazzi left a comment

Choose a reason for hiding this comment

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

Looks good. I'd just like to understand better what was the criterion to decide which option should get a method and which not. Maybe we chat about it?
Also, I really like the warning approach for missing functions, it will help unifying driver scripts!

smartsim/settings/base.py Outdated Show resolved Hide resolved
smartsim/settings/alpsSettings.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Mar 18, 2022

Codecov Report

❗ No coverage uploaded for pull request base (develop@e7d5a93). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop     #170   +/-   ##
==========================================
  Coverage           ?   81.48%           
==========================================
  Files              ?       57           
  Lines              ?     2954           
  Branches           ?        0           
==========================================
  Hits               ?     2407           
  Misses             ?      547           
  Partials           ?        0           

@MattToast
Copy link
Member Author

@al-rigazzi Thanks for the review!

Issue #161 goes into more detail, but basically the deciding factor for whether or not an option got made into method on the base class was whether or not is the the same or very similar functionality existed on at least two of the supported interfaces (slurm, jsrun, etc).

I did my best to try and parse docs for each of the interfaces and I think I got most of the common options (at least all the options I understood). If you can think of any other arguments I missed, do lmk and I can add them in asap!!

Copy link
Contributor

@Spartee Spartee left a comment

Choose a reason for hiding this comment

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

Good stuff! A couple things

  1. there are still gaps between the implementations. ex. SrunSettings has set_nodes and few others do each class should have the exact same methods available that will raise warnings in the case where it's not implemented. there should not be an AttributeError raised if I call the same methods across all classes. this is with the exception of JsrunSettings which needs weird special methods for resource sets. more on this later

  2. I think we should provide a better interface for time across all the settings. I think we should be doing the translation to a string walltime. All the batch settings implement set_walltime and I think we should also provide set_time which takes in the suggestion i commented above as arguments and then formats and calls set_walltime if its a BatchSettings class.

  3. @al-rigazzi why does AprunSettings randomly implement set_walltime? was there a need for that? you're on the git blame.

  4. Instead of set_timeout lets call it set_time and implement the suggestion above. One helper method in the base class to do the time conversion and those classes that need to can override.

  5. set_hostlist_from_file is another I think that could be implemented across all of them.

  6. @al-rigazzi Is there a strict reason why we need to continue supporting the resource set semantics of LSF? can we get away with just node/task/etc if we mention that this is an alias for resource sets? I would like to get consistent.

self.set_cpus_per_rs(cpus_per_task)
self.set_cpus_per_rs(int(cpus_per_task))

def set_memory_per_rs(self, memory_per_rs):
Copy link
Contributor

Choose a reason for hiding this comment

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

@al-rigazzi do you think we should continue to have these aliases? or just implement the specification?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Spartee (cc @MattToast): Answering this and your general comment: I am not really sure we can map everything in LSF to node/task/etc. We can try, and simply say that for everything else, a standard run_arg method can be used.

About set_walltime in AprunSettings. I cannot think of a reason why we should have it now, I guess it made sense in an old version of the library, possibly.

smartsim/settings/mpirunSettings.py Outdated Show resolved Hide resolved
smartsim/settings/mpirunSettings.py Outdated Show resolved Hide resolved
smartsim/settings/slurmSettings.py Outdated Show resolved Hide resolved
@Spartee
Copy link
Contributor

Spartee commented Mar 19, 2022

also, whitespace!!!! purge it! ha

@MattToast MattToast requested a review from Spartee March 23, 2022 18:09
Copy link
Contributor

@Spartee Spartee 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 comment

smartsim/settings/base.py Show resolved Hide resolved
@MattToast MattToast requested a review from Spartee March 24, 2022 20:19
Copy link
Contributor

@Spartee Spartee left a comment

Choose a reason for hiding this comment

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

Approving in advance based on conversation about unifying the return type of the format_env_vars command

@MattToast MattToast merged commit fcdc44d into CrayLabs:develop Mar 28, 2022
This was referenced Mar 28, 2022
MattToast added a commit that referenced this pull request Mar 28, 2022
Append a change to #170. Changes call to
`SrunSettings.format_env_vars` to 
`SrunSettings.format_comma_sep_env_vars`
in `SrunStep`
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.

Address gaps in RunSettings implementations
4 participants