public abstract static class Watch.Growth<InputT,OutputT,KeyT> extends PTransform<<any>,<any>>
Watch.growthOf(org.apache.beam.sdk.transforms.Watch.Growth.PollFn<InputT, OutputT>, org.apache.beam.sdk.transforms.Requirements)
.Modifier and Type | Class and Description |
---|---|
static class |
Watch.Growth.PollFn<InputT,OutputT>
A function that computes the current set of outputs for the given input, in the form of a
Watch.Growth.PollResult . |
static class |
Watch.Growth.PollResult<OutputT>
The result of a single invocation of a
Watch.Growth.PollFn . |
static interface |
Watch.Growth.TerminationCondition<InputT,StateT>
A strategy for determining whether it is time to stop polling the current input regardless of
whether its output is complete or not.
|
annotations, displayData, name, resourceHints
Constructor and Description |
---|
Growth() |
Modifier and Type | Method and Description |
---|---|
static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterIterations<InputT> |
afterIterations(int iterations)
Returns a
Watch.Growth.TerminationCondition that holds after the given number of polling
iterations have occurred per-input. |
static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTimeSinceNewOutput<InputT> |
afterTimeSinceNewOutput(ReadableDuration timeSinceNewOutput)
Returns a
Watch.Growth.TerminationCondition that holds after the given time has elapsed after the
last time the Watch.Growth.PollResult for the current input contained a previously unseen output. |
static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTimeSinceNewOutput<InputT> |
afterTimeSinceNewOutput(SerializableFunction<InputT,ReadableDuration> timeSinceNewOutput)
Like
afterTimeSinceNewOutput(ReadableDuration) , but the duration is input-dependent. |
static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTotalOf<InputT> |
afterTotalOf(ReadableDuration timeSinceInput)
Returns a
Watch.Growth.TerminationCondition that holds after the given time has elapsed after the
current input was seen. |
static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTotalOf<InputT> |
afterTotalOf(SerializableFunction<InputT,ReadableDuration> timeSinceInput)
Like
afterTotalOf(ReadableDuration) , but the duration is input-dependent. |
static <InputT,FirstStateT,SecondStateT> |
allOf(Watch.Growth.TerminationCondition<InputT,FirstStateT> first,
Watch.Growth.TerminationCondition<InputT,SecondStateT> second)
Returns a
Watch.Growth.TerminationCondition that holds when both of the given two conditions hold. |
static <InputT,FirstStateT,SecondStateT> |
eitherOf(Watch.Growth.TerminationCondition<InputT,FirstStateT> first,
Watch.Growth.TerminationCondition<InputT,SecondStateT> second)
Returns a
Watch.Growth.TerminationCondition that holds when at least one of the given two
conditions holds. |
PCollection<KV<InputT,OutputT>> |
expand(PCollection<InputT> input)
Override this method to specify how this
PTransform should be expanded on the given
InputT . |
static <InputT,StateT> |
ignoreInput(Watch.Growth.TerminationCondition<?,StateT> condition)
Wraps a given input-independent
Watch.Growth.TerminationCondition as an equivalent condition with
a given input type, passing null to the original condition as input. |
static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.Never<InputT> |
never()
Returns a
Watch.Growth.TerminationCondition that never holds (i.e., poll each input until its
output is complete). |
Watch.Growth<InputT,OutputT,KeyT> |
withOutputCoder(Coder<OutputT> outputCoder)
Specifies a
Coder to use for the outputs. |
Watch.Growth<InputT,OutputT,KeyT> |
withOutputKeyCoder(Coder<KeyT> outputKeyCoder)
Specifies the coder for the output key.
|
Watch.Growth<InputT,OutputT,KeyT> |
withPollInterval(Duration pollInterval)
Specifies how long to wait after a call to
Watch.Growth.PollFn before calling it again (if at all
- according to Watch.Growth.PollResult and the Watch.Growth.TerminationCondition ). |
Watch.Growth<InputT,OutputT,KeyT> |
withTerminationPerInput(Watch.Growth.TerminationCondition<InputT,?> terminationPerInput)
Specifies a
Watch.Growth.TerminationCondition that will be independently used for every input. |
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
public static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.Never<InputT> never()
Watch.Growth.TerminationCondition
that never holds (i.e., poll each input until its
output is complete).public static <InputT,StateT> Watch.Growth.TerminationCondition<InputT,StateT> ignoreInput(Watch.Growth.TerminationCondition<?,StateT> condition)
Watch.Growth.TerminationCondition
as an equivalent condition with
a given input type, passing null
to the original condition as input.public static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTotalOf<InputT> afterTotalOf(ReadableDuration timeSinceInput)
Watch.Growth.TerminationCondition
that holds after the given time has elapsed after the
current input was seen.public static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTotalOf<InputT> afterTotalOf(SerializableFunction<InputT,ReadableDuration> timeSinceInput)
afterTotalOf(ReadableDuration)
, but the duration is input-dependent.public static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTimeSinceNewOutput<InputT> afterTimeSinceNewOutput(ReadableDuration timeSinceNewOutput)
Watch.Growth.TerminationCondition
that holds after the given time has elapsed after the
last time the Watch.Growth.PollResult
for the current input contained a previously unseen output.public static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterTimeSinceNewOutput<InputT> afterTimeSinceNewOutput(SerializableFunction<InputT,ReadableDuration> timeSinceNewOutput)
afterTimeSinceNewOutput(ReadableDuration)
, but the duration is input-dependent.public static <InputT> org.apache.beam.sdk.transforms.Watch.Growth.AfterIterations<InputT> afterIterations(int iterations)
Watch.Growth.TerminationCondition
that holds after the given number of polling
iterations have occurred per-input. Useful for deterministic testing of Watch users.public 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)
Watch.Growth.TerminationCondition
that holds when at least one of the given two
conditions holds.public 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)
Watch.Growth.TerminationCondition
that holds when both of the given two conditions hold.public Watch.Growth<InputT,OutputT,KeyT> withOutputKeyCoder(Coder<KeyT> outputKeyCoder)
public Watch.Growth<InputT,OutputT,KeyT> withTerminationPerInput(Watch.Growth.TerminationCondition<InputT,?> terminationPerInput)
Watch.Growth.TerminationCondition
that will be independently used for every input.public Watch.Growth<InputT,OutputT,KeyT> withPollInterval(Duration pollInterval)
Watch.Growth.PollFn
before calling it again (if at all
- according to Watch.Growth.PollResult
and the Watch.Growth.TerminationCondition
).public Watch.Growth<InputT,OutputT,KeyT> withOutputCoder(Coder<OutputT> outputCoder)
Coder
to use for the outputs. If unspecified, it will be inferred from
the output type of Watch.Growth.PollFn
whenever possible.
The coder must be deterministic, because the transform will compare encoded outputs for deduplication between polling rounds.
public PCollection<KV<InputT,OutputT>> expand(PCollection<InputT> input)
PTransform
PTransform
should be expanded on the given
InputT
.
NOTE: This method should not be called directly. Instead apply the PTransform
should
be applied to the InputT
using the apply
method.
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).
expand
in class PTransform<<any>,<any>>