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 2022/10/08 14:46:03 UTC
[GitHub] [beam] lostluck opened a new issue, #23550: [Bug][Go SDK]: register.CombineN doesn't accept combiners with context.Context parameter
lostluck opened a new issue, #23550:
URL: https://github.com/apache/beam/issues/23550
### What happened?
It's valid to have combiners with a context parameter in any of the methods, for metrics and logging use, but the generic registration package doesn't tolerate it at this time.
Work arounds include continue using the static analysis code generator (starcgen), or not optimizing the combiner, or removing the context.Context issue.
Fix requires adjusting the generation template for the register package to also have acceptable extraction interfaces for Combine lifecycle methods with context parameters.
### Issue Priority
Priority: 2
### Issue Component
Component: sdk-go
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][Go SDK]: register.CombineN doesn't accept combiners with context.Context parameter [beam]
Posted by "jonathansudhakar1 (via GitHub) via github" <gi...@beam.apache.org>.
jonathansudhakar1 commented on issue #23550:
URL: https://github.com/apache/beam/issues/23550#issuecomment-6610627288
@lostluck, I'd like to pick this up. Since the issue is a few years old, I wanted to check the approach with you first.
It still reproduces on master:
- `register.Combiner1[int](c)`, where `c` has `MergeAccumulators(ctx context.Context, a, b int) int`, panics with `Failed to optimize MergeAccumulators for combiner &{}. Failed to infer types`.
- `Combiner3` panics the same way for a combiner that takes a ctx in every method.
`graph`'s CombineFn validation already accepts an optional leading `context.Context` on all four methods, so only `register` rejects it.
Plan:
- **Template:** in `sdks/go/pkg/beam/register/register.tmpl`, add ctx-first variants of the extraction interfaces: `createAccumulator1x1/1x2`, `addInput3x1/3x2`, `mergeAccumulators3x1/3x2` and `extractOutput2x1/2x2`.
- **`CombinerN`:** add a branch for each variant that registers the matching caller for the `func(context.Context, ...)` type and builds the method wrapper, the same way the existing branches do.
- **Regenerate** `register.go` with the `go generate` directives in `doc.go`.
- **Compatibility:** combiners without a ctx behave exactly as today. The "Failed to optimize" panics stay for signatures that are still unsupported.
- **Tests** in `register_test.go`:
- For `Combiner1/2/3`: combiners with a ctx in every method, with and without `error` returns. Assert that `reflectx.WrapMethods` returns working wrappers for all four methods.
- A `ptest` pipeline that runs `beam.Combine` on Prism with a registered ctx-taking combiner.
Does that match what you had in mind? Or would you rather fix it outside the template, for example by skipping optimization for ctx methods instead of panicking?
.take-issue
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][Go SDK]: register.CombineN doesn't accept combiners with context.Context parameter [beam]
Posted by "lostluck (via GitHub) via github" <gi...@beam.apache.org>.
lostluck commented on issue #23550:
URL: https://github.com/apache/beam/issues/23550#issuecomment-6612347996
That sounds accurate. Thank you!
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org