You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/12/14 23:24:25 UTC

[GitHub] [beam] yifanmai commented on a change in pull request #13549: [BEAM-11196] Fix `None` parent when fusing >2 stages

yifanmai commented on a change in pull request #13549:
URL: https://github.com/apache/beam/pull/13549#discussion_r542919666



##########
File path: sdks/python/apache_beam/runners/portability/fn_api_runner/translations.py
##########
@@ -1217,23 +1215,33 @@ def get_ancestors(name):
 
 
 def _parent_for_fused_stages(stages, context):
-  # type: (Iterable[Optional[str]], TransformContext) -> Optional[str]
+  # type: (Iterable[Stage], TransformContext) -> Optional[str]
 
   '''Returns the name of the new parent for the fused stages.
 
   The new parent is the lowest common ancestor of the fused stages that is not
   contained in the set of stages to be fused. The provided context is used to
   compute ancestors of stages.
   '''
+
+  parents = context.parents_map()
+  # If any of the input stages were produced by fusion or an optimizer phase,

Review comment:
       Nope-ish. This problem really arises because for stages going through the phases, there are two sources of truth for their parents: `parent` field of the stage and the `subtransforms` field of transforms in the `PipelineContext`. The parent of a stage _has_ to be a transform in PipelineContext, which means there is only one source of truth (the `subtransforms` field). So we don't encounter this issue with grandparents.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org