Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested configurable resources not initialised if all the fields have default values #27223

Open
tonyyzy opened this issue Jan 20, 2025 · 3 comments
Labels
area: config Related to Configuration area: resource Related to Resources type: bug Something isn't working

Comments

@tonyyzy
Copy link

tonyyzy commented Jan 20, 2025

What's the issue?

  • ConfigurableResource A is used to configure ConfigurableResource B
  • Run time config is set on A
  • If all A's fields have default values, B does not see the run time configs

What did you expect to happen?

B would get the runtime config via A

How to reproduce?

from dagster import (
    ConfigurableResource,
    asset,
    materialize,
)


class ResourceA(ConfigurableResource):
    date: str = "2025-01-20"


class ResourceB(ConfigurableResource):
    resource_a: ResourceA


@asset
def test_asset(resource_A: ResourceA, resource_B: ResourceB) -> None:
    print("resource A's date: ", resource_A.date)
    print("resource B's resource A's date: ", resource_B.resource_a.date)


resource_A = ResourceA.configure_at_launch()
materialize(
    [test_asset],
    resources={
        "resource_A": resource_A,
        "resource_B": ResourceB.configure_at_launch(resource_a=resource_A),
    },
    run_config={
        "loggers": {"console": {"config": {"log_level": "ERROR"}}},
        "resources": {"resource_A": {"config": {"date": "2025-01-21"}}},
    },
)

This gives

resource A's date:  2025-01-21
resource B's resource A's date:  2025-01-20

while I'd expect

resource A's date:  2025-01-21
resource B's resource A's date:  2025-01-21

If some fields of A do not have default values

from dagster import (
    ConfigurableResource,
    asset,
    materialize,
)


class ResourceA(ConfigurableResource):
    date: str


class ResourceB(ConfigurableResource):
    resource_a: ResourceA


@asset
def test_asset(resource_A: ResourceA, resource_B: ResourceB) -> None:
    print("resource A's date: ", resource_A.date)
    print("resource B's resource A's date: ", resource_B.resource_a.date)


resource_A = ResourceA.configure_at_launch()
materialize(
    [test_asset],
    resources={
        "resource_A": resource_A,
        "resource_B": ResourceB.configure_at_launch(resource_a=resource_A),
    },
    run_config={
        "loggers": {"console": {"config": {"log_level": "ERROR"}}},
        "resources": {"resource_A": {"config": {"date": "2025-01-21"}}},
    },
)

This gives the expected output

resource A's date:  2025-01-21
resource B's resource A's date:  2025-01-21

Dagster version

dagster, version 1.9.9

Deployment type

None

Deployment details

No response

Additional information

No response

Message from the maintainers

Impacted by this issue? Give it a 👍! We factor engagement into prioritization.

@tonyyzy tonyyzy added the type: bug Something isn't working label Jan 20, 2025
@garethbrickman garethbrickman added area: config Related to Configuration area: resource Related to Resources labels Jan 21, 2025
@garethbrickman
Copy link
Contributor

1.7.16 is quite an old version- is this reproducible after 1.9.0?

@tonyyzy
Copy link
Author

tonyyzy commented Jan 21, 2025

Thanks @garethbrickman , can confirm same behaviour with version 1.9.9

@deepyaman
Copy link
Contributor

deepyaman commented Jan 23, 2025

It looks like this works correctly on master. I can confirm the reported behavior on release-1.9.9, as well as release-1.9.10.

Update: Hunted it down; the bug was fixed in #27210. Unfortunately, it didn't make it into the 1.9.10 release earlier today, but it should be resolved in the next release.

deepyaman added a commit that referenced this issue Jan 28, 2025
## Summary & Motivation

Guard against regression of #27223

## How I Tested These Changes

Local run + BK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: config Related to Configuration area: resource Related to Resources type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants