You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2017/01/18 22:01:09 UTC
[1/2] beam git commit: Metrics test in start/end_bundle for ParDos
Repository: beam
Updated Branches:
refs/heads/python-sdk b737ba907 -> b9cb29c83
Metrics test in start/end_bundle for ParDos
Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/18179a1f
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/18179a1f
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/18179a1f
Branch: refs/heads/python-sdk
Commit: 18179a1f76fddf76466d8cb6b7e1236f1c894edd
Parents: b737ba9
Author: Pablo <pa...@google.com>
Authored: Wed Jan 11 17:55:15 2017 -0800
Committer: Robert Bradshaw <ro...@gmail.com>
Committed: Wed Jan 18 14:00:57 2017 -0800
----------------------------------------------------------------------
sdks/python/apache_beam/runners/runner_test.py | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/beam/blob/18179a1f/sdks/python/apache_beam/runners/runner_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/runner_test.py b/sdks/python/apache_beam/runners/runner_test.py
index 2b6c316..89a6fdc 100644
--- a/sdks/python/apache_beam/runners/runner_test.py
+++ b/sdks/python/apache_beam/runners/runner_test.py
@@ -147,10 +147,18 @@ class RunnerTest(unittest.TestCase):
from apache_beam.metrics.metric import Metrics
class MyDoFn(beam.DoFn):
+ def start_bundle(self, context):
+ count = Metrics.counter(self.__class__, 'bundles')
+ count.inc()
+
+ def finish_bundle(self, context):
+ count = Metrics.counter(self.__class__, 'finished_bundles')
+ count.inc()
+
def process(self, context):
count = Metrics.counter(self.__class__, 'elements')
count.inc()
- distro = Metrics.distribution(self.__class__, 'element-dist')
+ distro = Metrics.distribution(self.__class__, 'element_dist')
distro.update(context.element)
return [context.element]
@@ -165,17 +173,24 @@ class RunnerTest(unittest.TestCase):
metrics = result.metrics().query()
namespace = '{}.{}'.format(MyDoFn.__module__,
MyDoFn.__name__)
+
hc.assert_that(
metrics['counters'],
hc.contains_inanyorder(
MetricResult(
MetricKey('do', MetricName(namespace, 'elements')),
- 5, 5)))
+ 5, 5),
+ MetricResult(
+ MetricKey('do', MetricName(namespace, 'bundles')),
+ 1, 1),
+ MetricResult(
+ MetricKey('do', MetricName(namespace, 'finished_bundles')),
+ 1, 1)))
hc.assert_that(
metrics['distributions'],
hc.contains_inanyorder(
MetricResult(
- MetricKey('do', MetricName(namespace, 'element-dist')),
+ MetricKey('do', MetricName(namespace, 'element_dist')),
DistributionResult(DistributionData(15, 5, 1, 5)),
DistributionResult(DistributionData(15, 5, 1, 5)))))
[2/2] beam git commit: Closes #1769
Posted by ro...@apache.org.
Closes #1769
Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/b9cb29c8
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/b9cb29c8
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/b9cb29c8
Branch: refs/heads/python-sdk
Commit: b9cb29c8318b636a6b6ad082caac4d3080544b93
Parents: b737ba9 18179a1
Author: Robert Bradshaw <ro...@gmail.com>
Authored: Wed Jan 18 14:00:58 2017 -0800
Committer: Robert Bradshaw <ro...@gmail.com>
Committed: Wed Jan 18 14:00:58 2017 -0800
----------------------------------------------------------------------
sdks/python/apache_beam/runners/runner_test.py | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------