Skip to content

Commit fe9c78a

Browse files
authored
fix interactive environment circular import (#37147)
* fix interactive enviornemnt circular import * remove unnecessary protection for circular import
1 parent 405d2db commit fe9c78a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

sdks/python/apache_beam/runners/interactive/interactive_environment.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
from apache_beam.runners.direct import direct_runner
3939
from apache_beam.runners.interactive import cache_manager as cache
4040
from apache_beam.runners.interactive.messaging.interactive_environment_inspector import InteractiveEnvironmentInspector
41-
from apache_beam.runners.interactive.recording_manager import RecordingManager
4241
from apache_beam.runners.interactive.sql.sql_chain import SqlChain
4342
from apache_beam.runners.interactive.user_pipeline_tracker import UserPipelineTracker
4443
from apache_beam.runners.interactive.utils import assert_bucket_exists
@@ -428,6 +427,10 @@ def set_recording_manager(self, recording_manager, pipeline):
428427

429428
def get_recording_manager(self, pipeline, create_if_absent=False):
430429
"""Gets the recording manager for the given pipeline."""
430+
# Allow initial module loading to be complete and not have a circular
431+
# import.
432+
from apache_beam.runners.interactive.recording_manager import RecordingManager
433+
431434
recording_manager = self._recording_managers.get(str(id(pipeline)), None)
432435
if not recording_manager and create_if_absent:
433436
# Get the pipeline variable name for the user. This is useful if the user

sdks/python/apache_beam/runners/interactive/recording_manager.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
from apache_beam.runners.interactive import pipeline_fragment as pf
4242
from apache_beam.runners.interactive import utils
4343
from apache_beam.runners.interactive.caching.cacheable import CacheKey
44+
from apache_beam.runners.interactive.display.pipeline_graph import PipelineGraph
4445
from apache_beam.runners.interactive.options import capture_control
4546
from apache_beam.runners.runner import PipelineState
4647

@@ -712,10 +713,6 @@ def _get_pipeline_graph(self):
712713
"""Lazily initializes and returns the PipelineGraph."""
713714
if self._pipeline_graph is None:
714715
try:
715-
# Allow initial module loading to be complete and not have a circular
716-
# import.
717-
from apache_beam.runners.interactive.display.pipeline_graph import PipelineGraph
718-
719716
# Try to create the graph.
720717
self._pipeline_graph = PipelineGraph(self.user_pipeline)
721718
except (ImportError, NameError, AttributeError):

0 commit comments

Comments
 (0)