public class PipelineRunner extends Object implements PipelineContext
Modifier and Type | Class and Description |
---|---|
static class |
PipelineRunner.Connection<T> |
static class |
PipelineRunner.IO<T> |
static class |
PipelineRunner.IOType |
Constructor and Description |
---|
PipelineRunner() |
Modifier and Type | Method and Description |
---|---|
<T> void |
addDelayedSingleOutput(PipelineStep step,
String outputName,
String description,
Class<T> outputType,
Consumer<Consumer<T>> output)
Register an output with a single value.
|
<T> void |
addIteratorOutput(PipelineStep step,
String outputName,
String description,
Class<T> outputType,
Supplier<Iterator<T>> outputSupplier)
Register an output with an iterator of values.
|
<T> void |
addMasterStorageBuilder(PipelineStep step,
String inputName,
String inputDescription,
Class<T> inputType,
MasterStorages.MasterStorageBuilder<T> builder)
Add a
MasterStorage building node. |
<T> void |
addRepeatedInput(PipelineStep step,
String inputName,
String description,
Class<T> inputType,
Consumer<T> inputConsumer)
Register an input which accepts repeated values.
|
<T> void |
addSingleInput(PipelineStep step,
String inputName,
String description,
Class<T> inputType,
Consumer<T> inputSetter)
Register an input with a single value.
|
<T> void |
addSingleShotOutput(PipelineStep step,
String outputName,
String description,
Class<T> outputType,
Supplier<T> outputSupplier)
Register an output with a single value.
|
void |
addStatefulMetricOutput(PipelineStep step,
String outputName,
String description,
Supplier<Long> outputSupplier)
Register a secondary output providing metrics.
|
<U,V> void |
addStatelessTransformation(PipelineStep step,
String inputName,
String inputDescription,
Class<U> inputType,
String outputName,
String outputDescription,
Class<V> outputType,
Function<U,V> transformation)
Add stateless transformation.
|
void |
addStep(PipelineStep step) |
<T> T |
getLastStep(Class<T> stepType)
Get last step from the pipeline.
|
List<PipelineStep> |
getSteps() |
void |
run() |
public List<PipelineStep> getSteps()
public void addStep(PipelineStep step)
addStep
in interface PipelineContext
public <T> void addIteratorOutput(PipelineStep step, String outputName, String description, Class<T> outputType, Supplier<Iterator<T>> outputSupplier)
PipelineContext
addIteratorOutput
in interface PipelineContext
T
- Type of the returned valuestep
- The involved stepoutputName
- Short descriptive name of the outputdescription
- Human readable description of the outputoutputType
- Type of the returned valueoutputSupplier
- Supplier of the returned value. Will be invoked after PipelineStep.init()
.public <T> void addDelayedSingleOutput(PipelineStep step, String outputName, String description, Class<T> outputType, Consumer<Consumer<T>> output)
PipelineContext
output
parameter is a Consumer
which expects the target Consumer
of the output value to be introduced. When no
Consumer.accept(java.lang.Object)
invocation is made then the specific output value is not necessarily
composed.
A typical application is an optional output of a (memory) extensive builder node.
addDelayedSingleOutput
in interface PipelineContext
T
- Type of the returned valuestep
- The involved stepoutputName
- Short descriptive name of the outputdescription
- Human readable description of the outputoutputType
- Type of the returned valueoutput
- Callback to be invoked by thepublic <T> void addSingleShotOutput(PipelineStep step, String outputName, String description, Class<T> outputType, Supplier<T> outputSupplier)
PipelineContext
addSingleShotOutput
in interface PipelineContext
T
- Type of the returned valuestep
- The involved stepoutputName
- Short descriptive name of the outputdescription
- Human readable description of the outputoutputType
- Type of the returned valueoutputSupplier
- Supplier of the returned value. Will be invoked after PipelineStep.init()
.public <T> void addSingleInput(PipelineStep step, String inputName, String description, Class<T> inputType, Consumer<T> inputSetter)
PipelineContext
addSingleInput
in interface PipelineContext
T
- Type of the input.step
- The involved step.inputName
- Short descriptive name of the input.description
- Human readable description of the input.inputType
- Type of the expected value.inputSetter
- Consumer of the input value. Will be invoked before PipelineStep.init()
at most once.public <T> void addRepeatedInput(PipelineStep step, String inputName, String description, Class<T> inputType, Consumer<T> inputConsumer)
PipelineContext
addRepeatedInput
in interface PipelineContext
T
- Type of the input.step
- The involved step.inputName
- Short descriptive name of the input.description
- Human readable description of the input.inputType
- Type of the expected value.inputConsumer
- Consumer of the input value. Will be invoked after PipelineStep.init()
zero or multiple times.public void addStatefulMetricOutput(PipelineStep step, String outputName, String description, Supplier<Long> outputSupplier)
PipelineContext
addStatefulMetricOutput
in interface PipelineContext
step
- The involved stepoutputName
- Short descriptive name of the outputdescription
- Human readable description of the outputoutputSupplier
- Supplier of the returned value. Will be invoked after PipelineStep.init()
.public <U,V> void addStatelessTransformation(PipelineStep step, String inputName, String inputDescription, Class<U> inputType, String outputName, String outputDescription, Class<V> outputType, Function<U,V> transformation)
PipelineContext
addStatelessTransformation
in interface PipelineContext
U
- Input typeV
- Output typestep
- The involved stepinputName
- Short descriptive name of the input.inputDescription
- Human readable description of the input.inputType
- Input typeoutputName
- Short descriptive name of the outputoutputDescription
- Human readable description of the outputoutputType
- Output typepublic <T> T getLastStep(Class<T> stepType) throws IllegalStateException
PipelineContext
Step
instances which manipulate a "normal" step.getLastStep
in interface PipelineContext
T
- Expected type of the last stepstepType
- Expected type of the last stepIllegalStateException
- when last step type does not matchpublic <T> void addMasterStorageBuilder(PipelineStep step, String inputName, String inputDescription, Class<T> inputType, MasterStorages.MasterStorageBuilder<T> builder)
PipelineContext
MasterStorage
building node.
This is an order sensitive reduce/collect step which accepts ordered, possibly sparse data. The passed
builder
is considered an input of the node/step. The output is not specified with this call.addMasterStorageBuilder
in interface PipelineContext
T
- Input typestep
- The involved stepinputName
- Short descriptive name of the input.inputDescription
- Human readable description of the input.inputType
- Input typebuilder
- Input for the builder. Note that MasterStorages.MasterStorageBuilder#build()
is invoked
before accessing output(s) but the returned instance will be ignored.public void run()