Search in sources :

Example 1 with GrpcLoggingService

use of org.apache.beam.runners.fnexecution.logging.GrpcLoggingService in project beam by apache.

the class DefaultJobBundleFactory method createServerInfo.

private ServerInfo createServerInfo(JobInfo jobInfo, ServerFactory serverFactory) throws IOException {
    Preconditions.checkNotNull(serverFactory, "serverFactory can not be null");
    PortablePipelineOptions portableOptions = PipelineOptionsTranslation.fromProto(jobInfo.pipelineOptions()).as(PortablePipelineOptions.class);
    GrpcFnServer<FnApiControlClientPoolService> controlServer = GrpcFnServer.allocatePortAndCreateFor(FnApiControlClientPoolService.offeringClientsToPool(clientPool.getSink(), GrpcContextHeaderAccessorProvider.getHeaderAccessor()), serverFactory);
    GrpcFnServer<GrpcLoggingService> loggingServer = GrpcFnServer.allocatePortAndCreateFor(GrpcLoggingService.forWriter(Slf4jLogWriter.getDefault()), serverFactory);
    GrpcFnServer<ArtifactRetrievalService> retrievalServer = GrpcFnServer.allocatePortAndCreateFor(new ArtifactRetrievalService(), serverFactory);
    ProvisionApi.ProvisionInfo.Builder provisionInfo = jobInfo.toProvisionInfo().toBuilder();
    provisionInfo.setLoggingEndpoint(loggingServer.getApiServiceDescriptor());
    provisionInfo.setArtifactEndpoint(retrievalServer.getApiServiceDescriptor());
    provisionInfo.setControlEndpoint(controlServer.getApiServiceDescriptor());
    GrpcFnServer<StaticGrpcProvisionService> provisioningServer = GrpcFnServer.allocatePortAndCreateFor(StaticGrpcProvisionService.create(provisionInfo.build(), GrpcContextHeaderAccessorProvider.getHeaderAccessor()), serverFactory);
    GrpcFnServer<GrpcDataService> dataServer = GrpcFnServer.allocatePortAndCreateFor(GrpcDataService.create(portableOptions, executor, OutboundObserverFactory.serverDirect()), serverFactory);
    GrpcFnServer<GrpcStateService> stateServer = GrpcFnServer.allocatePortAndCreateFor(GrpcStateService.create(), serverFactory);
    ServerInfo serverInfo = new AutoValue_DefaultJobBundleFactory_ServerInfo.Builder().setControlServer(controlServer).setLoggingServer(loggingServer).setRetrievalServer(retrievalServer).setProvisioningServer(provisioningServer).setDataServer(dataServer).setStateServer(stateServer).build();
    return serverInfo;
}
Also used : StaticGrpcProvisionService(org.apache.beam.runners.fnexecution.provisioning.StaticGrpcProvisionService) GrpcStateService(org.apache.beam.runners.fnexecution.state.GrpcStateService) GrpcDataService(org.apache.beam.runners.fnexecution.data.GrpcDataService) ArtifactRetrievalService(org.apache.beam.runners.fnexecution.artifact.ArtifactRetrievalService) GrpcLoggingService(org.apache.beam.runners.fnexecution.logging.GrpcLoggingService) PortablePipelineOptions(org.apache.beam.sdk.options.PortablePipelineOptions)

Aggregations

ArtifactRetrievalService (org.apache.beam.runners.fnexecution.artifact.ArtifactRetrievalService)1 GrpcDataService (org.apache.beam.runners.fnexecution.data.GrpcDataService)1 GrpcLoggingService (org.apache.beam.runners.fnexecution.logging.GrpcLoggingService)1 StaticGrpcProvisionService (org.apache.beam.runners.fnexecution.provisioning.StaticGrpcProvisionService)1 GrpcStateService (org.apache.beam.runners.fnexecution.state.GrpcStateService)1 PortablePipelineOptions (org.apache.beam.sdk.options.PortablePipelineOptions)1