Repository: beam Updated Branches: refs/heads/master 817688aac -> d04a88e7e
Simple refactoring of core content from Dataflow -> Beam Project: http://git-wip-us.apache.org/repos/asf/beam/repo Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/f394f506 Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/f394f506 Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/f394f506 Branch: refs/heads/master Commit: f394f50664cfa03c231aa7049fdecb9227870df1 Parents: 5e2a4d5 Author: Ahmet Altay <[email protected]> Authored: Thu Feb 16 11:03:16 2017 -0800 Committer: Ahmet Altay <[email protected]> Committed: Thu Feb 16 11:51:36 2017 -0800 ---------------------------------------------------------------------- sdks/python/apache_beam/coders/stream.pyx | 6 +++--- sdks/python/apache_beam/error.py | 14 +++++++------- .../apache_beam/examples/complete/estimate_pi_test.py | 4 ++-- sdks/python/apache_beam/transforms/util.py | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/beam/blob/f394f506/sdks/python/apache_beam/coders/stream.pyx ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/coders/stream.pyx b/sdks/python/apache_beam/coders/stream.pyx index e29f121..845f289 100644 --- a/sdks/python/apache_beam/coders/stream.pyx +++ b/sdks/python/apache_beam/coders/stream.pyx @@ -154,9 +154,9 @@ cdef class InputStream(object): cpdef long read_byte(self) except? -1: self.pos += 1 - # Note: the C++ compiler on Dataflow workers treats the char array below as - # a signed char. This causes incorrect coder behavior unless explicitly - # cast to an unsigned char here. + # Note: Some C++ compilers treats the char array below as a signed char. + # This causes incorrect coder behavior unless explicitly cast to an + # unsigned char here. return <long>(<unsigned char> self.allc[self.pos - 1]) cpdef size_t size(self) except? -1: http://git-wip-us.apache.org/repos/asf/beam/blob/f394f506/sdks/python/apache_beam/error.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/error.py b/sdks/python/apache_beam/error.py index a714bcf..672469d 100644 --- a/sdks/python/apache_beam/error.py +++ b/sdks/python/apache_beam/error.py @@ -18,25 +18,25 @@ """Python Dataflow error classes.""" -class DataflowError(Exception): - """Base class for all Dataflow errors.""" +class BeamError(Exception): + """Base class for all Beam errors.""" -class PipelineError(DataflowError): +class PipelineError(BeamError): """An error in the pipeline object (e.g. a PValue not linked to it).""" -class PValueError(DataflowError): +class PValueError(BeamError): """An error related to a PValue object (e.g. value is not computed).""" -class RunnerError(DataflowError): +class RunnerError(BeamError): """An error related to a Runner object (e.g. cannot find a runner to run).""" -class SideInputError(DataflowError): +class SideInputError(BeamError): """An error related to a side input to a parallel Do operation.""" -class TransformError(DataflowError): +class TransformError(BeamError): """An error related to a PTransform object.""" http://git-wip-us.apache.org/repos/asf/beam/blob/f394f506/sdks/python/apache_beam/examples/complete/estimate_pi_test.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/examples/complete/estimate_pi_test.py b/sdks/python/apache_beam/examples/complete/estimate_pi_test.py index 235cee9..dc5b901 100644 --- a/sdks/python/apache_beam/examples/complete/estimate_pi_test.py +++ b/sdks/python/apache_beam/examples/complete/estimate_pi_test.py @@ -23,14 +23,14 @@ import unittest from apache_beam.examples.complete import estimate_pi from apache_beam.test_pipeline import TestPipeline from apache_beam.transforms.util import assert_that -from apache_beam.transforms.util import DataflowAssertException +from apache_beam.transforms.util import BeamAssertException def in_between(lower, upper): def _in_between(actual): _, _, estimate = actual[0] if estimate < lower or estimate > upper: - raise DataflowAssertException( + raise BeamAssertException( 'Failed assert: %f not in [%f, %f]' % (estimate, lower, upper)) return _in_between http://git-wip-us.apache.org/repos/asf/beam/blob/f394f506/sdks/python/apache_beam/transforms/util.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/transforms/util.py b/sdks/python/apache_beam/transforms/util.py index 56902dd..e3f5b85 100644 --- a/sdks/python/apache_beam/transforms/util.py +++ b/sdks/python/apache_beam/transforms/util.py @@ -169,7 +169,7 @@ def RemoveDuplicates(pcoll): # pylint: disable=invalid-name | 'RemoveDuplicates' >> Keys()) -class DataflowAssertException(Exception): +class BeamAssertException(Exception): """Exception raised by matcher classes used by assert_that transform.""" pass @@ -187,7 +187,7 @@ def equal_to(expected): sorted_expected = sorted(expected) sorted_actual = sorted(actual) if sorted_expected != sorted_actual: - raise DataflowAssertException( + raise BeamAssertException( 'Failed assert: %r == %r' % (sorted_expected, sorted_actual)) return _equal @@ -196,7 +196,7 @@ def is_empty(): def _empty(actual): actual = list(actual) if actual: - raise DataflowAssertException( + raise BeamAssertException( 'Failed assert: [] == %r' % actual) return _empty @@ -211,7 +211,7 @@ def assert_that(actual, matcher, label='assert_that'): actual: A PCollection. matcher: A matcher function taking as argument the actual value of a materialized PCollection. The matcher validates this actual value against - expectations and raises DataflowAssertException if they are not met. + expectations and raises BeamAssertException if they are not met. label: Optional string label. This is needed in case several assert_that transforms are introduced in the same pipeline.
