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

Set projects_folder via env var #188

Closed
janosh opened this issue Sep 20, 2024 · 4 comments · Fixed by #189
Closed

Set projects_folder via env var #188

janosh opened this issue Sep 20, 2024 · 4 comments · Fixed by #189

Comments

@janosh
Copy link
Collaborator

janosh commented Sep 20, 2024

Small QoL suggestion: would be nice if the projects_folder which currently can only be configured in ~/.jfremote.yaml could also be set via env var JF_REMOTE_PROJECTS_FOLDER. one motivation for this is that some HPC setups don't provide access to the home folder from compute nodes

projects_folder: str = Field(
DEFAULT_PROJECTS_FOLDER, description="Location of the projects files."
)

@gpetretto
Copy link
Contributor

If I understand correctly your request, this should already be possible, since the settings are a pydantic BaseSettings: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#environment-variable-names

For example I regularly set my default project with export jfremote_project=$PROJECT_NAME. In principle you could also change the path of the config file ~/.jfremote.yaml by setting the environment variable jfremote_config_file and have it in some other path than the home.

Does this solve your issue?

@janosh
Copy link
Collaborator Author

janosh commented Sep 21, 2024

thanks for the quick reply! this was what i was looking for

export JFREMOTE_PROJECTS_FOLDER=/dir/to/jf_remote/configs

would be great to document the env var prefix JFREMOTE_ for any JobflowRemoteSettings attribute

@gpetretto
Copy link
Contributor

Actually it is already documented: https://matgenix.github.io/jobflow-remote/user/projectconf.html#general-settings
I admit it may not be that easy to spot. If you have a suggestion of where to move it to make it more reachable I can update it.

@janosh
Copy link
Collaborator Author

janosh commented Sep 21, 2024

i remember now seeing the docs you linked before. just forgot about them. my bad!

i think that's already the best place to document them. if you search for "environment variable" on that page, it only comes up once at the top. the term isn't used again at the bottom where the variable names are actually used. i think adding a subsection titled "Environment Variables" listed under "On this page" would help discoverability. and CONSTANT_CASING the variable names could also help since that's what i'm looking for when skimming the page

@gpetretto gpetretto linked a pull request Sep 23, 2024 that will close this issue
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 a pull request may close this issue.

2 participants