return tryFiveTimes(
new Operation<Pair<? extends Iterable<JobRecord>, String>>("queryRootPipelines") {
@Override
public Pair<? extends Iterable<JobRecord>, String> call() {
QueryResultIterator<Entity> entities =
preparedQuery.asQueryResultIterable(fetchOptions).iterator();
Cursor dsCursor = null;
List<JobRecord> roots = new LinkedList<>();
while (entities.hasNext()) {
if (limit > 0 && roots.size() >= limit) {
dsCursor = entities.getCursor();