apache_beam.options.pipeline_options_context module

Context-scoped access to pipeline options during graph construction and translation.

This module provides thread-safe and async-safe access to globally-available instances of PipelineOptions using contextvars, scoped by the current pipeline. It allows components like transforms and coders to access the pipeline’s configuration without requiring explicit parameter passing through every level of the call stack.

For internal use only; no backwards-compatibility guarantees.

apache_beam.options.pipeline_options_context.get_pipeline_options() PipelineOptions | None[source]

Get the current pipeline’s options from the context.

Returns:

The PipelineOptions for the currently executing pipeline operation, or None if called outside of a pipeline context.

apache_beam.options.pipeline_options_context.scoped_pipeline_options(options: PipelineOptions | None)[source]

Context manager that sets pipeline options for the duration of a block.

Parameters:

options – The PipelineOptions to make available during this scope.