@ThreadSafe public class ArtifactSourcePool extends java.lang.Object implements ArtifactSource
ArtifactSources
that can be used as a single source. At least
one source must be registered before artifacts can be requested from it.
Artifact pooling is required for Flink operators that use the DistributedCache for artifact distribution. This is because distributed caches (along with other runtime context) are scoped to operator lifetimes but the artifact retrieval service must outlive the any remote environments it serves. Remote environments cannot be shared between jobs and are thus job-scoped.
Because of the peculiarities of artifact pooling and Flink, this class is packaged with the Flink runner rather than as a core fn-execution utility.
Modifier and Type | Method and Description |
---|---|
java.lang.AutoCloseable |
addToPool(ArtifactSource artifactSource)
Adds a new cache to the pool.
|
void |
getArtifact(java.lang.String name,
io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.ArtifactApi.ArtifactChunk> responseObserver)
Get an artifact by its name.
|
org.apache.beam.model.jobmanagement.v1.ArtifactApi.Manifest |
getManifest()
Get the artifact manifest available from this source.
|
public java.lang.AutoCloseable addToPool(ArtifactSource artifactSource)
AutoCloseable
is closed, the given
cache will be removed from the pool.public org.apache.beam.model.jobmanagement.v1.ArtifactApi.Manifest getManifest() throws java.io.IOException
ArtifactSource
getManifest
in interface ArtifactSource
java.io.IOException
public void getArtifact(java.lang.String name, io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.ArtifactApi.ArtifactChunk> responseObserver)
ArtifactSource
getArtifact
in interface ArtifactSource