Skip to content

Paginate ListOperations

Rohit Kothur requested to merge rkothur/list-operations-paginated into master

Description

This MR adds support for pagination to the ListOperations request. The response is now truncated to a certain number of entries and contains a "next_page_token" which can be supplied a followup ListOperations request for the next page of results.

The maximum page size is 1000 entries by default, but the max_list_operations_page_size option can be set in the configuration. The requester can specify a page size in the ListOperations request, but an error is returned if that page size is larger that its configured maximum page size.

This is only enabled for the SQL scheduler. The in-memory scheduler does not do pagination.

TODO:

  • Config option
  • Note in the docs about this
  • Add option to bgd operation list to specify the page token and page size

Validation

Start up a BuildGrid instance and send some requests with a command like bgd execute command --disable cancellation echo hi four or five times. Then, run bgd operation list, as well as bgd operation list --page-size 2. For the latter, you should also see the new page token, which you can pass with bgd operation list --page-size 2 --page-token <TOKEN> to get the next page of results.

Issues addressed

#253 (closed) (partially)

Edited by Rohit Kothur

Merge request reports