is there a way to pass an asset value to a resourc...
# ask-community
p
is there a way to pass an asset value to a resource_def? e.g.
Copy code
@asset
def asset1():
  return '/target_folder'

@asset(required_resource_keys={'results_io_manager'})
def calc_something():
  return 1+1

@repository
def my_repo():
return[
*with_resources([asset1, calc_something]
    , resource_defs={
        "results_io_manager": local_pkl_io_manager.configured({"base_dir": asset1}),
]
c
I think you could technically do this by including the io manager as a required key to another resource, and manually extracting using the IO manager, but it's definitely an abuse of the abstractions. What's your use case?
laugh cry 1
p
I think my use case is simple: • have a set of assets that produce data which is stored in a folder • the folder is defined via inputting an id -> putting this in to the launchpad would be great, so scaffolding missing configs is a nice feature
So I thought: • having an asset/resource/op that basically just takes a run id and then returns a folder • then the result of this first step is passed to the io manager configuration • then all the other assets that I want to store output in a specific place, use the io manager
message has been deleted
This asset returns a string which would be the path for base_dir for the io manager
Probably a better way to achieve similar outcome though, right?