Open fahadkh opened 2 months ago
Not sure if this is the same root cause as this issue:
from dagster import ConfigurableResource, op, job, ResourceDependency
# Dagger
class UpstreamResource(ConfigurableResource):
param: str
class DownstreamResource(ConfigurableResource):
upstream: ResourceDependency[UpstreamResource]
def do_something(self):
return f"upstream param is: {self.upstream.param}"
# User job.py
@op()
def my_op(outer: DownstreamResource):
return outer.do_something()
@job()
def my_job():
my_op()
# User defs.py
from dagster import Definitions
defs = Definitions(
jobs=[my_job],
resources={
"outer": DownstreamResource(upstream=UpstreamResource.configure_at_launch())
},
)
# User job.py
run_config = {
"resources": {"outer": {"config": {"upstream": {"param": "configured at launch"}}}}
}
# Execute the job with the provided run configuration
result = defs.get_job_def("my_job").execute_in_process(run_config=run_config)
print(result.success)
Results in this error: dagster._check.CheckError: Invariant failed. Description: Any partially configured, nested resources must be provided to Definitions object: {'upstream': None}
Dagster version
dagster, version 1.6.14
What's the issue?
When working with nested Pythonic resources, the
from_resource_context_cm
does not properly instantiate an instance with nested resources defined.For example:
errors with:
What did you expect to happen?
The instantiated resource should have a properly instantiated nested resource (i.e. the test case above should pass)
How to reproduce?
Full test case:
Deployment type
Other Docker-based deployment
Deployment details
Running on kubernetes
Additional information
May be related to https://github.com/dagster-io/dagster/pull/19422
Message from the maintainers
Impacted by this issue? Give it a 👍! We factor engagement into prioritization.