Skip to content

[BEAM-1928] Translate PTransforms to and from Runner API Protos#2540

Closed
tgroh wants to merge 5 commits into
apache:masterfrom
tgroh:ptransforms_utilities
Closed

[BEAM-1928] Translate PTransforms to and from Runner API Protos#2540
tgroh wants to merge 5 commits into
apache:masterfrom
tgroh:ptransforms_utilities

Conversation

@tgroh
Copy link
Copy Markdown
Member

@tgroh tgroh commented Apr 14, 2017

Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

  • Make sure the PR title is formatted like:
    [BEAM-<Jira issue #>] Description of pull request
  • Make sure tests pass via mvn clean verify. (Even better, enable
    Travis-CI on your fork and ensure the whole test matrix passes).
  • Replace <Jira issue #> in the title with the actual Jira issue
    number, if there is one.
  • If this contribution is large, please file an Apache
    Individual Contributor License Agreement.

Update SdkComponents to handle the translations.

Update SdkComponents to handle the translations.
Copy link
Copy Markdown
Member Author

@tgroh tgroh left a comment

Choose a reason for hiding this comment

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

@asfbot
Copy link
Copy Markdown

asfbot commented Apr 14, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/beam_PreCommit_Java_MavenInstall/9540/
--none--

@tgroh
Copy link
Copy Markdown
Member Author

tgroh commented Apr 14, 2017

retest this please

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.01%) to 70.457% when pulling dad03a2 on tgroh:ptransforms_utilities into eea96ff on apache:master.

ParDo and Combine additional inputs should have the PCollections that
are input to their PCollectionViews, not the PCollectionViews.
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.003%) to 70.464% when pulling ae30775 on tgroh:ptransforms_utilities into eea96ff on apache:master.

@asfbot
Copy link
Copy Markdown

asfbot commented Apr 14, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/beam_PreCommit_Java_MavenInstall/9548/
--none--

import org.apache.beam.sdk.values.PValue;
import org.apache.beam.sdk.values.TupleTag;

/** Created by tgroh on 4/7/17. */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

comment?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

* <p>Does not register {@code application} within the provided {@link SdkComponents}.
*/
public static RunnerApi.PTransform toProto(
AppliedPTransform<?, ?, ?> application,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

application -> appliedPTransform
This will also make the comment easier to read

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

// TODO: Display Data

PTransform<?, ?> transform = application.getTransform();
if (KNOWN_PAYLOAD_TRANSLATORS.containsKey(transform.getClass())) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Using a service loader for known payload translators will help for user defined composites which want to bind transform to/from proto using the data block

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ACK. That is the goal, though potentially in addition to the constant set of known payloads, which will appear in a later change.

*
* <p>Does not register {@code application} within the provided {@link SdkComponents}.
*/
public static RunnerApi.PTransform toProto(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

package private?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

* will not be added to the components produced by this {@link SdkComponents} until it is
* translated via {@link #registerPTransform(AppliedPTransform, List)}.
*/
public String registerPTransform(AppliedPTransform<?, ?, ?> pTransform) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

private?

Seems like nobody should call this method as its usage is an internal detail of this class

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

package-private. It's required when converting a PTransform, as we should not forbid the translation of a composite before any of its children.

}
checkState(
missingTransforms.isEmpty(),
"%s transforms were registered but were never added to components. Missing transform %s",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a way to get it so that registerPTransform(AppliedPTransform, List) is always invoked (with an empty list representing no children) instead of needing this validate method?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We don't keep information about child nodes within AppliedPTransform, so I don't believe it is at the current time.

@tgroh tgroh force-pushed the ptransforms_utilities branch from f0b225b to 1c8472b Compare April 17, 2017 18:28
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.007%) to 70.655% when pulling 6c31b14 on tgroh:ptransforms_utilities into 8302783 on apache:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.003%) to 70.666% when pulling 6c31b14 on tgroh:ptransforms_utilities into 8302783 on apache:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.003%) to 70.666% when pulling 6c31b14 on tgroh:ptransforms_utilities into 8302783 on apache:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 70.662% when pulling 6c31b14 on tgroh:ptransforms_utilities into 8302783 on apache:master.

@lukecwik
Copy link
Copy Markdown
Member

LGTM

@asfgit asfgit closed this in 4f0146a Apr 18, 2017
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.

4 participants