Search in sources :

Example 1 with DirectKubeApiServerIntegrator

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)));
}
Also used : DirectKubeApiServerIntegrator(com.netflix.titus.master.kubernetes.client.DirectKubeApiServerIntegrator) Task(com.netflix.titus.api.jobmanager.model.job.Task) StatusRuntimeException(io.grpc.StatusRuntimeException) V1Pod(io.kubernetes.client.openapi.models.V1Pod) Job(com.netflix.titus.api.jobmanager.model.job.Job)

Aggregations

Job (com.netflix.titus.api.jobmanager.model.job.Job)1 Task (com.netflix.titus.api.jobmanager.model.job.Task)1 DirectKubeApiServerIntegrator (com.netflix.titus.master.kubernetes.client.DirectKubeApiServerIntegrator)1 StatusRuntimeException (io.grpc.StatusRuntimeException)1 V1Pod (io.kubernetes.client.openapi.models.V1Pod)1