Hello! it is possible to have environment variable...
# ask-metaflow
m
Hello! it is possible to have environment variables in the metaflow config file? I am trying to run gpu instances and I needed some environment variables to make them work with cuda, and it would be much better for us to just include those as default
Copy code
@environment(
        vars={
            'NVIDIA_DRIVER_CAPABILITIES': 'compute,utility',
            'CUDA_VISIBLE_DEVICES': '0,1',
        }
    )
🆙 1
s
m
thanks for your recommendation, I will take it on count but I am looking into something where the user do not need to be aware of this envs variables
s
thing is - metaflowconfig kinda dictates the behavior of metaflow itself. If you have custom env variables that need to be injected into the FLOW you should use either the @environment decorator OR flow parameters. Coupling flow env vars with metaflow config seems sub optimal - since the metaflow config can be the same across multiple flows - but your env vars might need to be tailored per flow
a
you could inject an environment variable into your user's environment to do something of the sort of
Copy code
METAFLOW_DECOSPECS="environment:vars=<json dump of env vars>" python flow.py run
this is functionally equivalent to
Copy code
python flow.py run --with environment:vars=<json dump of env vars>
which is equivalent to applying the
@environment
decorator to each step