https://dagster.io/ logo
#ask-community
Title
# ask-community
s

Scott Hood

04/01/2022, 6:57 PM
Hey all, what is the best practice for setting variables on the job itself, for example, if I wanted to set the value for "environment" and have it retrievable from any op what would be the best way? Currently, I am just setting it on the ops that need it via config, however, for bigger jobs I could see this being tedious. Also don't want to set it via environment variable because I want it more as a configurable option than something you have to set outside of dagster itself.
c

claire

04/01/2022, 7:15 PM
Hey Scott, If you don't want to provide a config for every op individually, you could create a resource that contains the config variables you need: https://docs.dagster.io/concepts/configuration/config-schema#passing-configuration-to-multiple-ops-in-a-job
s

Scott Hood

04/01/2022, 7:18 PM
Huh, I was actually doing this before however didn't necessarily feel that was a proper use case for Resources (or thought there might be another way).
y

yuhan

06/16/2022, 8:22 AM
👋 We wrote some example code for this use case in this GitHub discussion. Please feel free to leave a comment/answer there as well.