Class RealizedPipeline
- All Implemented Interfaces:
AutoCloseable
A RealizedPipeline is the result of realizing (going from untyped to typed) a PipelineDeclaration
against a project and a set of parameters via a PipelineRealizer. The structure of the pipeline is
represented here as directed graph of RealizedSteps, where each step represents a typed transformation of
data from one step to the next.
A RealizedPipeline can be given to a PipelineExecutor to execute the pipeline, writing results to a
PipelineOutputContainer.
# Closing attached resources
Closing a RealizedPipeline will close all of its realized steps. One slightly awkward side effect of using an immutable-prototype pattern for building a realized pipeline is that it muddies the water for who is responsible for closing it.
My feeling is that as long as realized steps lazily allocate resources, that is, they only take them once execution starts, then this won't be a problem in practice: any orphaned steps won't need to be closed; only a pipeline and its steps that get executed will need to be closed.
If this starts to become a source of bugs, we could:
Split this role up and have a RealizedPipelineBuilder and totally immutable RealizedPipeline. At this point only the RealizedPipeline is executable.
Remove the
AutoCloseablefrom RealizedPipeline andRealizedStepand consider changing thegetResult()method to be more like a constructor, e.g.newRealized(ExecutionContext)and have that be the closable
-
Constructor Summary
ConstructorsConstructorDescriptionRealizedPipeline(ExecutionContext context, PipelineDeclaration pipeline, List<RealizedStep> steps) RealizedPipeline(ExecutionContext context, PipelineDeclaration pipeline, List<RealizedStep> steps, List<Problem> problems) RealizedPipeline(ExecutionContext context, PipelineDeclaration ast, List<RealizedStep> realizedSteps, List<Problem> problems, PipelineMetadata metadata) Creates a newRealizedPipelineinstance. -
Method Summary
Modifier and TypeMethodDescriptionadd(RealizedStep newStep) addProblems(Problem... rest) protected booleanclone()voidclose()drainWarnings(Consumer<Problem> problemConsumer) static RealizedPipelineempty(ExecutionContext context, PipelineDeclaration pipeline) booleangetAst()The source code that was realized to produce this realized pipelinegetDependents(RealizedStep step) The individually realized steps, in the order they were realizedbooleaninthashCode()withMetadata(PipelineMetadata newMetadata)
-
Constructor Details
-
RealizedPipeline
public RealizedPipeline(ExecutionContext context, PipelineDeclaration pipeline, List<RealizedStep> steps) -
RealizedPipeline
public RealizedPipeline(ExecutionContext context, PipelineDeclaration pipeline, List<RealizedStep> steps, List<Problem> problems) -
RealizedPipeline
public RealizedPipeline(ExecutionContext context, PipelineDeclaration ast, List<RealizedStep> realizedSteps, List<Problem> problems, PipelineMetadata metadata) Creates a new
RealizedPipelineinstance.- Parameters:
context-ast- The source code that was realized to produce this realized pipelinerealizedSteps- The individually realized steps, in the order they were realizedproblems- A set of problems associated with realizing the pipeline that weren't specific to a single stepmetadata-
-
-
Method Details
-
empty
- Returns:
- a pipeline with no steps.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getStartSteps
- Returns:
- the set of steps that have no dependencies
-
getEndSteps
- Returns:
- the set of
RealizedSteps that no other steps depend on
-
getDependents
- Returns:
- a Set of
RealizedSteps that have a dependency on the given step
-
getFailures
- Returns:
- a list of Problems that directly caused this pipeline to fail
-
hasFailures
public boolean hasFailures()- Returns:
- true if this realized pipeline has failed
-
getStep
- Returns:
- a step by its name within the pipeline (c.f. NamedStep), or
emptyif none can be found
-
clone
-
drainWarnings
- Returns:
- the RealizedPipeline with any warnings removed and passed to the problemConsumer
-
getMetadata
- Returns:
- metadata associated with this
RealizedPipeline
-
withMetadata
- Returns:
- a copy of this pipeline, with different metadata to the original.
-
add
- Returns:
- a new
RealizedPipelinethat includes the extra step. - Throws:
IllegalArgumentException- if the step has dependencies not in this pipeline, or if it already contains a step with the same name.
-
addProblems
- Returns:
- a new pipeline that contains these extra problems
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getContext
-
getAst
The source code that was realized to produce this realized pipeline
-
getRealizedSteps
The individually realized steps, in the order they were realized
-