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

Ben Gatewood

08/22/2022, 5:54 AM
Would quite like to use the new
output_required=False
asset keyword that came in 1.0.4 but it appears to only be applicable to assets defined with the
@asset
decorator. How do I apply it to a graph backed asset?
dagster bot responded by community 1
v

Vinnie

08/22/2022, 6:25 AM
You can define an output for a graph backed asset with
AssetOut
(I think it’s not in the docs, but works) and set the flag
is_required=False
https://github.com/dagster-io/dagster/blob/master/python_modules/dagster/dagster/_core/definitions/asset_out.py#L17
b

Ben Gatewood

08/22/2022, 6:29 AM
Yeah ok I see. That needs to go on the underlying
op
right?
v

Vinnie

08/22/2022, 6:30 AM
I think it can go in the graph as well, but don’t really recall since I ultimately went with a different pattern for my use case.
You can probably use it in both if I were to wager a bet
b

Ben Gatewood

08/22/2022, 6:31 AM
Cool - will have a play with it and see what works. Thanks! (also, if you could/are willing to share a very brief description of the alternate path you chose I'd appreciate it a lot)
v

Vinnie

08/22/2022, 6:33 AM
For my use case I needed a graph-backed multi-asset and that doesn’t allow me to
yield
the output, since it has to be dynamic, I ultimately just used a
@multi_asset
b

Ben Gatewood

08/22/2022, 6:33 AM
ahh ok gotcha - thanks!
v

Vinnie

08/22/2022, 6:35 AM
Take my last message with a grain of salt though, maybe I didn’t play around with it enough to find the solution (it’s also a couple weeks back). There’s this suggested approach https://github.com/dagster-io/dagster/discussions/9358 but it doesn’t exactly scale too well if I’m processing something like 10 assets from a single email
b

Ben Gatewood

08/22/2022, 6:38 AM
Yeah honestly I'm struggling a bit getting all the pieces lined up with assets - lots of possible combos
Hm also that solution doesn't seem to work with partitioned assets. Or, at least, I can't figure out all the places that apparently need the partition definition - putting it in the
op
and the
AssetDefinition
doesn't seem to be enough
39 Views