Skip to content

Commit

Permalink
Allow implicit n-arry outputs of chain composite and pipelines.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertwb committed Apr 4, 2024
1 parent 9e98ada commit bd1945e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions sdks/python/apache_beam/yaml/yaml_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,13 @@ class CompositePTransform(beam.PTransform):
@staticmethod
def expand(inputs):
inner_scope.compute_all()
return {
key: inner_scope.get_pcollection(value)
for (key, value) in spec['output'].items()
}
if '__implicit_outputs__' in spec['output']:
return inner_scope.get_outputs(spec['output']['__implicit_outputs__'])
else:
return {
key: inner_scope.get_pcollection(value)
for (key, value) in spec['output'].items()
}

if 'name' not in spec:
spec['name'] = 'Composite'
Expand Down Expand Up @@ -596,7 +599,7 @@ def is_not_output_of_last_transform(new_transforms, value):
for (key, value) in composite_spec['output'].items()
}
else:
composite_spec['output'] = last_transform
composite_spec['output'] = {'__implicit_outputs__': last_transform}
if 'name' not in composite_spec:
composite_spec['name'] = 'Chain'
composite_spec['type'] = 'composite'
Expand Down

0 comments on commit bd1945e

Please sign in to comment.