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

SlurmExecutor env_vars does not override ENV variables defined in the container image #128

Open
gwarmstrong opened this issue Dec 19, 2024 · 1 comment

Comments

@gwarmstrong
Copy link

If I have a docker file like:

FROM ubuntu:latest

ENV MY_VARIABLE="Hello, Docker!"

CMD ["bash", "-c", "echo $MY_VARIABLE"]

and I use a SlurmExecutor setting env_vars={"MY_VARIABLE": "Foo!"}, the variable MY_VARIABLE will not be overwritten and instead the result of executing the container would still be "Hello, Docker!".

In order to fix this, the SlurmExecutor needs to add a --container-env argument to the srun call that is a comma-separated list of variables to be exported from the environment, e.g.,

srun ... --container-env=MY_VARIABLE1,MY_VARIABLE2

It's possible this override behavior is not always wanted, so it might also be reasonable to introduce a flag to indicate whether variables should be overwritten or not (possibly on a per-variable basis).

@gwarmstrong gwarmstrong changed the title SlurmExecutor env_vars does not override ENV variables defined in the container SlurmExecutor env_vars does not override ENV variables defined in the container image Dec 19, 2024
@hemildesai
Copy link
Collaborator

Hi, yes we will add an option to configure --container-env in the executor. Thanks for reporting!

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