Class ChildPipelineBuilder
Helper class for realizing a child pipeline that gets 'smooshed' back in to a parent as part of realizing a step
-
Constructor Summary
ConstructorsConstructorDescriptionChildPipelineBuilder(nz.org.riskscape.engine.pipeline.RealizationInput input, nz.org.riskscape.rl.ast.PipelineDeclaration childAst) parameter-less constructor.ChildPipelineBuilder(nz.org.riskscape.engine.pipeline.RealizationInput input, nz.org.riskscape.rl.ast.PipelineDeclaration childAst, Map<String, nz.org.riskscape.rl.ast.Expression> parameters) Constructs a new ChildPipelineBuilder for realizing and integrating a child pipeline into a parent pipeline. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInputStep(nz.org.riskscape.engine.pipeline.RealizedStep stepFromParent, String stubName) Adds an input step from the parent pipeline into the child pipeline by creating a stub step.nz.org.riskscape.engine.pipeline.RealizedPipelineaddWellKnownOutput(nz.org.riskscape.engine.pipeline.RealizedStep outputStep, List<nz.org.riskscape.problem.Problem> warnings) Adds a step to the combined pipeline named after the input's prototype step (so will have the expected name) for any dependencies that are chained to this step.protected booleannz.org.riskscape.engine.pipeline.RealizedPipelinecombine()Combines the realized child pipeline back into the parent pipeline.voiddrainWarningsFromChild(Consumer<nz.org.riskscape.problem.Problem> sink) Updates the realized child to remove any warnings (and sends them to the sink, e.g.booleannz.org.riskscape.engine.pipeline.RealizedPipelinenz.org.riskscape.rl.ast.PipelineDeclarationnz.org.riskscape.engine.pipeline.RealizedStepgetChildInputStep(nz.org.riskscape.engine.pipeline.RealizedStep originalInputStep) Retrieves the stub step that was created in the child pipeline for a given parent input step.nz.org.riskscape.engine.pipeline.RealizedPipelinenz.org.riskscape.engine.pipeline.RealizationInputgetInput()Map<nz.org.riskscape.engine.pipeline.RealizedStep,nz.org.riskscape.engine.pipeline.RealizedStep> nz.org.riskscape.engine.pipeline.RealizedPipelineMap<nz.org.riskscape.engine.pipeline.RealizedStep,nz.org.riskscape.engine.pipeline.RealizedStep> nz.org.riskscape.engine.pipeline.RealizedStepgetRebuiltStep(nz.org.riskscape.engine.pipeline.RealizedStep childStep) nz.org.riskscape.engine.steps.ChildPipelineBuilder.StategetState()inthashCode()booleannz.org.riskscape.engine.pipeline.RealizedPipelineRealizes the child pipeline using the configured AST and input steps.voidsetBuilding(nz.org.riskscape.engine.pipeline.RealizedPipeline building) voidsetChildStepPrefix(String childStepPrefix) voidsetCombined(nz.org.riskscape.engine.pipeline.RealizedPipeline combined) voidsetRebuilt(Map<nz.org.riskscape.engine.pipeline.RealizedStep, nz.org.riskscape.engine.pipeline.RealizedStep> rebuilt) voidsetState(nz.org.riskscape.engine.steps.ChildPipelineBuilder.State state) toString()
-
Constructor Details
-
ChildPipelineBuilder
public ChildPipelineBuilder(nz.org.riskscape.engine.pipeline.RealizationInput input, nz.org.riskscape.rl.ast.PipelineDeclaration childAst) parameter-less constructor.
-
ChildPipelineBuilder
public ChildPipelineBuilder(nz.org.riskscape.engine.pipeline.RealizationInput input, nz.org.riskscape.rl.ast.PipelineDeclaration childAst, Map<String, nz.org.riskscape.rl.ast.Expression> parameters) Constructs a new ChildPipelineBuilder for realizing and integrating a child pipeline into a parent pipeline.
- Parameters:
input- the realization input containing the parent pipeline and contextchildAst- the AST declaration of the child pipeline to be realized
-
-
Method Details
-
addInputStep
public void addInputStep(nz.org.riskscape.engine.pipeline.RealizedStep stepFromParent, String stubName) Adds an input step from the parent pipeline into the child pipeline by creating a stub step. The stub step mirrors the parent step's output schema but won't be executed during child pipeline realization.
- Parameters:
stepFromParent- the realized step from the parent pipeline to use as inputstubName- the name to give the stub step in the child pipeline - this is how the child pipeline will refer to it
-
getChildInputStep
public nz.org.riskscape.engine.pipeline.RealizedStep getChildInputStep(nz.org.riskscape.engine.pipeline.RealizedStep originalInputStep) Retrieves the stub step that was created in the child pipeline for a given parent input step.
- Parameters:
originalInputStep- the original step from the parent pipeline- Returns:
- the corresponding stub step in the child pipeline, or null if not found
-
realizeChild
public nz.org.riskscape.engine.pipeline.RealizedPipeline realizeChild()Realizes the child pipeline using the configured AST and input steps. This method must be called after all input steps have been added via
addInputStep(nz.org.riskscape.engine.pipeline.RealizedStep, java.lang.String).- Returns:
- the realized child pipeline, which may contain failures if realization encountered problems
-
drainWarningsFromChild
Updates the realized child to remove any warnings (and sends them to the sink, e.g. List::add)
-
combine
public nz.org.riskscape.engine.pipeline.RealizedPipeline combine()Combines the realized child pipeline back into the parent pipeline.
If the child pipeline failed to realize, a failure step is added to the resulting pipeline to represent those errors
All child steps are prefixed with the parent step name to ensure unique naming.
- Returns:
- the combined pipeline containing both parent and child steps
-
addWellKnownOutput
public nz.org.riskscape.engine.pipeline.RealizedPipeline addWellKnownOutput(nz.org.riskscape.engine.pipeline.RealizedStep outputStep, List<nz.org.riskscape.problem.Problem> warnings) Adds a step to the combined pipeline named after the input's prototype step (so will have the expected name) for any dependencies that are chained to this step.
# Future clean up idea
Not really needed right now, but it might be good to make this an argument or optional version of the combine method, and so make it easier to move the problems from child realization somewhere so that it's handled consistently. I think we probably always want a well known step, it's just a question of whether it's the output step or some other arbitrary step from the pipeline (if it doesn't produce output). The well-known step should always be the one that receives any realization problems that weren't specific to a step.
-
getCombined
public nz.org.riskscape.engine.pipeline.RealizedPipeline getCombined() -
isChildFailed
public boolean isChildFailed()- Returns:
- true if the child pipeline has failures.
-
getRebuiltStep
public nz.org.riskscape.engine.pipeline.RealizedStep getRebuiltStep(nz.org.riskscape.engine.pipeline.RealizedStep childStep) - Returns:
- the step in combined pipeline that was rebuilt for the child step, i.e. it is the child step, but renamed and in the combined pipeline
-
getState
public nz.org.riskscape.engine.steps.ChildPipelineBuilder.State getState() -
getInput
public nz.org.riskscape.engine.pipeline.RealizationInput getInput() -
getParent
public nz.org.riskscape.engine.pipeline.RealizedPipeline getParent() -
getChildAst
public nz.org.riskscape.rl.ast.PipelineDeclaration getChildAst() -
getInputSteps
public Map<nz.org.riskscape.engine.pipeline.RealizedStep,nz.org.riskscape.engine.pipeline.RealizedStep> getInputSteps() -
getPipelineParameters
-
getRebuilt
public Map<nz.org.riskscape.engine.pipeline.RealizedStep,nz.org.riskscape.engine.pipeline.RealizedStep> getRebuilt() -
getBuilding
public nz.org.riskscape.engine.pipeline.RealizedPipeline getBuilding() -
setState
public void setState(nz.org.riskscape.engine.steps.ChildPipelineBuilder.State state) -
setRebuilt
public void setRebuilt(Map<nz.org.riskscape.engine.pipeline.RealizedStep, nz.org.riskscape.engine.pipeline.RealizedStep> rebuilt) -
setBuilding
public void setBuilding(nz.org.riskscape.engine.pipeline.RealizedPipeline building) -
setCombined
public void setCombined(nz.org.riskscape.engine.pipeline.RealizedPipeline combined) -
setChildStepPrefix
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-
getChildStepPrefix
-