https://dagster.io/ logo
#dagster-support
Title
# dagster-support
d

Daniel Mosesson

12/05/2022, 6:22 PM
Is there a way of specifying an IO manager for assets only? I frequently want to do that, and its a bit of a pain to manage
o

owen

12/05/2022, 6:25 PM
hi @Daniel Mosesson -- can you say a bit more? is this a situation where you want there to be some sort of error if an iomanager is applied to a non-asset output, or something else?
d

Daniel Mosesson

12/05/2022, 6:27 PM
I have a number of different assets and other ops in a module, and I want anything that is produced as an asset to use io_manager1, and anything that is for between op computation and the like to use asset_manager2 (or the default one most likely)
o

owen

12/05/2022, 6:30 PM
ah I see -- and by "between op computation", is this for graph-backed assets, or fully separate op computations?
d

Daniel Mosesson

12/05/2022, 6:31 PM
more the second one, though I do have a few cases of the first
o

owen

12/05/2022, 6:34 PM
got it -- there's no built in way of doing this, but one pattern we've seen people use pretty successfully is making a custom
@my_asset
decorator. In your case, it'd just need to pass in an
io_manager_key="asset_io_manager"
to the existing
io_manager
(alongside whatever other custom kwargs you want to pass through). This at least takes away the manual effort of having to remember to set that custom key on every single asset
another pattern is to build a custom IOManager that forks its behavior based on if
context.asset_key
is None or not
this is actually how the default IOManager works
d

Daniel Mosesson

12/05/2022, 6:35 PM
the first option is something that I should probably be doing anyway
10 Views