https://dagster.io/ logo
Title
e

Eegan K

10/12/2022, 2:40 PM
Hello, Is there a way to make an optional resource key for an op? Essentially I have a test entrypoint for dagster which runs on local files, but the norm is for dagster to run using databases, etc. So, I want multiple ops to run if there is a value at a certain resource, but it should be possible for that value to be None.
Easy way would be to use hasattr but was hoping there was something better.
z

Zach P

10/12/2022, 3:31 PM
Youd probably want to configure those tests to pass different resource settings, or a different resource.
Also, if you just want it to run without passing anything at all you can pass a “None Resource”, which will still pass the resource requirements but not resolve to any actual db resources
1
e

Eegan K

10/12/2022, 3:33 PM
thanks!
y

yuhan

10/12/2022, 6:58 PM
Thanks @Zach P! That’s be what I’d recommend too. Additionally, if you’d like to run certain ops based on a resource value, you can set up Conditional Branching in your job/graph.