use of com.netflix.titus.runtime.jobmanager.gateway.JobServiceGateway.TASK_MINIMUM_FIELD_SET in project titus-control-plane by Netflix.
the class LocalCacheQueryProcessor method findTasks.
public TaskQueryResult findTasks(TaskQuery taskQuery) {
JobQueryCriteria<TaskStatus.TaskState, JobDescriptor.JobSpecCase> queryCriteria = GrpcJobQueryModelConverters.toJobQueryCriteria(taskQuery);
Page page = toPage(taskQuery.getPage());
List<com.netflix.titus.api.jobmanager.model.job.Task> matchingTasks = findMatchingTasks(queryCriteria);
PageResult<com.netflix.titus.api.jobmanager.model.job.Task> pageResult = JobManagerCursors.newCoreTaskPaginationEvaluator().takePage(page, matchingTasks);
Set<String> fields = newFieldsFilter(taskQuery.getFieldsList(), TASK_MINIMUM_FIELD_SET);
List<Task> grpcTasks = pageResult.getItems().stream().map(task -> {
Task grpcTask = GrpcJobManagementModelConverters.toGrpcTask(task, logStorageInfo);
if (!fields.isEmpty()) {
grpcTask = ProtobufExt.copy(grpcTask, fields);
}
return grpcTask;
}).collect(Collectors.toList());
return TaskQueryResult.newBuilder().setPagination(toGrpcPagination(pageResult.getPagination())).addAllItems(grpcTasks).build();
}
Aggregations