Stefan Adelbert
12/09/2021, 3:10 AMA
, which depends on another resource, B
, I can use required_resource_keys
as described here: https://docs.dagster.io/concepts/resources#resource-to-resource-dependencies.
But let's say that I want to have two instances of resource A
configured differently, and I want those two instances to depend on two different instances of resource B
- I don't know how to achieve that. If resource A
looks like this:
@resource(required_resource_keys={"b"})
def A:
return None
Then two instances of A
, a1
and a2
, depend on an instance of a resource called b
, but really I would like a1
to depend on b1
and a2
to depend on b2
.
Is there a way to achieve this?chris
12/09/2021, 8:05 PMA
configured differently, and I want those two instances to depend on two different instances of resource B
Is a limitation of the existing system, tracked by this issue. Those two instances of resource A
will implicitly depend on the same resource key, and there's no way to remap the dependent resource key to something else. This problem can occur for ops too in the same way (I have two configurations of the same op, that I want to depend on different resources)Stefan Adelbert
12/09/2021, 9:30 PMchris
12/09/2021, 9:31 PMdef my_resource_factory(config, resource_key):
@resource(required_resource_keys={resource_key}, config_schema=...)
def my_resource():
...
return my_resource.configured(config)
Stefan Adelbert
12/09/2021, 9:35 PMchris
12/09/2021, 9:40 PMStefan Adelbert
12/09/2021, 10:01 PMchris
12/09/2021, 10:12 PMDagster Bot
12/09/2021, 10:12 PM