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

Improve parameter handling with and without generation #107

Merged
merged 5 commits into from
Nov 16, 2021

Conversation

al-rigazzi
Copy link
Collaborator

@al-rigazzi al-rigazzi commented Nov 1, 2021

This PR enhances the current way parameters and models are generated in two ways:

  • add the possibility of specifying arg_params in Ensembles: arg_params are treated like params but set as exe_args in the created Models -- thus they are set even without the generation step.
  • allow multiple tagged parameters on same line

This PR resolves #16 #40

@al-rigazzi al-rigazzi linked an issue Nov 1, 2021 that may be closed by this pull request
@al-rigazzi al-rigazzi self-assigned this Nov 1, 2021
@al-rigazzi al-rigazzi added the type: feature Issues that include feature request or feature idea label Nov 1, 2021
@Spartee
Copy link
Contributor

Spartee commented Nov 3, 2021

A few questions about this implementation

  1. Should params and arg_params be separate? Why?
  2. If they should be separate, shouldn't Model also have arg_params?
  3. What happens if a conflicting argument is placed in both arg_params and in params?

My main concern is that this isn't entirely straightforward given the naming convention.

Alternative approaches to consider:

  • a flag, params_as_args that specifies if the params argument should be used as command line args
  • a method, Ensemble.params_to_args() that calls Model.params_to_args on each model in the ensemble.

thoughts on those?

Either way I think Models should have this too.

@al-rigazzi
Copy link
Collaborator Author

Thanks for the review, @Spartee!

I agree, naming is confusing. I think it is fine to just call all of them params, and then have a method that uses info given in params_as_args to generate the corresponding command line arguments.

I'll adapt the code in the following way:

  • all parameters are specified as params
  • a list params_as_args has to be passed to specify whether a param has to be turned into an argument, this is then also set in all Models in the Ensemble
  • in Ensemble._initialize_entitities(), the function params_to_args() is called, and this is called on each Model in the Ensemble.

The only minor drawback is that params_as_args in Model, is not particularly useful when not running within an ensemble (it somehow just duplicates what can be done with exe_args, since a single model is not parameterized).

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 comment but otherwise LGTM

if not param in self.params:
raise SSConfigError(f"Tried to convert {param} to command line argument " +
f"for Model {self.name}, but its value was not found in model params")
if self.run_settings is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

will this case ever happen?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Spartee it seems like we don't check whether run_settings is None, thus a very bad user might initialize a Model with run_settings=None. I don't know if there is any reason why we are allowing this, otherwise we might want to guard against it in another part of the code?

Copy link
Contributor

Choose a reason for hiding this comment

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

yea I think step creation would just fail, but when we go to the server arch I think thisll be more important.

@al-rigazzi al-rigazzi merged commit fa7ffe5 into CrayLabs:develop Nov 16, 2021
@al-rigazzi al-rigazzi deleted the ens_exe_args branch November 16, 2021 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature Issues that include feature request or feature idea
Projects
None yet
2 participants