-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Pass loading context through _blocking_batch_load #25377
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
206d74c
to
9291fd1
Compare
47d27bd
to
18a7084
Compare
9291fd1
to
9be1378
Compare
18a7084
to
c6bd3cd
Compare
9be1378
to
4a1a5a3
Compare
c6bd3cd
to
2e65c08
Compare
if not issubclass(ttype, InstanceLoadableBy): | ||
check.failed(f"{ttype} is not Loadable") | ||
|
||
batch_load_fn = partial(ttype._batch_load, instance=self.instance) # noqa | ||
blocking_batch_load_fn = partial(ttype._blocking_batch_load, instance=self.instance) # noqa |
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.
when I first set this up I imagined we might have other _X_LoadableBy
which would bind _X_
instead of the instance
for fetching, so in this case ContextLoadableBy
i'm not sure that having different flavors is necessary in the end here - but we might want to drop the Instance
part of the naming for LoadableBy interface if we just want to always pass the context
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.
Yeah my thinking was that in a world where there are multiple things that we want to load with (i.e. multiple Xs), there would likely conceivably be singular objects that would want more than one of those Xs, and so at that point we'd probably just do this change anyway.
Agree LoadableBy
would be a better name (maybe that could be a followup to this PR?)
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.
follow up or in this PR is fine with me
4a1a5a3
to
0535e53
Compare
2e65c08
to
e66b775
Compare
0535e53
to
647eb5d
Compare
e66b775
to
f4fdc53
Compare
8721e6e
to
6963946
Compare
161dd6c
to
f9ba80d
Compare
if not issubclass(ttype, InstanceLoadableBy): | ||
check.failed(f"{ttype} is not Loadable") | ||
|
||
batch_load_fn = partial(ttype._batch_load, instance=self.instance) # noqa | ||
blocking_batch_load_fn = partial(ttype._blocking_batch_load, instance=self.instance) # noqa |
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.
follow up or in this PR is fine with me
6963946
to
34ba726
Compare
f9ba80d
to
3643d67
Compare
b0837ff
to
6e4b0df
Compare
3643d67
to
51882eb
Compare
6e4b0df
to
59e884b
Compare
51882eb
to
ef03572
Compare
59e884b
to
63c2dc8
Compare
b6f1c2f
to
3df060b
Compare
3df060b
to
45d68da
Compare
## Summary & Motivation This lets us use the loading_context for get_asset_status_cache_values, which saves us from needing to re-fetch the asset records in here again. Copied from demo PR dagster-io#25270 ## How I Tested These Changes Perf test before/after ``` pytest python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/perf_tests/test_perf.py ```
Summary & Motivation
This lets us use the loading_context for get_asset_status_cache_values, which saves us from needing to re-fetch the asset records in here again.
Copied from demo PR #25270
How I Tested These Changes
Perf test before/after