Is there a way of specifying an IO manager for ass...
# ask-community
d
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
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
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
ah I see -- and by "between op computation", is this for graph-backed assets, or fully separate op computations?
d
more the second one, though I do have a few cases of the first
o
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
the first option is something that I should probably be doing anyway