Class RealizedPipeline

java.lang.Object
nz.org.riskscape.engine.pipeline.RealizedPipeline
All Implemented Interfaces:
AutoCloseable

public class RealizedPipeline extends Object implements 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 AutoCloseable from RealizedPipeline and RealizedStep and consider changing the getResult() method to be more like a constructor, e.g. newRealized(ExecutionContext) and have that be the closable