ian-Liaozy commented on code in PR #39161:
URL: https://github.com/apache/beam/pull/39161#discussion_r3661677396
##########
sdks/python/apache_beam/runners/interactive/recording_manager.py:
##########
@@ -891,23 +910,32 @@ def record(
'Cannot record because a dependency failed to compute'
' asynchronously.')
- self._clear()
-
- merged_options = pipeline_options.PipelineOptions(
- **{
- **self.user_pipeline.options.get_all_options(
- drop_default=True, retain_unknown_options=True),
- **options.get_all_options(
- drop_default=True, retain_unknown_options=True)
- }) if options else self.user_pipeline.options
-
- cache_path = ie.current_env().options.cache_root
- is_remote_run = cache_path and ie.current_env(
- ).options.cache_root.startswith('gs://')
- pf.PipelineFragment(
- list(uncomputed_pcolls), merged_options,
- runner=runner).run(blocking=is_remote_run)
- result = ie.current_env().pipeline_result(self.user_pipeline)
+ # Recalculate uncomputed PCollections because some may have finished
computing during the wait
+ computed_pcolls = set(
+ pcoll for pcoll in pcolls
+ if pcoll in ie.current_env().computed_pcollections)
+ uncomputed_pcolls = set(pcolls).difference(computed_pcolls)
Review Comment:
Done
##########
sdks/python/apache_beam/runners/interactive/recording_manager.py:
##########
@@ -710,19 +725,16 @@ def task():
return async_result
def _get_pipeline_graph(self):
- """Lazily initializes and returns the PipelineGraph."""
- if self._pipeline_graph is None:
- try:
- # Try to create the graph.
- self._pipeline_graph = PipelineGraph(self.user_pipeline)
- except (ImportError, NameError, AttributeError):
- # If pydot is missing, PipelineGraph() might crash.
- _LOGGER.warning(
- "Could not create PipelineGraph (pydot missing?). " \
- "Async features disabled."
- )
- self._pipeline_graph = None
- return self._pipeline_graph
+ """Initializes and returns the PipelineGraph."""
+ try:
+ # Try to create the graph.
+ return PipelineGraph(self.user_pipeline)
Review Comment:
Done. I changed the implementation to enable caching for pipeline graph,
please verify if this looks good to you, thanks Shunping!
##########
sdks/python/apache_beam/runners/interactive/recording_manager.py:
##########
Review Comment:
Helper function added.
##########
sdks/python/apache_beam/runners/interactive/recording_manager.py:
##########
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]