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

remove get_event_records calls from multi asset sensor #21784

Merged
merged 6 commits into from May 16, 2024

Conversation

prha
Copy link
Member

@prha prha commented May 10, 2024

Summary & Motivation

We want to deprecate get_event_records calls in favor of narrower APIs.

This call-site has the most user-facing changes in converting from get_event_records -> fetch_materializations, mostly because we have to enforce a limit on a sensor method that we expose off of the context.

I'm not sure if there's a more elegant way to do this, based on the internals of the multi assent sensor, and knowing how many records we can advance per tick (I have a sneaking suspicion that we can do something more clever here).

This PR takes the crudest possible approach: batching calls for chunks in a loop, and warning when called without a limit.

How I Tested These Changes

BK

@prha prha marked this pull request as ready for review May 13, 2024 14:47
@prha prha requested a review from sryza May 13, 2024 15:46
@sryza sryza requested a review from clairelin135 May 14, 2024 16:23

return events
return self.instance.fetch_materializations(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not blocking, but there's probably a way to avoid duplicate code here, e.g. by tracking the total number of records we've fetched so far across all iterations and seeing when it reaches the user-provided limit

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah... this is the PR that I think could be rewritten the most. I haven't quite grokked all the fetching patterns - it feels like there's a better way to do this.

Also, it feels like we should revisit some of the APIs that we expose here to have better data fetching hygiene. Probably not the highest priority item, but if you had time to pair on this, I'd definitely be willing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't be surprised if we remove multi-asset sensor after auto-materialize policies support user-defined functions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Which is to say I think it's probably not worth putting too much effort here)

Base automatically changed from prha/rm_get_event_records_asset_backfill_5 to master May 16, 2024 17:22
@prha prha merged commit 5a1730a into master May 16, 2024
1 check passed
@prha prha deleted the prha/rm_get_event_records_multi_asset_sensor_6 branch May 16, 2024 17:24
nikomancy pushed a commit that referenced this pull request May 22, 2024
## Summary & Motivation
We want to deprecate get_event_records calls in favor of narrower APIs.

This call-site has the most user-facing changes in converting from
`get_event_records` -> `fetch_materializations`, mostly because we have
to enforce a limit on a sensor method that we expose off of the context.

I'm not sure if there's a more elegant way to do this, based on the
internals of the multi assent sensor, and knowing how many records we
can advance per tick (I have a sneaking suspicion that we can do
something more clever here).

This PR takes the crudest possible approach: batching calls for chunks
in a loop, and warning when called without a limit.

## How I Tested These Changes
BK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants