use of com.netflix.titus.master.kubernetes.client.DirectKubeApiServerIntegrator in project titus-control-plane by Netflix.
the class DefaultSchedulerServiceGrpc method getSchedulingResult.
@Override
public void getSchedulingResult(SchedulingResultRequest request, StreamObserver<com.netflix.titus.grpc.protogen.SchedulingResultEvent> responseObserver) {
String taskId = request.getTaskId();
Pair<Job<?>, Task> jobAndTask = v3JobOperations.findTaskById(taskId).orElse(null);
if (jobAndTask == null) {
responseObserver.onError(new StatusRuntimeException(Status.NOT_FOUND.withDescription("Task not found: " + taskId)));
return;
}
DirectKubeApiServerIntegrator directIntegrator = injector.getInstance(DirectKubeApiServerIntegrator.class);
V1Pod pod = directIntegrator.getPods().get(taskId);
if (pod != null) {
responseObserver.onNext(toGrpcSchedulingResultEvent(pod));
responseObserver.onCompleted();
return;
}
responseObserver.onError(new StatusRuntimeException(Status.NOT_FOUND.withDescription("No scheduling result available for task: " + taskId)));
}
Aggregations