Skip to content

Exclusions

Step exclusion system for pipelines.

ExclusionManager(pipeline)

Exclusion manager for managing exclusions in a pipeline.

This class provides a high-level interface for managing step exclusions in a pipeline. It handles the creation of exclusion sets, application to pipeline steps, and graph rebuilding when exclusions change.

Attributes:

Name Type Description
pipeline Pipeline

The pipeline instance to manage exclusions for.

Initialize the exclusion manager.

Parameters:

Name Type Description Default
pipeline 'Pipeline'

The pipeline instance to manage exclusions for.

required

clear()

Clear all exclusions.

This method removes all current exclusions from the pipeline, effectively including all steps in execution.

exclude(*paths)

Exclude one or more paths from execution.

This method creates an exclusion set from the provided paths, applies the exclusions to all pipeline steps, updates the pipeline's exclusion state, and rebuilds the graph to reflect the new structure.

Notes

This operation REPLACES the current exclusion set with the provided paths (it is not additive).

Parameters:

Name Type Description Default
*paths str

Variable number of dot-notation paths to exclude.

()

get_current_exclusions()

Get current exclusion paths.

This method returns the list of paths that are currently excluded in the pipeline. If no exclusions are set, returns an empty list.

Returns:

Type Description
list[str]

list[str]: List of currently excluded paths.

include(*paths)

Include (un-exclude) one or more paths.

This method removes the specified paths from the current exclusions by getting the current exclusion list, filtering out the specified paths, and applying the remaining exclusions.

Notes
  1. Mutually exclusive with exclude in intent: include removes from the existing exclusion set, whereas exclude replaces the entire set.
  2. If there are no current exclusions, calling include is a no-op.

Parameters:

Name Type Description Default
*paths str

Variable number of dot-notation paths to include (un-exclude).

()

list_excluded()

List currently excluded steps.

This method iterates through all pipeline steps and returns the names of steps that are currently marked as excluded.

Returns:

Type Description
list[str]

list[str]: List of step names that are currently excluded.

ExclusionSet

Bases: BaseModel

Simple set of excluded step paths.

This class manages a collection of step paths that should be excluded from execution. It provides methods to check if paths are excluded and to extract child exclusions for hierarchical step structures.

Attributes:

Name Type Description
excluded_paths set[str]

The set of excluded step paths.

from_list(paths) classmethod

Create exclusion set from list of paths.

Parameters:

Name Type Description Default
paths list[str]

List of dot-notation paths to exclude.

required

Returns:

Name Type Description
ExclusionSet ExclusionSet

New exclusion set containing the provided paths.

get_child_exclusions(parent_path)

Get exclusions for children of a parent path.

This method extracts all exclusions that apply to children of the specified parent path. For example, if the exclusion set contains "parent.child1" and "parent.child2.grandchild", calling this method with "parent" will return an ExclusionSet containing "child1" and "child2.grandchild".

Parameters:

Name Type Description Default
parent_path str

The parent path to get child exclusions for.

required

Returns:

Name Type Description
ExclusionSet ExclusionSet

New exclusion set containing only child exclusions.

is_excluded(path)

Check if a path is excluded.

Parameters:

Name Type Description Default
path str

The step path to check for exclusion.

required

Returns:

Name Type Description
bool bool

True if the path is excluded, False otherwise.