[jira] [Work logged] (BEAM-5097) Increment counter for "small words" in go SDK example
[ https://issues.apache.org/jira/browse/BEAM-5097?focusedWorklogId=154100=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-154100 ] ASF GitHub Bot logged work on BEAM-5097: Author: ASF GitHub Bot Created on: 13/Oct/18 14:07 Start Date: 13/Oct/18 14:07 Worklog Time Spent: 10m Work Description: stale[bot] closed pull request #6157: [BEAM-5097][WIP] Add counter to combine example in go sdk URL: https://github.com/apache/beam/pull/6157 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/sdks/go/examples/cookbook/combine/combine.go b/sdks/go/examples/cookbook/combine/combine.go index 7e24aa1fb30..1950a687d24 100644 --- a/sdks/go/examples/cookbook/combine/combine.go +++ b/sdks/go/examples/cookbook/combine/combine.go @@ -63,11 +63,16 @@ type extractFn struct { MinLength int `json:"min_length"` } +// A global context for simplicity. +var ctx = context.Background() + func (f *extractFn) ProcessElement(row WordRow, emit func(string, string)) { + small_words := beam.NewCounter("example.namespace", "small_words") if len(row.Word) >= f.MinLength { emit(row.Word, row.Corpus) + } else { + small_words.Inc(ctx, 1) } - // TODO(herohde) 7/14/2017: increment counter for "small words" } // TODO(herohde) 7/14/2017: the choice of a string (instead of []string) for the This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 154100) Time Spent: 1h 40m (was: 1.5h) > Increment counter for "small words" in go SDK example > - > > Key: BEAM-5097 > URL: https://issues.apache.org/jira/browse/BEAM-5097 > Project: Beam > Issue Type: Improvement > Components: sdk-go >Reporter: holdenk >Assignee: holdenk >Priority: Trivial > Time Spent: 1h 40m > Remaining Estimate: 0h > > Increment counter for "small words" in go SDK example -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5097) Increment counter for "small words" in go SDK example
[ https://issues.apache.org/jira/browse/BEAM-5097?focusedWorklogId=154099=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-154099 ] ASF GitHub Bot logged work on BEAM-5097: Author: ASF GitHub Bot Created on: 13/Oct/18 14:07 Start Date: 13/Oct/18 14:07 Worklog Time Spent: 10m Work Description: stale[bot] commented on issue #6157: [BEAM-5097][WIP] Add counter to combine example in go sdk URL: https://github.com/apache/beam/pull/6157#issuecomment-429545012 This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 154099) Time Spent: 1.5h (was: 1h 20m) > Increment counter for "small words" in go SDK example > - > > Key: BEAM-5097 > URL: https://issues.apache.org/jira/browse/BEAM-5097 > Project: Beam > Issue Type: Improvement > Components: sdk-go >Reporter: holdenk >Assignee: holdenk >Priority: Trivial > Time Spent: 1.5h > Remaining Estimate: 0h > > Increment counter for "small words" in go SDK example -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5097) Increment counter for "small words" in go SDK example
[ https://issues.apache.org/jira/browse/BEAM-5097?focusedWorklogId=151979=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-151979 ] ASF GitHub Bot logged work on BEAM-5097: Author: ASF GitHub Bot Created on: 06/Oct/18 13:16 Start Date: 06/Oct/18 13:16 Worklog Time Spent: 10m Work Description: stale[bot] commented on issue #6157: [BEAM-5097][WIP] Add counter to combine example in go sdk URL: https://github.com/apache/beam/pull/6157#issuecomment-427573014 This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the d...@beam.apache.org list. Thank you for your contributions. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 151979) Time Spent: 1h 20m (was: 1h 10m) > Increment counter for "small words" in go SDK example > - > > Key: BEAM-5097 > URL: https://issues.apache.org/jira/browse/BEAM-5097 > Project: Beam > Issue Type: Improvement > Components: sdk-go >Reporter: holdenk >Assignee: holdenk >Priority: Trivial > Time Spent: 1h 20m > Remaining Estimate: 0h > > Increment counter for "small words" in go SDK example -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5097) Increment counter for "small words" in go SDK example
[ https://issues.apache.org/jira/browse/BEAM-5097?focusedWorklogId=131641=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-131641 ] ASF GitHub Bot logged work on BEAM-5097: Author: ASF GitHub Bot Created on: 06/Aug/18 22:40 Start Date: 06/Aug/18 22:40 Worklog Time Spent: 10m Work Description: holdenk commented on a change in pull request #6157: [BEAM-5097] Add counter to combine example in go sdk URL: https://github.com/apache/beam/pull/6157#discussion_r208050043 ## File path: sdks/go/examples/cookbook/combine/combine.go ## @@ -63,11 +63,16 @@ type extractFn struct { MinLength int `json:"min_length"` } +// A global context for simplicity. +var ctx = context.Background() + func (f *extractFn) ProcessElement(row WordRow, emit func(string, string)) { + small_words := beam.NewCounter("example.namespace", "small_words") Review comment: Sounds good. @herohde pointed out the WC example uses counters too so I'm going to go take a look at that as well. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 131641) Time Spent: 1h (was: 50m) > Increment counter for "small words" in go SDK example > - > > Key: BEAM-5097 > URL: https://issues.apache.org/jira/browse/BEAM-5097 > Project: Beam > Issue Type: Improvement > Components: sdk-go >Reporter: holdenk >Assignee: holdenk >Priority: Trivial > Time Spent: 1h > Remaining Estimate: 0h > > Increment counter for "small words" in go SDK example -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5097) Increment counter for "small words" in go SDK example
[ https://issues.apache.org/jira/browse/BEAM-5097?focusedWorklogId=131642=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-131642 ] ASF GitHub Bot logged work on BEAM-5097: Author: ASF GitHub Bot Created on: 06/Aug/18 22:40 Start Date: 06/Aug/18 22:40 Worklog Time Spent: 10m Work Description: holdenk commented on issue #6157: [BEAM-5097][WIP] Add counter to combine example in go sdk URL: https://github.com/apache/beam/pull/6157#issuecomment-410875484 Switched to WIP since was pointed out another place uses counters that I didn't notice so I'll go check that as well. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 131642) Time Spent: 1h 10m (was: 1h) > Increment counter for "small words" in go SDK example > - > > Key: BEAM-5097 > URL: https://issues.apache.org/jira/browse/BEAM-5097 > Project: Beam > Issue Type: Improvement > Components: sdk-go >Reporter: holdenk >Assignee: holdenk >Priority: Trivial > Time Spent: 1h 10m > Remaining Estimate: 0h > > Increment counter for "small words" in go SDK example -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5097) Increment counter for "small words" in go SDK example
[ https://issues.apache.org/jira/browse/BEAM-5097?focusedWorklogId=131636=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-131636 ] ASF GitHub Bot logged work on BEAM-5097: Author: ASF GitHub Bot Created on: 06/Aug/18 22:35 Start Date: 06/Aug/18 22:35 Worklog Time Spent: 10m Work Description: lostluck removed a comment on issue #6157: [BEAM-5097] Add counter to combine example in go sdk URL: https://github.com/apache/beam/pull/6157#issuecomment-410874134 Thanks for the PR! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 131636) Time Spent: 0.5h (was: 20m) > Increment counter for "small words" in go SDK example > - > > Key: BEAM-5097 > URL: https://issues.apache.org/jira/browse/BEAM-5097 > Project: Beam > Issue Type: Improvement > Components: sdk-go >Reporter: holdenk >Assignee: holdenk >Priority: Trivial > Time Spent: 0.5h > Remaining Estimate: 0h > > Increment counter for "small words" in go SDK example -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5097) Increment counter for "small words" in go SDK example
[ https://issues.apache.org/jira/browse/BEAM-5097?focusedWorklogId=131638=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-131638 ] ASF GitHub Bot logged work on BEAM-5097: Author: ASF GitHub Bot Created on: 06/Aug/18 22:35 Start Date: 06/Aug/18 22:35 Worklog Time Spent: 10m Work Description: lostluck commented on a change in pull request #6157: [BEAM-5097] Add counter to combine example in go sdk URL: https://github.com/apache/beam/pull/6157#discussion_r208046722 ## File path: sdks/go/examples/cookbook/combine/combine.go ## @@ -63,11 +63,16 @@ type extractFn struct { MinLength int `json:"min_length"` } +// A global context for simplicity. +var ctx = context.Background() Review comment: Since this is a cookbook the correct way to get a context is to have it as the first argument (as per the go idiom) to the ProcessElement method. The beam runtime will automatically provide a context for the function during execution. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 131638) Time Spent: 50m (was: 40m) > Increment counter for "small words" in go SDK example > - > > Key: BEAM-5097 > URL: https://issues.apache.org/jira/browse/BEAM-5097 > Project: Beam > Issue Type: Improvement > Components: sdk-go >Reporter: holdenk >Assignee: holdenk >Priority: Trivial > Time Spent: 50m > Remaining Estimate: 0h > > Increment counter for "small words" in go SDK example -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5097) Increment counter for "small words" in go SDK example
[ https://issues.apache.org/jira/browse/BEAM-5097?focusedWorklogId=131637=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-131637 ] ASF GitHub Bot logged work on BEAM-5097: Author: ASF GitHub Bot Created on: 06/Aug/18 22:35 Start Date: 06/Aug/18 22:35 Worklog Time Spent: 10m Work Description: lostluck commented on a change in pull request #6157: [BEAM-5097] Add counter to combine example in go sdk URL: https://github.com/apache/beam/pull/6157#discussion_r208048664 ## File path: sdks/go/examples/cookbook/combine/combine.go ## @@ -63,11 +63,16 @@ type extractFn struct { MinLength int `json:"min_length"` } +// A global context for simplicity. +var ctx = context.Background() + func (f *extractFn) ProcessElement(row WordRow, emit func(string, string)) { + small_words := beam.NewCounter("example.namespace", "small_words") Review comment: For perf reasons it's better to declare the counter in the package scope, but either works correctly. Better to show the recommended path as part of real examples or recipes I think. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 131637) Time Spent: 40m (was: 0.5h) > Increment counter for "small words" in go SDK example > - > > Key: BEAM-5097 > URL: https://issues.apache.org/jira/browse/BEAM-5097 > Project: Beam > Issue Type: Improvement > Components: sdk-go >Reporter: holdenk >Assignee: holdenk >Priority: Trivial > Time Spent: 40m > Remaining Estimate: 0h > > Increment counter for "small words" in go SDK example -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5097) Increment counter for "small words" in go SDK example
[ https://issues.apache.org/jira/browse/BEAM-5097?focusedWorklogId=131635=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-131635 ] ASF GitHub Bot logged work on BEAM-5097: Author: ASF GitHub Bot Created on: 06/Aug/18 22:34 Start Date: 06/Aug/18 22:34 Worklog Time Spent: 10m Work Description: lostluck commented on issue #6157: [BEAM-5097] Add counter to combine example in go sdk URL: https://github.com/apache/beam/pull/6157#issuecomment-410874134 Thanks for the PR! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 131635) Time Spent: 20m (was: 10m) > Increment counter for "small words" in go SDK example > - > > Key: BEAM-5097 > URL: https://issues.apache.org/jira/browse/BEAM-5097 > Project: Beam > Issue Type: Improvement > Components: sdk-go >Reporter: holdenk >Assignee: holdenk >Priority: Trivial > Time Spent: 20m > Remaining Estimate: 0h > > Increment counter for "small words" in go SDK example -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5097) Increment counter for "small words" in go SDK example
[ https://issues.apache.org/jira/browse/BEAM-5097?focusedWorklogId=131630=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-131630 ] ASF GitHub Bot logged work on BEAM-5097: Author: ASF GitHub Bot Created on: 06/Aug/18 22:14 Start Date: 06/Aug/18 22:14 Worklog Time Spent: 10m Work Description: holdenk opened a new pull request #6157: [BEAM-5097] Add counter to combine example in go sdk URL: https://github.com/apache/beam/pull/6157 Add counter to combine example in go sdk to demonstrate counters. I'm basing this off of the test because there aren't any examples yet. I'm especially curious if this is the right thing to do with the context cc @herohde @lostluck Follow this checklist to help us incorporate your contribution quickly and easily: - [X ] 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. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). It will help us expedite review of your Pull Request if you tag someone (e.g. `@username`) to look at it. Post-Commit Tests Status (on master branch) Lang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark --- | --- | --- | --- | --- | --- | --- | --- Go | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go_GradleBuild/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_GradleBuild/lastCompletedBuild/) | --- | --- | --- | --- | --- | --- Java | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_GradleBuild/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_GradleBuild/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex_Gradle/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Gradle/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Gradle/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump_Gradle/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza_Gradle/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark_Gradle/lastCompletedBuild/) Python | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Python_Verify/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python_Verify/lastCompletedBuild/) | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/) [![Build Status](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/) | --- | --- | --- | --- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 131630) Time Spent: 10m Remaining Estimate: 0h > Increment counter for "small words" in go SDK example > - > > Key: BEAM-5097 > URL: https://issues.apache.org/jira/browse/BEAM-5097 > Project: Beam > Issue Type: Improvement > Components: sdk-go >Reporter: holdenk >