Page MenuHomePhabricator

Add limit to SchedulesRootQuery

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


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

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

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

Event Timeline

sashank created this revision.Oct 14 2019, 6:34 AM
alangenfeld requested changes to this revision.Oct 14 2019, 4:50 PM
alangenfeld added a subscriber: alangenfeld.
alangenfeld added inline comments.

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.Oct 14 2019, 4:50 PM
sashank updated this revision to Diff 6071.Oct 29 2019, 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:

The refactor should definitely happen for D1278

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

Fix bug with limit arg on resolver

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

Add more tests

nate added a subscriber: nate.Oct 29 2019, 9:44 PM
nate added inline comments.

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

sashank added inline comments.Oct 29 2019, 9:49 PM

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.Oct 29 2019, 9:51 PM

Fix tests

This revision was automatically updated to reflect the committed changes.