https://dagster.io/ logo
Title
m

Mitchell Hynes

12/11/2022, 3:00 AM
What’s a good way to dependency-inject resources from a Job run? I have a sensor and depending on which condition triggered the RunRequest, I want to use different resources.
I’d also be okay with configuring a resource too. But I can’t figure out how to do that via Run Configs.
Ohhh, I think
build_resources
is what I want.
s

sandy

12/13/2022, 12:55 AM
Hi @Mitchell Hynes - you can configure resources from your sensor with something like this:
return RunRequest(run_config={"resources": {"my_resource_x": {"config": {"my_key": "my_value"}}}})
m

Mitchell Hynes

12/13/2022, 1:38 AM
Ohh, sweet. Are there docs for what
run_config
takes? My intuition pointed me to the job parameters you use in the launchpad match up with it because they looked similar, but I couldn’t get it to do what I wanted to without parameterizing resources for each op which would have been a lot of code.
I ended up going with separate code locations because it was more idiomatic to the framework for what I was doing but I want to explore this more
s

sandy

12/13/2022, 4:47 PM
Are there docs for what
run_config
takes?
Hmm, it looks like perhaps not. I will surface that to our docs folks