Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-1833] Preserve inputs names at graph construction and through proto transaltion. #15202

Merged
merged 5 commits into from
Jul 29, 2021

Conversation

robertwb
Copy link
Contributor


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

ValidatesRunner compliance status (on master branch)

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- Build Status Build Status Build Status Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Python --- Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status ---
XLang Build Status Build Status Build Status Build Status Build Status ---

Examples testing status on various runners

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- --- --- --- --- --- ---
Java --- Build Status
Build Status
Build Status
--- --- --- --- ---
Python --- --- --- --- --- --- ---
XLang --- --- --- --- --- --- ---

Post-Commit SDK/Transform Integration Tests Status (on master branch)

Go Java Python
Build Status Build Status Build Status
Build Status
Build Status

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace Typescript
Non-portable Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status Build Status
Portable --- Build Status Build Status --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@robertwb
Copy link
Contributor Author

R: @yifanmai

if not isinstance(leaf_input, pvalue.PValue):
raise TypeError
if not isinstance(inputs, dict):
inputs = {str(ix): input for (ix, input) in enumerate(inputs)}
except TypeError:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete the except branch; it is no longer needed because the PValue check is now done below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This catches a possible failure in enumerate.

tag: input if not input in output_map else output_map[input]
for (tag, input) in transform_node.main_inputs.items()
}
input_replacements[transform_node] = new_inputs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't leave a comment on Line 274 but the type annotation for input_replacements there needs to change from Dict[AppliedPTransform, Sequence[Union[pvalue.PBegin, pvalue.PCollection]]] to Dict[AppliedPTransform, Dict[str, Union[pvalue.PBegin, pvalue.PCollection]]] (or Mapping).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Done.

sdks/python/apache_beam/pipeline_test.py Outdated Show resolved Hide resolved
@@ -262,16 +263,21 @@ def get_named_nested_pvalues(pvalueish):
else:
tagged_values = enumerate(pvalueish)
elif isinstance(pvalueish, list):
if as_inputs:
yield None, pvalueish
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the rationale for this branch i.e. yielding the whole pvalueish versus enumerating it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for backwards compatibility with the "eager" mode (e.g. [1, 2, 3] | beam.Map(lambda x: x*x))

@@ -253,7 +254,7 @@ def visit(self, node):
return self.visit_nested(node)


def get_named_nested_pvalues(pvalueish):
def get_named_nested_pvalues(pvalueish, as_inputs=False):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the invocation of get_named_nested_pvalues() in pipeline.py, do we also need to stringify the tags (so that None becomes 'None')?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done elsewhere as needed.

@codecov
Copy link

codecov bot commented Jul 27, 2021

Codecov Report

Merging #15202 (96d82a4) into master (61a884e) will increase coverage by 0.00%.
The diff coverage is 97.05%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #15202   +/-   ##
=======================================
  Coverage   83.83%   83.83%           
=======================================
  Files         441      441           
  Lines       59706    59707    +1     
=======================================
+ Hits        50053    50055    +2     
+ Misses       9653     9652    -1     
Impacted Files Coverage Δ
...on/apache_beam/runners/dataflow/dataflow_runner.py 82.81% <ø> (ø)
sdks/python/apache_beam/pipeline.py 91.66% <94.73%> (+0.06%) ⬆️
...he_beam/runners/interactive/pipeline_instrument.py 99.47% <100.00%> (ø)
sdks/python/apache_beam/transforms/ptransform.py 93.54% <100.00%> (-0.06%) ⬇️
sdks/python/apache_beam/utils/interactive_utils.py 92.68% <0.00%> (-2.44%) ⬇️
...ks/python/apache_beam/runners/worker/sdk_worker.py 88.85% <0.00%> (-0.16%) ⬇️
...runners/interactive/display/pcoll_visualization.py 85.78% <0.00%> (+0.52%) ⬆️
...pache_beam/runners/interactive/interactive_beam.py 76.59% <0.00%> (+1.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61a884e...96d82a4. Read the comment docs.

@robertwb
Copy link
Contributor Author

Run Portable_Python PreCommit

@robertwb robertwb merged commit 939fa99 into apache:master Jul 29, 2021
emilymye added a commit to emilymye/beam that referenced this pull request Jul 30, 2021
tysonjh added a commit to tysonjh/beam that referenced this pull request Aug 5, 2021
ryanthompson591 pushed a commit to ryanthompson591/beam that referenced this pull request Aug 10, 2021
calvinleungyk pushed a commit to calvinleungyk/beam that referenced this pull request Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants