Update programming guide to suggest using NewDoFn approach to paramet…#458
Update programming guide to suggest using NewDoFn approach to paramet…#458reuvenlax wants to merge 4 commits intoapache:asf-sitefrom
Conversation
| @ProcessElement | ||
| public void processElement(ProcessContext c) { | ||
| c.output(c.element().length()); | ||
| public void processElement(@Element String word, OutputReceiver out) { |
There was a problem hiding this comment.
Is this backwards compatible to previous releases of Beam (2.x) if not, maybe we should say explictly so.
There was a problem hiding this comment.
@iemejia yes it is. ProcessContext still exists as before, and cannot be removed until Beam 3.0 for compatibility reasons.
There was a problem hiding this comment.
@reuvenlax I am not talking about ProcessContext I refer to @Element and the new annotations not included in previous versions of 2.x. Users should be aware of this given that there is not backwards compatibility on those.
| Beam SDKs are not thread-safe*. | ||
|
|
||
| In addition, it's recommended that you make your function object **idempotent**. | ||
| Non-idempotent functions are supported by Beam, but xN require additional |
|
|
||
| {:.language-java} | ||
| **PipelineOptions:** | ||
| The `PipelineOptions` for the current pipeline can always be accessed in a process method by adding it as a paramet: |
|
@melap How can I generate the docs to see what this looks like? |
melap
left a comment
There was a problem hiding this comment.
Left a couple minor comments. You can see the changes here: http://apache-beam-website-pull-requests.storage.googleapis.com/458/documentation/programming-guide/index.html (you can just use this URL and replace the PR # in it for any PR)
| that for you. Your `@ProcessElement` method should accept an object of type | ||
| `ProcessContext`. The `ProcessContext` object gives you access to an input | ||
| element and a method for emitting an output element: | ||
| that for you. Your `@ProcessElement` method should accept parameter tagged with |
| the key within the combining strategy. | ||
|
|
||
| ##### 4.2.4.3. Combining a PCollection into a single value {#combining-pcollection} | ||
| ##### 4.2. Combining a PCollection into a single value {#combining-pcollection} |
| user code might be invoked or retried; as such, keeping your function object | ||
| idempotent keeps your pipeline's output deterministic, and your transforms' | ||
| behavior more predictable and easier to debug. | ||
| effects. Non-idempotent functions are supported, however the beam model provides |
| {% github_sample /apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/snippets_test.py tag:model_pardo_with_undeclared_outputs | ||
| %}``` | ||
|
|
||
| #### 4.5.3. Accessing othe parameters in your DoFn {#other-dofn-parameters} |
|
@iemejia added a note that prior to Beam 2.5.0 ProcessContext should still be used. |
|
retest this please |
10 similar comments
|
retest this please |
|
retest this please |
|
retest this please |
|
retest this please |
|
retest this please |
|
retest this please |
|
retest this please |
|
retest this please |
|
retest this please |
|
retest this please |
|
Noting that "Automatic staging of pull requests" is up to date while the "Jenkins: Automatic staging of pull requests" is older. |
|
retest this please |
|
@reuvenlax Anything missing to merge this one ? Tests are ok given Kenn coment. |
|
Jumping on this one again. Anything else missing @reuvenlax / @melap ? |
|
Nothing missing to merge. I just was never able to get all tests to pass,
always for reasons unrelated to this change itself. I didn't see Kenn's
comment.
…On Mon, Aug 20, 2018 at 8:18 AM Ismaël Mejía ***@***.***> wrote:
Jumping on this one again. Anything else missing @reuvenlax
<https://github.com/reuvenlax> / @melap <https://github.com/melap> ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#458 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AUGE1T-oFM_0HiUCb3PztTXJCaBA0R89ks5uStNAgaJpZM4UarHU>
.
|
|
retest this please |
|
since the test results are over a month old, I'll retest and if all is well, will merge |
|
I fixed a couple language tab tag problems and all looks good on staging now, merging |
|
@asfgit merge |
Update documentation to suggest new parameter style instead of ProcessContext.