[
https://issues.apache.org/jira/browse/BEAM-1104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15749228#comment-15749228
]
ASF GitHub Bot commented on BEAM-1104:
--
GitHub user bjchambers opened a pull request:
https://github.com/apache/incubator-beam/pull/1615
[BEAM-1104] Don't incorrectly log error in MetricsEnvironment
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-] 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 `` 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](https://www.apache.org/licenses/icla.txt).
---
Using getCurrentContainer() logs an error if metrics are not supported.
This is because it acts as the common point of access for user code that
reports metrics.
It should not be used within setCurrentContainer(), because the first
container being set will have a null previous-current-container, which
will cause the error to be incorrectly logged.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/bjchambers/incubator-beam fix-metrics-warning
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-beam/pull/1615.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1615
commit 125223f8feb3576d3ff5ccdffa58a5e80808286c
Author: bchambers
Date: 2016-12-14T19:23:39Z
Don't incorrectly log error in MetricsEnvironment
Using getCurrentContainer() logs an error if metrics are not supported.
This is because it acts as the common point of access for user code that
reports metrics.
It should not be used within setCurrentContainer(), because the first
container being set will have a null previous-current-container, which
will cause the error to be incorrectly logged.
> WordCount: Metrics error in the DirectRunner
>
>
> Key: BEAM-1104
> URL: https://issues.apache.org/jira/browse/BEAM-1104
> Project: Beam
> Issue Type: Bug
> Components: runner-direct
>Reporter: Daniel Halperin
>Assignee: Ben Chambers
>
> I'm following the Beam quickstart to analyze the pom.xml for the examples
> archetype in the DirectRunner:
> Generate the project:
> {code}
> mvn archetype:generate \
>
> -DarchetypeRepository=https://repository.apache.org/content/groups/snapshots
> \
> -DarchetypeGroupId=org.apache.beam \
> -DarchetypeArtifactId=beam-sdks-java-maven-archetypes-examples \
> -DarchetypeVersion=LATEST \
> -DgroupId=org.example \
> -DartifactId=word-count-beam \
> -Dversion="0.1" \
> -Dpackage=org.apache.beam.examples \
> -DinteractiveMode=false
> {code}
> Count words in the pom.xml:
> {code}
> mvn compile exec:java -Dexec.mainClass=org.apache.beam.examples.WordCount \
> -Dexec.args="--inputFile=pom.xml --output=direct/counts" -Pdirect-runner
> {code}
> The logs:
> {code}
> INFO] --- exec-maven-plugin:1.4.0:java (default-cli) @ word-count-beam ---
> Dec 07, 2016 9:42:03 PM org.apache.beam.sdk.io.FileBasedSource
> expandFilePattern
> INFO: Matched 1 files for pattern pom.xml
> Dec 07, 2016 9:42:03 PM org.apache.beam.sdk.metrics.MetricsEnvironment
> getCurrentContainer
> SEVERE: Unable to update metrics on the current thread. Most likely caused by
> using metrics outside the managed work-execution thread.
> Dec 07, 2016 9:42:03 PM org.apache.beam.sdk.io.Write$Bound$1 processElement
> INFO: Initializing write operation
> org.apache.beam.sdk.io.TextIO$TextSink$TextWriteOperation@26bbd1cf
> Dec 07, 2016 9:42:04 PM org.apache.beam.sdk.io.Write$Bound$WriteBundles
> processElement
> INFO: Opening writer for write operation
> org.apache.beam.sdk.io.TextIO$TextSink$TextWriteOperation@19371061
> Dec 07, 2016 9:42:04 PM org.apache.beam.sdk.io.Write$Bound$WriteBundles
> processElement
> INFO: Opening writer for write operation
> org.apache.beam.sdk.io.TextIO$TextSink$TextWriteOperation@19371061
> Dec 07, 2016 9:42:04 PM org.apache.beam.sdk.io.Write$Bound$WriteBundles
> processElement
> INFO: Opening writer for write operation
> org.apache.beam.sdk.io.TextIO$TextSink$TextWriteOperation@19371061
> Dec 07, 2016 9:42:04 PM org.apache.beam.sdk.io.Write$Bound$WriteBundles
> processElement
> INFO: Opening