Would quite like to use the new `output_required=F...
# ask-community
b
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
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
Yeah ok I see. That needs to go on the underlying
op
right?
v
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
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
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
ahh ok gotcha - thanks!
v
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
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