public class TransformUpgrader
extends java.lang.Object
implements java.lang.AutoCloseable
Modifier and Type | Method and Description |
---|---|
void |
close() |
static int |
compareVersions(java.lang.String firstVersion,
java.lang.String secondVersion)
Compares two Beam versions.
|
static @Nullable java.lang.String |
findUpgradeURN(PTransform transform)
A utility to find the registered URN for a given transform.
|
static java.lang.Object |
fromByteArray(byte[] bytes)
A utility method that converts a byte array obtained by invoking
toByteArray(Object)
back to a Java object. |
static TransformUpgrader |
of() |
static byte[] |
toByteArray(java.lang.Object object)
A utility method that converts an arbitrary serializable object into a byte array.
|
org.apache.beam.model.pipeline.v1.RunnerApi.Pipeline |
upgradeTransformsViaTransformService(org.apache.beam.model.pipeline.v1.RunnerApi.Pipeline pipeline,
java.util.List<java.lang.String> urnsToOverride,
PipelineOptions options)
Upgrade identified transforms in a given pipeline using the Transform Service.
|
public static TransformUpgrader of()
public org.apache.beam.model.pipeline.v1.RunnerApi.Pipeline upgradeTransformsViaTransformService(org.apache.beam.model.pipeline.v1.RunnerApi.Pipeline pipeline, java.util.List<java.lang.String> urnsToOverride, PipelineOptions options) throws java.io.IOException, java.util.concurrent.TimeoutException
pipeline
- the pipeline proto.urnsToOverride
- URNs of the transforms to be overridden.options
- options for determining the transform service to use.java.lang.Exception
java.io.IOException
java.util.concurrent.TimeoutException
public void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception
public static @Nullable java.lang.String findUpgradeURN(PTransform transform)
This URN can be used to upgrade this transform to a new Beam version without upgrading the rest of the pipeline. Please see Beam Transform Service documentation for more details.
For this lookup to work, the a TransformPayloadTranslatorRegistrar
for the transform
has to be available in the classpath.
transform
- transform to lookup.null
otherwise.public static byte[] toByteArray(java.lang.Object object)
object
- an instance of type Serializable
object
converted into a byte array.public static java.lang.Object fromByteArray(byte[] bytes) throws java.io.InvalidClassException
toByteArray(Object)
back to a Java object.bytes
- a byte
array generated by invoking the toByteArray(Object)
method.java.io.InvalidClassException
public static int compareVersions(java.lang.String firstVersion, java.lang.String secondVersion)
firstVersion
- first version to compare.secondVersion
- second version to compare.