private Query<Entity> getCountsQuery(UUID jobId) {
    // Use the main job as the ancestor to all the errors, see:
    // http://cloud/datastore/docs/concepts/queries#ancestor_queries
    Key ancestorKey = datastore.newKeyFactory().setKind(JOB_KIND).newKey(jobId.toString());

    return Query.newEntityQueryBuilder()
        .setKind(COUNTS_KIND)
        .setFilter(PropertyFilter.hasAncestor(ancestorKey))
        .build();
  }
Finds the ID of the first {@link PortabilityJob} in state {@code jobState} in Datastore, or
null if none found.

<p>TODO(rtannenbaum): Order by creation time so we can process jobs in a FIFO manner. Trying to
OrderBy.asc("created") currently fails because we don't yet have an index set up.
extensions/cloud/portability-cloud-google/src/main/java/org/datatransferproject/cloud/google/GoogleJobStore.java