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();
}
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;
}
Aggregations