Skip to content

Commit 735ad8b

Browse files
authored
Skip deep copying runner instance in pipeline options. (#34775)
* Skip deep copying runner instance in pipeline options. * Restore the saved runner in the original options.
1 parent 4d797ca commit 735ad8b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sdks/python/apache_beam/pipeline.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,14 @@ def __init__(
173173
if options is not None:
174174
if isinstance(options, PipelineOptions):
175175
# Make a deep copy of options since they could be overwritten in later
176-
# steps.
176+
# steps. However, the 'runner' object within 'options' is excluded from
177+
# the deep copy (it is shallow copied) due to potential issues with deep
178+
# copying specific runner instances, such as FlumeRunner.
179+
saved_runner = options.view_as(StandardOptions).runner
180+
options.view_as(StandardOptions).runner = None
177181
self._options = copy.deepcopy(options)
182+
self._options.view_as(StandardOptions).runner = saved_runner
183+
options.view_as(StandardOptions).runner = saved_runner
178184
else:
179185
raise ValueError(
180186
'Parameter options, if specified, must be of type PipelineOptions. '

0 commit comments

Comments
 (0)