You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by al...@apache.org on 2017/08/30 23:49:29 UTC
[1/2] beam git commit: Add a log message to ValueError in AsSingleton
Repository: beam
Updated Branches:
refs/heads/master 097aec7a3 -> afe8b0ea1
Add a log message to ValueError in AsSingleton
Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/521b2d71
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/521b2d71
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/521b2d71
Branch: refs/heads/master
Commit: 521b2d711b373e64bff7f603ba45cd2a617f6e5e
Parents: 097aec7
Author: Ahmet Altay <al...@google.com>
Authored: Mon Aug 28 15:34:26 2017 -0700
Committer: Ahmet Altay <al...@google.com>
Committed: Wed Aug 30 16:49:07 2017 -0700
----------------------------------------------------------------------
sdks/python/apache_beam/pvalue.py | 5 +++--
sdks/python/apache_beam/pvalue_test.py | 8 ++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/beam/blob/521b2d71/sdks/python/apache_beam/pvalue.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/pvalue.py b/sdks/python/apache_beam/pvalue.py
index 34a483e..35686f7 100644
--- a/sdks/python/apache_beam/pvalue.py
+++ b/sdks/python/apache_beam/pvalue.py
@@ -329,8 +329,9 @@ class AsSingleton(AsSideInput):
elif len(head) == 1:
return head[0]
raise ValueError(
- 'PCollection with more than one element accessed as '
- 'a singleton view.')
+ 'PCollection of size %d with more than one element accessed as a '
+ 'singleton view. First two elements encountered are "%s", "%s".' % (
+ len(head), str(head[0]), str(head[1])))
@property
def element_type(self):
http://git-wip-us.apache.org/repos/asf/beam/blob/521b2d71/sdks/python/apache_beam/pvalue_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/pvalue_test.py b/sdks/python/apache_beam/pvalue_test.py
index 4acbc52..48203df 100644
--- a/sdks/python/apache_beam/pvalue_test.py
+++ b/sdks/python/apache_beam/pvalue_test.py
@@ -19,6 +19,7 @@
import unittest
+from apache_beam.pvalue import AsSingleton
from apache_beam.pvalue import PValue
from apache_beam.testing.test_pipeline import TestPipeline
@@ -30,6 +31,13 @@ class PValueTest(unittest.TestCase):
value = PValue(pipeline)
self.assertEqual(pipeline, value.pipeline)
+ def test_assingleton_multi_element(self):
+ with self.assertRaisesRegexp(
+ ValueError,
+ 'PCollection of size 2 with more than one element accessed as a '
+ 'singleton view. First two elements encountered are \"1\", \"2\".'):
+ AsSingleton._from_runtime_iterable([1, 2], {})
+
if __name__ == '__main__':
unittest.main()
[2/2] beam git commit: This closes #3777
Posted by al...@apache.org.
This closes #3777
Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/afe8b0ea
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/afe8b0ea
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/afe8b0ea
Branch: refs/heads/master
Commit: afe8b0ea1783ac7df7a435f385af8a4301e5c2e6
Parents: 097aec7 521b2d7
Author: Ahmet Altay <al...@google.com>
Authored: Wed Aug 30 16:49:18 2017 -0700
Committer: Ahmet Altay <al...@google.com>
Committed: Wed Aug 30 16:49:18 2017 -0700
----------------------------------------------------------------------
sdks/python/apache_beam/pvalue.py | 5 +++--
sdks/python/apache_beam/pvalue_test.py | 8 ++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------