Search in sources :

Example 16 with Cell

use of com.netflix.titus.api.federation.model.Cell in project titus-control-plane by Netflix.

the class AggregatingJobServiceGateway method observeJobs.

@Override
public Observable<JobChangeNotification> observeJobs(ObserveJobsQuery query, CallMetadata callMetadata) {
    final Observable<JobChangeNotification> observable = createRequestObservable(delegate -> {
        Emitter<JobChangeNotification> emitter = new EmitterWithMultipleSubscriptions<>(delegate);
        Map<Cell, JobManagementServiceStub> clients = CellConnectorUtil.stubs(cellConnector, JobManagementServiceGrpc::newStub);
        final CountDownLatch markersEmitted = new CallbackCountDownLatch(clients.size(), () -> emitter.onNext(buildJobSnapshotEndMarker()));
        clients.forEach((cell, client) -> {
            StreamObserver<JobChangeNotification> streamObserver = new FilterOutFirstMarker(emitter, markersEmitted);
            wrapWithNoDeadline(client, callMetadata).observeJobs(query, streamObserver);
        });
    });
    return observable.map(this::addStackName);
}
Also used : EmitterWithMultipleSubscriptions(com.netflix.titus.common.util.rx.EmitterWithMultipleSubscriptions) JobChangeNotification(com.netflix.titus.grpc.protogen.JobChangeNotification) JobManagementServiceGrpc(com.netflix.titus.grpc.protogen.JobManagementServiceGrpc) CallbackCountDownLatch(com.netflix.titus.common.util.concurrency.CallbackCountDownLatch) CountDownLatch(java.util.concurrent.CountDownLatch) CallbackCountDownLatch(com.netflix.titus.common.util.concurrency.CallbackCountDownLatch) Cell(com.netflix.titus.api.federation.model.Cell) CellConnectorUtil.callToCell(com.netflix.titus.federation.service.CellConnectorUtil.callToCell) JobManagementServiceStub(com.netflix.titus.grpc.protogen.JobManagementServiceGrpc.JobManagementServiceStub)

Aggregations

Cell (com.netflix.titus.api.federation.model.Cell)16 Test (org.junit.Test)7 GrpcConfiguration (com.netflix.titus.federation.startup.GrpcConfiguration)6 Before (org.junit.Before)6 TitusFederationConfiguration (com.netflix.titus.federation.startup.TitusFederationConfiguration)4 JobDescriptor (com.netflix.titus.grpc.protogen.JobDescriptor)4 ManagedChannel (io.grpc.ManagedChannel)4 ApplicationCellRouter (com.netflix.titus.federation.service.router.ApplicationCellRouter)3 JobManagementServiceStub (com.netflix.titus.grpc.protogen.JobManagementServiceGrpc.JobManagementServiceStub)3 AnonymousCallMetadataResolver (com.netflix.titus.runtime.endpoint.metadata.AnonymousCallMetadataResolver)3 HashMap (java.util.HashMap)3 CellConnectorUtil.callToCell (com.netflix.titus.federation.service.CellConnectorUtil.callToCell)2 CellInfoResolver (com.netflix.titus.federation.service.CellInfoResolver)2 DefaultCellInfoResolver (com.netflix.titus.federation.service.DefaultCellInfoResolver)2 JobId (com.netflix.titus.grpc.protogen.JobId)2 JobManagementServiceGrpc (com.netflix.titus.grpc.protogen.JobManagementServiceGrpc)2 CallbackCountDownLatch (com.netflix.titus.common.util.concurrency.CallbackCountDownLatch)1 EmitterWithMultipleSubscriptions (com.netflix.titus.common.util.rx.EmitterWithMultipleSubscriptions)1 HealthCheckResponse (com.netflix.titus.grpc.protogen.HealthCheckResponse)1 Job (com.netflix.titus.grpc.protogen.Job)1