Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@MattToast
Copy link
Member

This PR implements a RunSettings.set which is able to programmatically set run arguments:

  • Method is able to format user provided arguments to how they are expected to be present in the run_args dictionary.
  • Subclasses of RunSettings are able to further restrict arguments that may conflict with SmartSim's process by providing their own restricted arguments.
  • Adds test confirming expected behavior

Looking for feedback and/or additional arguments that should be restricted in the subclasses.

@MattToast MattToast requested a review from Spartee March 7, 2022 19:17
@MattToast MattToast linked an issue Mar 7, 2022 that may be closed by this pull request
3 tasks
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.

Couple changes. Let me know your thoughts on the condition flag

Merge remote-tracking branch 'upstream/develop' into rs-set-arg
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.

Minor comments, mostly on docstrings. Great stuff!

rs = RunSettings("python")
rs.set("an-arg", "a-val")
rs.set("a-flag")
rs.run_args["an-arg"] # returns "a-val"
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally users shouldn't know that run_args exist now and solely use .set() if you want to show the arguments in the docstring then lets call a user facing method like RunSettings.format_run_args

Copy link
Member Author

Choose a reason for hiding this comment

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

Does this mean that we should be moving run_args -> _run_args or is that considered out of scope for this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Leaving as is for now, fixed docstr in 4a10a76

"""allows users to set individual run arguments. Does
basic formating such as stripping leading dashes.
This method also ensures that the argument being set
Copy link
Contributor

Choose a reason for hiding this comment

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

So we don't actually check that it IS valid. Lets just state that condition can be used to write scripts that will adapt under variables that can be changed at runtime. like, for example, the hostname one.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in 4a10a76

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.

LGTM! Thanks for making those changes!

@MattToast MattToast merged commit e7d5a93 into CrayLabs:develop Mar 11, 2022
@MattToast MattToast deleted the rs-set-arg branch March 28, 2022 20:17
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.

RunSettings.set

2 participants