Page MenuHomePhabricator

Add limit to SchedulesRootQuery
ClosedPublic

Authored by sashank on Mon, Oct 14, 6:34 AM.

Details

Reviewers
alangenfeld
Group Reviewers
Restricted Project
Commits
R1:4219afef3a9b: Add limit to SchedulesRootQuery
Summary

The SchedulesRootQuery previously queried for all runs that corresponded to a schedule. In dagit, however, we only display the ten most recent runs and have a + XX more link that navigates to the runs page with the schedule tag filter. When a schedule accumlates a large number of runs, the page takes too long to load.

This diff adds a limit to the query so that we only query for the runs we want to display on the scheduler page, and adds a new runsCount field to get the total number of runs for a schedule.

Test Plan

Load dagit, get same results as before

Diff Detail

Repository
R1 dagster
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

sashank created this revision.Mon, Oct 14, 6:34 AM
alangenfeld requested changes to this revision.Mon, Oct 14, 4:50 PM
alangenfeld added a subscriber: alangenfeld.
alangenfeld added inline comments.
python_modules/dagster-graphql/dagster_graphql/schema/run_schedule.py
74–108

is this under test yet at all? would be good to ensure its tested re: pending refactor in D1278

This revision now requires changes to proceed.Mon, Oct 14, 4:50 PM
sashank updated this revision to Diff 6071.Tue, Oct 29, 9:25 PM

Add test

@alangenfeld what do you think about getting this in for today's release before the larger refactor. It's not great but this only adds one method to RunStorage.

Right now, the scheduler UI page in dagit becomes unresponsive pretty quick, and this resolves that: https://github.com/dagster-io/dagster/issues/1880.

The refactor should definitely happen for D1278

This revision is now accepted and ready to land.Tue, Oct 29, 9:38 PM
sashank updated this revision to Diff 6075.Tue, Oct 29, 9:42 PM

Fix bug with limit arg on resolver

sashank updated this revision to Diff 6076.Tue, Oct 29, 9:44 PM

Add more tests

natekupp added inline comments.
python_modules/dagster/dagster/core/storage/runs.py
239

what happens here if no rows are returned from the DB / empty runs table?

sashank added inline comments.Tue, Oct 29, 9:49 PM
python_modules/dagster/dagster/core/storage/runs.py
239

It's doing a SELECT count(*), so it will return [(0,)] if there were no matches

Harbormaster completed remote builds in B4873: Diff 6075.
sashank updated this revision to Diff 6079.Tue, Oct 29, 9:51 PM

Fix tests