-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[pythonic config][alternate] properly propagate default values set at the top level for nested config classes #27209
base: benpankow/partial-support
Are you sure you want to change the base?
Conversation
… the top level for nested config classes
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@@ -433,7 +433,6 @@ def infer_schema_from_config_class( | |||
" definition. 'dagster.Field' should only be used in legacy Dagster config" | |||
" schemas. Did you mean to use 'pydantic.Field' instead?" | |||
) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strange
inferred_field = _apply_defaults_to_schema_field( | ||
inferred_field, | ||
pydantic_field.default._convert_to_config_dictionary(), # noqa: SLF001 | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
a_job.execute_in_process( | ||
{ | ||
"ops": { | ||
"a_struct_config_op": { | ||
"config": {"a_string": "foo", "a_nested": {"inner_config": {"a_float": 3.0}}} | ||
} | ||
} | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert result.success. Also, maybe a test on executing with no config at all (should be possible now right)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏
Summary
Alternate implementation of #27206 which relies on the partial config utilities from #12870
Ensures that default values on Pythonic Config get properly propagated to inner Config classes, e.g.
Test Plan
New unit test; todo add a few more