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

Update example configs to reduce duplication #357

Open
tomeichlersmith opened this issue Mar 21, 2023 · 1 comment
Open

Update example configs to reduce duplication #357

tomeichlersmith opened this issue Mar 21, 2023 · 1 comment

Comments

@tomeichlersmith
Copy link
Collaborator

tomeichlersmith commented Mar 21, 2023

This will just make the config files more portable and reduce duplication since most folks have all their hps stuff underneath one parent directory.

This can be achieved by providing a [DEFAULT] section at the top of the config file and then using the variable-expansion syntax %(variable_name)s. For example, I do the following:

# define where all my HPS stuff is
[DEFAULT]
hps_home = /full/path/to/hps/working/dir

# can reference that root directory in the rest of the config parameters
[MG4]
madgraph_dir = %(hps_home)s/mc/generators/madgraph4/src

We could also support all environment variables by providing the os.environ map to the ConfigParser constructor as "defaults". Then folks could pull (for example) %(HPS_HOME)s from the environment instead of having to change the config file.

@JeremyMcCormick
Copy link
Member

I like the usage of an hps_home var to reduce duplication, though I don't think I would load the full environment into the config parser. Part of the point of using these config files is separating the hps-mc configuration from the OS environment.

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

No branches or pull requests

2 participants