Package org.apache.beam.sdk.transforms
Class Watch.Growth<InputT,OutputT,KeyT>
java.lang.Object
org.apache.beam.sdk.transforms.PTransform<PCollection<InputT>,PCollection<KV<InputT,OutputT>>>
org.apache.beam.sdk.transforms.Watch.Growth<InputT,OutputT,KeyT>
- All Implemented Interfaces:
Serializable,HasDisplayData
- Enclosing class:
Watch
public abstract static class Watch.Growth<InputT,OutputT,KeyT>
extends PTransform<PCollection<InputT>,PCollection<KV<InputT,OutputT>>>
Implementation of
Watch.growthOf(org.apache.beam.sdk.transforms.Watch.Growth.PollFn<InputT, OutputT>, org.apache.beam.sdk.transforms.Requirements).- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA function that computes the current set of outputs for the given input, in the form of aWatch.Growth.PollResult.static final classThe result of a single invocation of aWatch.Growth.PollFn.static interfaceA strategy for determining whether it is time to stop polling the current input regardless of whether its output is complete or not. -
Field Summary
Fields inherited from class org.apache.beam.sdk.transforms.PTransform
annotations, displayData, name, resourceHints -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterIterations<InputT> afterIterations(int iterations) Returns aWatch.Growth.TerminationConditionthat holds after the given number of polling iterations have occurred per-input.static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTimeSinceNewOutput<InputT> afterTimeSinceNewOutput(SerializableFunction<InputT, ReadableDuration> timeSinceNewOutput) LikeafterTimeSinceNewOutput(ReadableDuration), but the duration is input-dependent.static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTimeSinceNewOutput<InputT> afterTimeSinceNewOutput(ReadableDuration timeSinceNewOutput) Returns aWatch.Growth.TerminationConditionthat holds after the given time has elapsed after the last time theWatch.Growth.PollResultfor the current input contained a previously unseen output.static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTotalOf<InputT> afterTotalOf(SerializableFunction<InputT, ReadableDuration> timeSinceInput) LikeafterTotalOf(ReadableDuration), but the duration is input-dependent.static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTotalOf<InputT> afterTotalOf(ReadableDuration timeSinceInput) Returns aWatch.Growth.TerminationConditionthat holds after the given time has elapsed after the current input was seen.static <InputT,FirstStateT, SecondStateT>
org.apache.beam.sdk.transforms.Watch.Growth.BinaryCombined<InputT, FirstStateT, SecondStateT> allOf(Watch.Growth.TerminationCondition<InputT, FirstStateT> first, Watch.Growth.TerminationCondition<InputT, SecondStateT> second) Returns aWatch.Growth.TerminationConditionthat holds when both of the given two conditions hold.static <InputT,FirstStateT, SecondStateT>
org.apache.beam.sdk.transforms.Watch.Growth.BinaryCombined<InputT, FirstStateT, SecondStateT> eitherOf(Watch.Growth.TerminationCondition<InputT, FirstStateT> first, Watch.Growth.TerminationCondition<InputT, SecondStateT> second) Returns aWatch.Growth.TerminationConditionthat holds when at least one of the given two conditions holds.expand(PCollection<InputT> input) Override this method to specify how thisPTransformshould be expanded on the givenInputT.static <InputT,StateT>
Watch.Growth.TerminationCondition<InputT, StateT> ignoreInput(Watch.Growth.TerminationCondition<?, StateT> condition) Wraps a given input-independentWatch.Growth.TerminationConditionas an equivalent condition with a given input type, passingnullto the original condition as input.static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.Never<InputT> never()Returns aWatch.Growth.TerminationConditionthat never holds (i.e., poll each input until its output is complete).withOutputCoder(Coder<OutputT> outputCoder) Specifies aCoderto use for the outputs.withOutputKeyCoder(Coder<KeyT> outputKeyCoder) Specifies the coder for the output key.withPollInterval(Duration pollInterval) Specifies how long to wait after a call toWatch.Growth.PollFnbefore calling it again (if at all - according toWatch.Growth.PollResultand theWatch.Growth.TerminationCondition).withTerminationPerInput(Watch.Growth.TerminationCondition<InputT, ?> terminationPerInput) Specifies aWatch.Growth.TerminationConditionthat will be independently used for every input.Methods inherited from class org.apache.beam.sdk.transforms.PTransform
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
-
Constructor Details
-
Growth
public Growth()
-
-
Method Details
-
never
public static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.Never<InputT> never()Returns aWatch.Growth.TerminationConditionthat never holds (i.e., poll each input until its output is complete). -
ignoreInput
public static <InputT,StateT> Watch.Growth.TerminationCondition<InputT,StateT> ignoreInput(Watch.Growth.TerminationCondition<?, StateT> condition) Wraps a given input-independentWatch.Growth.TerminationConditionas an equivalent condition with a given input type, passingnullto the original condition as input. -
afterTotalOf
public static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTotalOf<InputT> afterTotalOf(ReadableDuration timeSinceInput) Returns aWatch.Growth.TerminationConditionthat holds after the given time has elapsed after the current input was seen. -
afterTotalOf
public static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTotalOf<InputT> afterTotalOf(SerializableFunction<InputT, ReadableDuration> timeSinceInput) LikeafterTotalOf(ReadableDuration), but the duration is input-dependent. -
afterTimeSinceNewOutput
public static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTimeSinceNewOutput<InputT> afterTimeSinceNewOutput(ReadableDuration timeSinceNewOutput) Returns aWatch.Growth.TerminationConditionthat holds after the given time has elapsed after the last time theWatch.Growth.PollResultfor the current input contained a previously unseen output. -
afterTimeSinceNewOutput
public static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTimeSinceNewOutput<InputT> afterTimeSinceNewOutput(SerializableFunction<InputT, ReadableDuration> timeSinceNewOutput) LikeafterTimeSinceNewOutput(ReadableDuration), but the duration is input-dependent. -
afterIterations
public static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterIterations<InputT> afterIterations(int iterations) Returns aWatch.Growth.TerminationConditionthat holds after the given number of polling iterations have occurred per-input. Useful for deterministic testing of Watch users. -
eitherOf
public static <InputT,FirstStateT, org.apache.beam.sdk.transforms.Watch.Growth.BinaryCombined<InputT,SecondStateT> FirstStateT, eitherOfSecondStateT> (Watch.Growth.TerminationCondition<InputT, FirstStateT> first, Watch.Growth.TerminationCondition<InputT, SecondStateT> second) Returns aWatch.Growth.TerminationConditionthat holds when at least one of the given two conditions holds. -
allOf
public static <InputT,FirstStateT, org.apache.beam.sdk.transforms.Watch.Growth.BinaryCombined<InputT,SecondStateT> FirstStateT, allOfSecondStateT> (Watch.Growth.TerminationCondition<InputT, FirstStateT> first, Watch.Growth.TerminationCondition<InputT, SecondStateT> second) Returns aWatch.Growth.TerminationConditionthat holds when both of the given two conditions hold. -
withOutputKeyCoder
Specifies the coder for the output key. -
withTerminationPerInput
public Watch.Growth<InputT,OutputT, withTerminationPerInputKeyT> (Watch.Growth.TerminationCondition<InputT, ?> terminationPerInput) Specifies aWatch.Growth.TerminationConditionthat will be independently used for every input. -
withPollInterval
Specifies how long to wait after a call toWatch.Growth.PollFnbefore calling it again (if at all - according toWatch.Growth.PollResultand theWatch.Growth.TerminationCondition). -
withOutputCoder
Specifies aCoderto use for the outputs. If unspecified, it will be inferred from the output type ofWatch.Growth.PollFnwhenever possible.The coder must be deterministic, because the transform will compare encoded outputs for deduplication between polling rounds.
-
expand
Description copied from class:PTransformOverride this method to specify how thisPTransformshould be expanded on the givenInputT.NOTE: This method should not be called directly. Instead apply the
PTransformshould be applied to theInputTusing theapplymethod.Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
- Specified by:
expandin classPTransform<PCollection<InputT>,PCollection<KV<InputT, OutputT>>>
-