Package org.jenkinsci.plugins.workflow.graphanalysis
package org.jenkinsci.plugins.workflow.graphanalysis
Provides a library of methods to work with and analyze the graph of
FlowNode
s produced from a pipeline execution.
The core APIs are described in the javadocs for AbstractFlowScanner
But in general it provides for iteration through the Directed Acyclic Graph (DAG) of a flow, filtering, search for matches, and
visiting all nodes via internal iteration.
Static methods and a few implementations are also provided in FlowScanningUtils
.
How To Pick A FlowScanner For Iteration
- Want fast iteration, don't care about visiting every node or parallels?
LinearScanner
- Visit every node as fast as possible?
DepthFirstScanner
- Visit every block in a predictable order, from end to start?
ForkScanner
- Fastest way to find preceding sibling or enclosing nodes?
LinearBlockHoppingScanner
Methods to iterate through flow graph and break it into chunks (regions) of interest, with nesting possible and reporting of branches:
Basic APIs
ChunkFinder
- API to define conditions for starting/ending a chunkSimpleChunkVisitor
- Visitor API that accepts callbacks for chunk boundaries/contenst + parallel branchingFlowChunk
- A region of interest, defined by its first and last nodesFlowChunkWithContext
- A FlowChunk that knows about the nodes before/after it, to give context for determining success/failure and the time taken to execute
Data structures and implementations:
MemoryFlowChunk
- A FlowChunkWithContext that just directly stores FlowNodesParallelFlowChunk
ParallelMemoryFlowChunk
StandardChunkVisitor
- a basic concrete implementation of SimpleChunkVisitor that tracks one chunk at a time (no nesting) and runs a callback when the chunk is doneLabelledChunkFinder
- ChunkFinder that matches against nodes with a labelBlockChunkFinder
- ChunkFinder that creates chunks from blocks
-
ClassDescriptionCore APIs and base logic for FlowScanners that extract information from a pipeline execution.Matches start and end of a block.Think of this as setting conditions to mark a region of interest in the graph of
FlowNode
from aFlowExecution
.Does a simple and somewhat efficient depth-first search of all FlowNodes in the DAG.Filterator<T>Iterator that may be navigated through a filtered wrapper.Common container interface for a series ofFlowNode
s with a logical start and end.FlowChunk with information about what comes before/afterInterface used when examining a pipeline FlowNode graph node by node, and terminating when a condition is metLibrary of common functionality when analyzing/walking flow graphsScanner that will scan down all forks when we hit parallel blocks before continuing (as opposed toDepthFirstScanner
), but generally runs in linear order.Splits a flow execution intoFlowChunk
s whenever you have a label.Extension ofLinearScanner
that skips nested blocks at the current level, useful for finding enclosing blocks.Scans through the flow graph in strictly linear fashion, visiting only the first branch in parallel blocks.FlowChunk that holds direct references to theFlowNode
instances and context info This makes it easy to use in analysis and visualizations, but inappropriate to retain in caches, etcParallelFlowChunk<ChunkType extends FlowChunk>FlowChunk mapping to the block from a Parallel step (with parallel branches inside)Corresponds to a parallel block, acts as an in-memory container that can plug into status/timing APIsThis visitor's callbacks are invoked as we walk through a pipeline flow graph, and it splits it into chunks.Simple handler for linearFlowChunk
s (basic stages, etc), and designed to be extended.