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

avoid fetching runs in runs feed if backfill filter is set and we are hiding runs within backfills #25904

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jamiedemaria
Copy link
Contributor

@jamiedemaria jamiedemaria commented Nov 13, 2024

Summary & Motivation

If a user filters for a specific backfill in the default runs feed view, we end up making an inefficient query like this

SELECT * FROM runs
WHERE runs.backfill_id IS NULL
AND runs.backfill_id = 'abcdefgh'

This is because the default view of the Runs page excludes subruns, which is the runs.backfill_id IS NULL. This is an inefficient query and we have enough knowledge prior to running the query to know it will return no results. So we can just skip fetching runs if we see we are in this case

How I Tested These Changes

Changelog

Insert changelog entry or delete this section.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @jamiedemaria and the rest of your teammates on Graphite Graphite

@@ -496,7 +496,7 @@ def _bulk_action_filters_from_run_filters(filters: RunsFilter) -> BulkActionsFil
_bulk_action_statuses_from_run_statuses(filters.statuses) if filters.statuses else None
)
backfill_ids = None
if filters.tags and filters.tags.get(BACKFILL_ID_TAG) is not None:
if filters.tags.get(BACKFILL_ID_TAG) is not None:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

in making the change in this PR i noticed that the filters.tags check is unnecessary since filters.tags is never None, it defaults to {}

]
# if we are not showing runs within backfills and the backfill_id filter is set, we know
# there will be no results, so we can skip fetching runs
should_fetch_runs = not (exclude_subruns and run_filters.tags.get(BACKFILL_ID_TAG) is not None)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

when we add the option to only show backfills this condition will become more complicated and probably warrant it's own function

@jamiedemaria jamiedemaria marked this pull request as ready for review November 13, 2024 19:49
@jamiedemaria jamiedemaria force-pushed the jamie/runs-feed-smarter-about-fetching-runs branch from edd88e0 to 10cd2d9 Compare November 14, 2024 17:24
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.

1 participant