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

Allow setting environment variable automatically for jobs #7

Closed
omry opened this issue Jun 27, 2019 · 12 comments · Fixed by #570
Closed

Allow setting environment variable automatically for jobs #7

omry opened this issue Jun 27, 2019 · 12 comments · Fixed by #570
Labels
enhancement Enhanvement request good first issue Good for newcomers
Milestone

Comments

@omry
Copy link
Collaborator

omry commented Jun 27, 2019

This is low priority at the moment, please vote up if you will find it useful.

Control of env variables for launched jobs.
This could be based on a special node in the job config:

env:
  OMP_NUM_THREADS: 1 
  # copy env from running machine
  USER: ${env:USER} 

TO BE CLEAR:
You can already use environment variables in configs:
See the OmegaConf documentation.

This issue is about allowing easier control of the environment variable of Hydra apps for other purposes (for example, setting OMP_NUM_THREADS automatically to 1).

@omry omry added the enhancement Enhanvement request label Jul 2, 2019
@omry omry added this to the 0.12.0 milestone Nov 7, 2019
@omry omry self-assigned this Jan 19, 2020
@omry omry added the good first issue Good for newcomers label Jan 19, 2020
@omry omry removed their assignment Jan 19, 2020
@sackh
Copy link

sackh commented Apr 2, 2020

Will this also allow overriding config from environment variable? similar to overriding from the command line

@omry
Copy link
Collaborator Author

omry commented Apr 2, 2020

This is already possible (although not similar to overriding from the command line).
See the OmegaConf documentation.

@sackh
Copy link

sackh commented Apr 2, 2020

I think it will be a good idea to make overriding config from the environment variable consistent with overriding using the command line approach.

@omry
Copy link
Collaborator Author

omry commented Apr 2, 2020

How can you make two things that are completely different consistent with each other?
If you want me to take this suggestion seriously, make it more concrete. I have no idea what kind of functionality you are thinking about.

regardless, please open a new issue against OmegaConf if you have a feature request. this is not the right place to discuss any such requests.

@deeplook
Copy link

deeplook commented Apr 2, 2020

OMG, this would be a super important feature. It's hard to believe it doesn't exist already...

@fcennecf
Copy link

fcennecf commented Apr 2, 2020

Hi, I'm sorry. it's an important enhancement. if we looked at containers, the main workflow would be using environment variables.
It would be great to have this enhancement soon.

@omry
Copy link
Collaborator Author

omry commented Apr 2, 2020

  1. This is a feature request to support automatically SETTING the environment variables for Hydra jobs.
  2. You can already USE environment variables in the config (see my edit to the task description).
  3. I am planning to add this functionality for the next Hydra version.
  4. This is marked as "good first issue", meaning it's not hard to implement.

If this is so important to people, they can step up and help.

@fcennecf
Copy link

fcennecf commented Apr 2, 2020

the environment variables for Hydra jobs.

Oh, miss that.

You can already USE environment variables in the config

Thank you

@omry omry changed the title Environment variable support Allow setting environment variable automatically for jobs Apr 2, 2020
@omry
Copy link
Collaborator Author

omry commented Apr 2, 2020

It was not clear from the issue description, I updated it.
I recommend everyone here spend the time to read the OmegaConf documentation. there are many good features there you should know about if you use Hydra.

@omry
Copy link
Collaborator Author

omry commented May 6, 2020

See this for details.

@rr-hari-prakash
Copy link

rr-hari-prakash commented Aug 31, 2022

See this for details.

page doesn't exist. Can we set ENV variables in hydra?

@Jasha10
Copy link
Collaborator

Jasha10 commented Sep 1, 2022

@rr-hari-prakash I've edited the link; it works now. Use the hydra.job.env_set variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhanvement request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants