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

Implement Aggregators directly in the DirectRunner #735

Closed

Conversation

bjchambers
Copy link
Contributor

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.

@bjchambers
Copy link
Contributor Author

R: @tgroh @kennknowles

StepContext stepContext,
CounterSet.AddCounterMutator addCounterMutator,
WindowingStrategy<?, ?> windowingStrategy) {
return simpleRunner(options, fn, sideInputReader, outputManager,
Copy link
Member

Choose a reason for hiding this comment

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

Format consistency?

@bjchambers
Copy link
Contributor Author

Done. PTAL.

@@ -82,7 +86,8 @@ public String getName() {
}
}

private final HashMap<String, AggregatorInfo<?, ?, ?>> accumulators = new HashMap<>();
private final ConcurrentHashMap<String, AggregatorInfo<?, ?, ?>> accumulators =
Copy link
Member

Choose a reason for hiding this comment

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

Just ConcurrentMap

@tgroh
Copy link
Member

tgroh commented Jul 26, 2016

Otherwise LGTM

@bjchambers
Copy link
Contributor Author

bjchambers commented Jul 27, 2016

Will wait for tests to turn green and then I'd like to submit. @kennknowles any comments?

@kennknowles
Copy link
Member

LGTM when green.

return new CounterAggregator<>(generateInternalAggregatorName(name),
combiner, addCounterMutator);
checkNotNull(combiner, "Combiner passed to createAggregator cannot be null");
return aggregatorFactory.createAggregator(name, combiner);
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 should be aggregatorFactory.createAggregator(generateInternalAggregatorName(name), combiner); to ensure we associate each aggregator with the current step context.

bchambers added 2 commits July 28, 2016 13:50
Previously, we relied on conversion to Counter rather than just
running the specified CombineFn. This aligns the direct runner
more closely with the model.

This PR also parameterizes DoFnRunner on an AggregatorFactory to
implement aggregators, allowing each runner to provide the appropriate
implementation.
@bjchambers
Copy link
Contributor Author

Updated to actually make sure that aggregators are properly scoped per-step. PTAL.

checkNotNull(combiner, "Combiner passed to createAggregator cannot be null");
return aggregatorFactory.createAggregator(name, combiner);
checkNotNull(combiner, "Combiner passed to createAggregatorForDoFn cannot be null");
boolean isSystemDoFn = fn.getClass().isAnnotationPresent(SystemDoFnInternal.class);
Copy link
Member

Choose a reason for hiding this comment

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

Unused

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@bjchambers
Copy link
Contributor Author

Running mvn verify and then I'll submit.

@asfgit asfgit closed this in 1df6f5f Jul 29, 2016
@bjchambers bjchambers deleted the direct-runner-aggregators branch November 21, 2016 21:41
pl04351820 pushed a commit to pl04351820/beam that referenced this pull request Dec 20, 2023
* chore: Update gapic-generator-python to v1.11.4

PiperOrigin-RevId: 547897126

Source-Link: googleapis/googleapis@c09c75e

Source-Link: https://github.com/googleapis/googleapis-gen/commit/45e0ec4343517cd0aa66b5ca64232a1802c2f945
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDVlMGVjNDM0MzUxN2NkMGFhNjZiNWNhNjQyMzJhMTgwMmMyZjk0NSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
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

3 participants