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 2021/01/29 22:30:54 UTC

[GitHub] [beam] yifanmai commented on a change in pull request #13848: [BEAM-11717] Validate post-optimized pipeline proto.

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



##########
File path: sdks/python/apache_beam/runners/portability/fn_api_runner/translations.py
##########
@@ -598,9 +606,33 @@ def copy_subtransforms(transform):
   del new_proto.root_transform_ids[:]
   new_proto.root_transform_ids.extend(roots)
 
+  known_primitives = set.union(set(BEAM_PRIMITIVES), known_runner_urns)
+  for transform in pipeline_proto.components.transforms.values():
+    if transform.spec.urn not in known_primitives and not is_composite(
+        transform):
+      known_primitives.add(transform.spec.urn)
+  if not partial:
+    known_primitives.add('beam:runner:executable_stage:v1')
+  validate_pipeline(new_proto, known_primitives)
+
   return new_proto
 
 
+def is_composite(transform):
+  return bool(
+      transform.subtransforms or not set.difference(
+          set(transform.outputs.values()), transform.inputs.values()))

Review comment:
       For my understanding, in what scenario would all outputs be contained inputs?




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