Search in sources :

Example 1 with ArtifactStagingService

use of org.apache.beam.runners.fnexecution.artifact.ArtifactStagingService in project beam by apache.

the class PortableRunnerTest method createJobServer.

private void createJobServer(JobState.Enum jobState, JobApi.MetricResults metricResults) throws IOException {
    ArtifactStagingService stagingService = new ArtifactStagingService(new ArtifactStagingService.ArtifactDestinationProvider() {

        @Override
        public ArtifactStagingService.ArtifactDestination getDestination(String stagingToken, String name) throws IOException {
            return ArtifactStagingService.ArtifactDestination.create("/dev/null", ByteString.EMPTY, ByteStreams.nullOutputStream());
        }

        @Override
        public void removeStagedArtifacts(String stagingToken) {
        }
    });
    stagingService.registerJob("TestStagingToken", ImmutableMap.of());
    Server server = grpcCleanupRule.register(InProcessServerBuilder.forName(ENDPOINT_URL).addService(new TestJobService(ENDPOINT_DESCRIPTOR, "prepId", "jobId", jobState, metricResults)).addService(stagingService).build());
    server.start();
}
Also used : Server(org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Server) TestJobService(org.apache.beam.runners.portability.testing.TestJobService) ByteString(org.apache.beam.vendor.grpc.v1p43p2.com.google.protobuf.ByteString) IOException(java.io.IOException) ArtifactStagingService(org.apache.beam.runners.fnexecution.artifact.ArtifactStagingService)

Example 2 with ArtifactStagingService

use of org.apache.beam.runners.fnexecution.artifact.ArtifactStagingService in project beam by apache.

the class JobServerDriver method createArtifactStagingService.

private GrpcFnServer<ArtifactStagingService> createArtifactStagingService() throws IOException {
    ArtifactStagingService service = new ArtifactStagingService(ArtifactStagingService.beamFilesystemArtifactDestinationProvider(configuration.artifactStagingPath));
    GrpcFnServer<ArtifactStagingService> server;
    if (configuration.artifactPort == 0) {
        server = GrpcFnServer.allocatePortAndCreateFor(service, artifactServerFactory);
    } else {
        Endpoints.ApiServiceDescriptor descriptor = Endpoints.ApiServiceDescriptor.newBuilder().setUrl(configuration.host + ":" + configuration.artifactPort).build();
        server = GrpcFnServer.create(service, descriptor, artifactServerFactory);
    }
    LOG.info("ArtifactStagingService started on {}", server.getApiServiceDescriptor().getUrl());
    return server;
}
Also used : Endpoints(org.apache.beam.model.pipeline.v1.Endpoints) ArtifactStagingService(org.apache.beam.runners.fnexecution.artifact.ArtifactStagingService)

Aggregations

ArtifactStagingService (org.apache.beam.runners.fnexecution.artifact.ArtifactStagingService)2 IOException (java.io.IOException)1 Endpoints (org.apache.beam.model.pipeline.v1.Endpoints)1 TestJobService (org.apache.beam.runners.portability.testing.TestJobService)1 ByteString (org.apache.beam.vendor.grpc.v1p43p2.com.google.protobuf.ByteString)1 Server (org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Server)1