Package org.apache.beam.fn.harness.data
Class PTransformFunctionRegistry
- java.lang.Object
-
- org.apache.beam.fn.harness.data.PTransformFunctionRegistry
-
public class PTransformFunctionRegistry extends java.lang.ObjectA class to register and retrieve functions for bundle processing (i.e. the start, or finish function). The purpose of this class is to wrap these functions with instrumentation for metrics and other telemetry collection.Usage:
// Instantiate and use the registry for each class of functions. i.e. start. finish. PTransformFunctionRegistry startFunctionRegistry; PTransformFunctionRegistry finishFunctionRegistry; startFunctionRegistry.register(myStartThrowingRunnable); finishFunctionRegistry.register(myFinishThrowingRunnable); // Then invoke the functions by iterating over them, in your desired order: i.e. for (ThrowingRunnable startFunction : startFunctionRegistry.getFunctions()) { startFunction.run(); } for (ThrowingRunnable finishFunction : Lists.reverse(finishFunctionRegistry.getFunctions())) { finishFunction.run(); } // Note: this is used in ProcessBundleHandler.
-
-
Constructor Summary
Constructors Constructor Description PTransformFunctionRegistry(org.apache.beam.runners.core.metrics.ShortIdMap shortIds, ExecutionStateSampler.ExecutionStateTracker stateTracker, java.lang.String executionStateUrn)Construct the registry to run for either start or finish bundle functions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<org.apache.beam.sdk.function.ThrowingRunnable>getFunctions()voidregister(java.lang.String pTransformId, java.lang.String pTransformUniqueName, org.apache.beam.sdk.function.ThrowingRunnable runnable)Register the runnable to process the specific pTransformId and track its execution time.
-
-
-
Constructor Detail
-
PTransformFunctionRegistry
public PTransformFunctionRegistry(org.apache.beam.runners.core.metrics.ShortIdMap shortIds, ExecutionStateSampler.ExecutionStateTracker stateTracker, java.lang.String executionStateUrn)Construct the registry to run for either start or finish bundle functions.- Parameters:
shortIds- - Provides short ids forMetricsApi.MonitoringInfo.stateTracker- - The tracker to enter states in order to calculate execution time metrics.executionStateUrn- - The URN for the execution state .
-
-
Method Detail
-
register
public void register(java.lang.String pTransformId, java.lang.String pTransformUniqueName, org.apache.beam.sdk.function.ThrowingRunnable runnable)Register the runnable to process the specific pTransformId and track its execution time.- Parameters:
pTransformId-pTransformUniqueName-runnable-
-
getFunctions
public java.util.List<org.apache.beam.sdk.function.ThrowingRunnable> getFunctions()
- Returns:
- A list of wrapper functions which will invoke the registered functions indirectly. The order of registry is maintained.
-
-