use of com.netflix.titus.runtime.endpoint.v3.grpc.GrpcJobManagementModelConverters.toGrpcJob in project titus-control-plane by Netflix.
the class LocalCacheQueryProcessor method findJobs.
public JobQueryResult findJobs(JobQuery jobQuery) {
JobQueryCriteria<TaskStatus.TaskState, JobDescriptor.JobSpecCase> queryCriteria = GrpcJobQueryModelConverters.toJobQueryCriteria(jobQuery);
Page page = toPage(jobQuery.getPage());
List<Job> matchingJobs = findMatchingJob(queryCriteria);
PageResult<Job> pageResult = JobManagerCursors.newCoreJobPaginationEvaluator().takePage(page, matchingJobs);
Set<String> fields = newFieldsFilter(jobQuery.getFieldsList(), JOB_MINIMUM_FIELD_SET);
List<com.netflix.titus.grpc.protogen.Job> grpcJob = pageResult.getItems().stream().map(coreJob -> {
com.netflix.titus.grpc.protogen.Job job = GrpcJobManagementModelConverters.toGrpcJob(coreJob);
if (!fields.isEmpty()) {
job = ProtobufExt.copy(job, fields);
}
return job;
}).collect(Collectors.toList());
return JobQueryResult.newBuilder().setPagination(toGrpcPagination(pageResult.getPagination())).addAllItems(grpcJob).build();
}
Aggregations