Add issue link to disabled TensorRT integration test #6011
46 fail, 80 skipped, 753 pass in 5m 45s
4 files 4 suites 5m 45s ⏱️
879 tests 753 ✅ 80 💤 46 ❌
1 727 runs 1 494 ✅ 148 💤 85 ❌
Results for commit a90a100.
Annotations
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTest
github-actions / Test Results
All 2 runs failed: test_do_fn_with_start_error (apache_beam.transforms.ptransform_test.PTransformTest)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 1s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
> bundle_method()
apache_beam/runners/common.py:1559:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:609: in apache_beam.runners.common.DoFnInvoker.invoke_start_bundle
def invoke_start_bundle(self):
apache_beam/runners/common.py:618: in apache_beam.runners.common.DoFnInvoker.invoke_start_bundle
self.output_handler.start_bundle_outputs(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> raise RuntimeError(
'Start Bundle should not output any elements but got %s' % results)
E RuntimeError: Start Bundle should not output any elements but got [1]
apache_beam/runners/common.py:1824: RuntimeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTest testMethod=test_do_fn_with_start_error>
def test_do_fn_with_start_error(self):
class MyDoFn(beam.DoFn):
def start_bundle(self):
return [1]
def process(self, element):
pass
with self.assertRaises(RuntimeError):
> with TestPipeline() as p:
apache_beam/transforms/ptransform_test.py:392:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:620: in __exit__
self.result = self.run()
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:570: in run
self._options).run(False)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1227: in process_bundle
op.start()
apache_beam/runners/worker/operations.py:926: in apache_beam.runners.worker.operations.DoOperation.start
def start(self):
apache_beam/runners/worker/operations.py:928: in apache_beam.runners.worker.operations.DoOperation.start
with self.scoped_start_state:
apache_beam/runners/worker/operations.py:931: in apache_beam.runners.worker.operations.DoOperation.start
self.dofn_runner.start()
apache_beam/runners/common.py:1576: in apache_beam.runners.common.DoFnRunner.start
self._invoke_bundle_method(self.do_fn_invoker.invoke_start_bundle)
apache_beam/runners/common.py:1561: in apache_beam.runners.common.DoFnRunner._invoke_bundle_method
self._reraise_augmented(exn)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTest
github-actions / Test Results
All 2 runs failed: test_partition_with_partition_fn (apache_beam.transforms.ptransform_test.PTransformTest)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 3s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 7s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:917: in apache_beam.runners.common.PerWindowInvoker.invoke_process
self._invoke_process_per_window(
apache_beam/runners/common.py:1059: in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1677: in apache_beam.runners.common._OutputHandler.handle_process_outputs
for result in results:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <apache_beam.transforms.core.Partition.ApplyPartitionFnFn object at 0x7d9363411d50>
element = 0
partitionfn = <apache_beam.transforms.ptransform_test.SomePartitionFn object at 0x7d9363590bd0>
n = 4, args = (10000,), kwargs = {}, partition = 10000
def process(self, element, partitionfn, n, *args, **kwargs):
partition = partitionfn.partition_for(element, n, *args, **kwargs)
if not 0 <= partition < n:
> raise ValueError(
'PartitionFn specified out-of-bounds partition index: '
'%d not in [0, %d)' % (partition, n))
E ValueError: PartitionFn specified out-of-bounds partition index: 10000 not in [0, 4)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/transforms/core.py:3578: ValueError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTest testMethod=test_partition_with_partition_fn>
def test_partition_with_partition_fn(self):
class SomePartitionFn(beam.PartitionFn):
def partition_for(self, element, num_partitions, offset):
return (element % 3) + offset
with TestPipeline() as pipeline:
pcoll = pipeline | 'Start' >> beam.Create([0, 1, 2, 3, 4, 5, 6, 7, 8])
# Attempt nominal partition operation.
partitions = pcoll | 'Part 1' >> beam.Partition(SomePartitionFn(), 4, 1)
assert_that(partitions[0], equal_to([]))
assert_that(partitions[1], equal_to([0, 3, 6]), label='p1')
assert_that(partitions[2], equal_to([1, 4, 7]), label='p2')
assert_that(partitions[3], equal_to([2, 5, 8]), label='p3')
# Check that a bad partition label will yield an error. For the
# DirectRunner, this error manifests as an exception.
with self.assertRaises(ValueError):
> with TestPipeline() as pipeline:
apache_beam/transforms/ptransform_test.py:669:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:620: in __exit__
self.result = self.run()
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:570: in run
self._options).run(False)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTest
github-actions / Test Results
All 2 runs failed: test_do_requires_do_fn_returning_iterable (apache_beam.transforms.ptransform_test.PTransformTest)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:690: in apache_beam.runners.common.SimpleInvoker.invoke_process
windowed_value, self.process_method(windowed_value.value))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:104: in wrapper
return self._check_type(result)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
output = 7
@staticmethod
def _check_type(output):
if output is None:
return output
elif isinstance(output, (dict, bytes, str)):
object_type = type(output).__name__
raise TypeCheckError(
'Returning a %s from a ParDo or FlatMap is '
'discouraged. Please use list("%s") if you really '
'want this behavior.' % (object_type, output))
elif not isinstance(output, abc.Iterable):
> raise TypeCheckError(
'FlatMap and ParDo must return an '
'iterable. %s was returned instead.' % type(output))
E apache_beam.typehints.decorators.TypeCheckError: FlatMap and ParDo must return an iterable. <class 'int'> was returned instead.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:118: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTest testMethod=test_do_requires_do_fn_returning_iterable>
def test_do_requires_do_fn_returning_iterable(self):
# This function is incorrect because it returns an object that isn't an
# iterable.
def incorrect_par_do_fn(x):
return x + 5
with self.assertRaises(typehints.TypeCheckError) as cm:
> with TestPipeline() as pipeline:
apache_beam/transforms/ptransform_test.py:297:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:620: in __exit__
self.result = self.run()
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTest
github-actions / Test Results
All 2 runs failed: test_do_with_do_fn_returning_dict_raises_warning (apache_beam.transforms.ptransform_test.PTransformTest)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:690: in apache_beam.runners.common.SimpleInvoker.invoke_process
windowed_value, self.process_method(windowed_value.value))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:104: in wrapper
return self._check_type(result)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
output = {'2': '1'}
@staticmethod
def _check_type(output):
if output is None:
return output
elif isinstance(output, (dict, bytes, str)):
object_type = type(output).__name__
> raise TypeCheckError(
'Returning a %s from a ParDo or FlatMap is '
'discouraged. Please use list("%s") if you really '
E apache_beam.typehints.decorators.TypeCheckError: Returning a dict from a ParDo or FlatMap is discouraged. Please use list("{'2': '1'}") if you really want this behavior.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:113: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTest testMethod=test_do_with_do_fn_returning_dict_raises_warning>
def test_do_with_do_fn_returning_dict_raises_warning(self):
with self.assertRaises(typehints.TypeCheckError) as cm:
> with TestPipeline() as pipeline:
apache_beam/transforms/ptransform_test.py:174:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:620: in __exit__
self.result = self.run()
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTest
github-actions / Test Results
All 2 runs failed: test_do_with_do_fn_returning_string_raises_warning (apache_beam.transforms.ptransform_test.PTransformTest)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:690: in apache_beam.runners.common.SimpleInvoker.invoke_process
windowed_value, self.process_method(windowed_value.value))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:104: in wrapper
return self._check_type(result)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
output = '21'
@staticmethod
def _check_type(output):
if output is None:
return output
elif isinstance(output, (dict, bytes, str)):
object_type = type(output).__name__
> raise TypeCheckError(
'Returning a %s from a ParDo or FlatMap is '
'discouraged. Please use list("%s") if you really '
E apache_beam.typehints.decorators.TypeCheckError: Returning a str from a ParDo or FlatMap is discouraged. Please use list("21") if you really want this behavior.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:113: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTest testMethod=test_do_with_do_fn_returning_string_raises_warning>
def test_do_with_do_fn_returning_string_raises_warning(self):
with self.assertRaises(typehints.TypeCheckError) as cm:
> with TestPipeline() as pipeline:
apache_beam/transforms/ptransform_test.py:159:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:620: in __exit__
self.result = self.run()
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase
github-actions / Test Results
All 2 runs failed: test_combine_runtime_type_check_violation_using_methods (apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = <class 'str'>, instance = 0, var_name = 'v', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
> check_constraint(type_constraint, instance)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:887:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'str'>, object_instance = 0
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
raise RuntimeError("bad type: %s" % (type_constraint, ))
elif not isinstance(object_instance, type_constraint):
> raise SimpleTypeHintError
E apache_beam.typehints.typehints.SimpleTypeHintError
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError
During handling of the above exception, another exception occurred:
self = <apache_beam.typehints.typecheck.OutputCheckWrapperDoFn object at 0x7da321794350>
method = <bound method TypeCheckWrapperDoFn.process of <apache_beam.typehints.typecheck.TypeCheckWrapperDoFn object at 0x7da3200af310>>
args = (0,), kwargs = {}
def wrapper(self, method, args, kwargs):
try:
> result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:150: in process
_check_instance_type(hint, actual_inputs[var], var, True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'str'>, instance = 0, var_name = 'v', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
> raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
E apache_beam.typehints.decorators.TypeCheckError: Type-hint for argument: 'v' violated. Expected an instance of <class 'str'>, instead found 0, an instance of <class 'int'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:893: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:690: in apache_beam.runners.common.SimpleInvoker.invoke_process
windowed_value, self.process_method(windowed_value.value))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:102: in wrapper
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95: in wrapper
result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:150: in process
_check_instance_type(hint, actual_inputs[var], var, True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'str'>, instance = 0, var_name = 'v', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
> raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
E apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within ParDo(SortJoin/KeyWithVoid): Type-hint for argument: 'v' violated. Expected an instance of <class 'str'>, instead found 0, an instance of <class 'int'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:893: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase testMethod=test_combine_runtime_type_check_violation_using_methods>
def test_combine_runtime_type_check_violation_using_methods(self):
self.p._options.view_as(TypeOptions).pipeline_type_check = False
self.p._options.view_as(TypeOptions).runtime_type_check = True
with self.assertRaises(typehints.TypeCheckError) as e:
(
self.p
| beam.Create([0]).with_output_types(int)
| (
'SortJoin' >> beam.CombineGlobally(lambda s: ''.join(sorted(s))).
with_input_types(str).with_output_types(str)))
> self.p.run()
apache_beam/transforms/ptransform_test.py:2056:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase
github-actions / Test Results
All 2 runs failed: test_mean_globally_runtime_checking_violated (apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>]
instance = 't', var_name = 'element', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
> check_constraint(type_constraint, instance)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:887:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:429: in check_constraint
type_constraint.type_check(object_instance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>]
instance = 't'
def type_check(self, instance):
error_msg = ''
for t in self.union_types:
try:
check_constraint(t, instance)
return
except TypeError as e:
error_msg = str(e)
continue
> raise CompositeTypeHintError(
'%s type-constraint violated. Expected an instance of one of: %s, '
'received %s instead.%s' % (
repr(self),
tuple(sorted(repr(t) for t in self.union_types)),
instance.__class__.__name__,
error_msg))
E apache_beam.typehints.typehints.CompositeTypeHintError: Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>] type-constraint violated. Expected an instance of one of: ("<class 'float'>", "<class 'int'>", "<class 'numpy.float64'>", "<class 'numpy.int64'>"), received str instead.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:554: CompositeTypeHintError
During handling of the above exception, another exception occurred:
self = <apache_beam.typehints.typecheck.TypeCheckCombineFn object at 0x7e3ce81a9610>
accumulator = (0, 0), element = 't', args = (), kwargs = {}
error_msg = 'Runtime type violation detected within Mean/CombineGlobally(MeanCombineFn)/CombinePerKey: Type-hint for argument: \'e..."<class \'float\'>", "<class \'int\'>", "<class \'numpy.float64\'>", "<class \'numpy.int64\'>"), received str instead.'
_ = TypeCheckError('Type-hint for argument: \'element\' violated: Union[<class \'float\'>, <class \'int\'>, <class \'numpy...<class \'float\'>", "<class \'int\'>", "<class \'numpy.float64\'>", "<class \'numpy.int64\'>"), received str instead.')
tb = <traceback object at 0x7e3ce819a040>
def add_input(self, accumulator, element, *args, **kwargs):
if self._input_type_hint:
try:
> _check_instance_type(
self._input_type_hint[0][0].tuple_types[1],
element,
'element',
True)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>]
instance = 't', var_name = 'element', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
except CompositeTypeHintError as e:
> raise TypeCheckError('Type-hint for %s violated: %s' % (hint_type, e))
E apache_beam.typehints.decorators.TypeCheckError: Type-hint for argument: 'element' violated: Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>] type-constraint violated. Expected an instance of one of: ("<class 'float'>", "<class 'int'>", "<class 'numpy.float64'>", "<class 'numpy.int64'>"), received str instead.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:898: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:1278: in apache_beam.runners.worker.operations.PGBKCVOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:1307: in apache_beam.runners.worker.operations.PGBKCVOperation.process
entry[0] = self.combine_fn_add_input(entry[0], value)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:242: in add_input
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:232: in add_input
_check_instance_type(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>]
instance = 't', var_name = 'element', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
except CompositeTypeHintError as e:
> raise TypeCheckError('Type-hint for %s violated: %s' % (hint_type, e))
E apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within Mean/CombineGlobally(MeanCombineFn)/CombinePerKey: Type-hint for argument: 'element' violated: Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>] type-constraint violated. Expected an instance of one of: ("<class 'float'>", "<class 'int'>", "<class 'numpy.float64'>", "<class 'numpy.int64'>"), received str instead.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:898: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase testMethod=test_mean_globally_runtime_checking_violated>
def test_mean_globally_runtime_checking_violated(self):
self.p._options.view_as(TypeOptions).pipeline_type_check = False
self.p._options.view_as(TypeOptions).runtime_type_check = True
with self.assertRaises(typehints.TypeCheckError) as e:
(
self.p
| 'C' >> beam.Create(['t', 'e', 's', 't']).with_output_types(str)
| 'Mean' >> combine.Mean.Globally())
> self.p.run()
apache_beam/transforms/ptransform_test.py:2125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase
github-actions / Test Results
All 2 runs failed: test_mean_per_key_runtime_checking_violated (apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>]
instance = 'False', var_name = 'element', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
> check_constraint(type_constraint, instance)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:887:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:429: in check_constraint
type_constraint.type_check(object_instance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>]
instance = 'False'
def type_check(self, instance):
error_msg = ''
for t in self.union_types:
try:
check_constraint(t, instance)
return
except TypeError as e:
error_msg = str(e)
continue
> raise CompositeTypeHintError(
'%s type-constraint violated. Expected an instance of one of: %s, '
'received %s instead.%s' % (
repr(self),
tuple(sorted(repr(t) for t in self.union_types)),
instance.__class__.__name__,
error_msg))
E apache_beam.typehints.typehints.CompositeTypeHintError: Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>] type-constraint violated. Expected an instance of one of: ("<class 'float'>", "<class 'int'>", "<class 'numpy.float64'>", "<class 'numpy.int64'>"), received str instead.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:554: CompositeTypeHintError
During handling of the above exception, another exception occurred:
self = <apache_beam.typehints.typecheck.TypeCheckCombineFn object at 0x7e3ce8311310>
accumulator = (0, 0), element = 'False', args = (), kwargs = {}
error_msg = 'Runtime type violation detected within OddMean/CombinePerKey(MeanCombineFn): Type-hint for argument: \'element\' viol..."<class \'float\'>", "<class \'int\'>", "<class \'numpy.float64\'>", "<class \'numpy.int64\'>"), received str instead.'
_ = TypeCheckError('Type-hint for argument: \'element\' violated: Union[<class \'float\'>, <class \'int\'>, <class \'numpy...<class \'float\'>", "<class \'int\'>", "<class \'numpy.float64\'>", "<class \'numpy.int64\'>"), received str instead.')
tb = <traceback object at 0x7e3ce808d640>
def add_input(self, accumulator, element, *args, **kwargs):
if self._input_type_hint:
try:
> _check_instance_type(
self._input_type_hint[0][0].tuple_types[1],
element,
'element',
True)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>]
instance = 'False', var_name = 'element', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
except CompositeTypeHintError as e:
> raise TypeCheckError('Type-hint for %s violated: %s' % (hint_type, e))
E apache_beam.typehints.decorators.TypeCheckError: Type-hint for argument: 'element' violated: Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>] type-constraint violated. Expected an instance of one of: ("<class 'float'>", "<class 'int'>", "<class 'numpy.float64'>", "<class 'numpy.int64'>"), received str instead.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:898: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:1278: in apache_beam.runners.worker.operations.PGBKCVOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:1307: in apache_beam.runners.worker.operations.PGBKCVOperation.process
entry[0] = self.combine_fn_add_input(entry[0], value)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:242: in add_input
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:232: in add_input
_check_instance_type(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>]
instance = 'False', var_name = 'element', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
except CompositeTypeHintError as e:
> raise TypeCheckError('Type-hint for %s violated: %s' % (hint_type, e))
E apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within OddMean/CombinePerKey(MeanCombineFn): Type-hint for argument: 'element' violated: Union[<class 'float'>, <class 'int'>, <class 'numpy.float64'>, <class 'numpy.int64'>] type-constraint violated. Expected an instance of one of: ("<class 'float'>", "<class 'int'>", "<class 'numpy.float64'>", "<class 'numpy.int64'>"), received str instead.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:898: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase testMethod=test_mean_per_key_runtime_checking_violated>
def test_mean_per_key_runtime_checking_violated(self):
self.p._options.view_as(TypeOptions).pipeline_type_check = False
self.p._options.view_as(TypeOptions).runtime_type_check = True
with self.assertRaises(typehints.TypeCheckError) as e:
(
self.p
| beam.Create(range(5)).with_output_types(int)
| (
'OddGroup' >> beam.Map(lambda x:
(x, str(bool(x % 2)))).with_output_types(
typing.Tuple[int, str]))
| 'OddMean' >> combine.Mean.PerKey())
> self.p.run()
apache_beam/transforms/ptransform_test.py:2198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTest
github-actions / Test Results
All 2 runs failed: test_group_by_key_non_deterministic_coder (apache_beam.transforms.ptransform_test.PTransformTest)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
AssertionError: "deterministic" does not match "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:262: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.update_counters_start(windowed_value)
apache_beam/runners/worker/operations.py:205: in apache_beam.runners.worker.operations.ConsumerSet.update_counters_start
self.opcounter.update_from(windowed_value)
apache_beam/runners/worker/opcounters.py:210: in apache_beam.runners.worker.opcounters.OperationCounters.update_from
self.do_sample(windowed_value)
apache_beam/runners/worker/opcounters.py:262: in apache_beam.runners.worker.opcounters.OperationCounters.do_sample
self.coder_impl.get_estimated_size_and_observables(windowed_value)) # type: ignore[union-attr]
apache_beam/coders/coder_impl.py:1493: in apache_beam.coders.coder_impl.WindowedValueCoderImpl.get_estimated_size_and_observables
def get_estimated_size_and_observables(self, value, nested=False):
apache_beam/coders/coder_impl.py:1504: in apache_beam.coders.coder_impl.WindowedValueCoderImpl.get_estimated_size_and_observables
self._value_coder.get_estimated_size_and_observables(
apache_beam/coders/coder_impl.py:1053: in apache_beam.coders.coder_impl.AbstractComponentCoderImpl.get_estimated_size_and_observables
c.get_estimated_size_and_observables(
apache_beam/coders/coder_impl.py:207: in apache_beam.coders.coder_impl.CoderImpl.get_estimated_size_and_observables
return self.estimate_size(value, nested), []
apache_beam/coders/coder_impl.py:1582: in apache_beam.coders.coder_impl.LengthPrefixCoderImpl.estimate_size
value_size = self._value_coder.estimate_size(value)
apache_beam/coders/coder_impl.py:246: in apache_beam.coders.coder_impl.StreamCoderImpl.estimate_size
self.encode_to_stream(value, out, nested)
apache_beam/coders/coder_impl.py:457: in apache_beam.coders.coder_impl.FastPrimitivesCoderImpl.encode_to_stream
self.encode_special_deterministic(value, stream)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> raise TypeError(
"Unable to deterministically encode '%s' of type '%s', "
"for the input of '%s'. The object defines __getstate__ but not "
"__setstate__." %
(value, type(value), self.requires_deterministic_step_label))
E TypeError: Unable to deterministically encode '<apache_beam.transforms.ptransform_test.PickledObject object at 0x7e8cce730890>' of type '<class 'apache_beam.transforms.ptransform_test.PickledObject'>', for the input of 'GroupByKey'. The object defines __getstate__ but not __setstate__.
apache_beam/coders/coder_impl.py:505: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "apache_beam/runners/common.py", line 1501, in apache_beam.runners.common.DoFnRunner.process
return self.do_fn_invoker.invoke_process(windowed_value)
File "apache_beam/runners/common.py", line 689, in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
File "apache_beam/runners/common.py", line 1687, in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
File "apache_beam/runners/common.py", line 1800, in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
File "apache_beam/runners/worker/operations.py", line 262, in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.update_counters_start(windowed_value)
File "apache_beam/runners/worker/operations.py", line 205, in apache_beam.runners.worker.operations.ConsumerSet.update_counters_start
self.opcounter.update_from(windowed_value)
File "apache_beam/runners/worker/opcounters.py", line 210, in apache_beam.runners.worker.opcounters.OperationCounters.update_from
self.do_sample(windowed_value)
File "apache_beam/runners/worker/opcounters.py", line 262, in apache_beam.runners.worker.opcounters.OperationCounters.do_sample
self.coder_impl.get_estimated_size_and_observables(windowed_value)) # type: ignore[union-attr]
File "apache_beam/coders/coder_impl.py", line 1493, in apache_beam.coders.coder_impl.WindowedValueCoderImpl.get_estimated_size_and_observables
def get_estimated_size_and_observables(self, value, nested=False):
File "apache_beam/coders/coder_impl.py", line 1504, in apache_beam.coders.coder_impl.WindowedValueCoderImpl.get_estimated_size_and_observables
self._value_coder.get_estimated_size_and_observables(
File "apache_beam/coders/coder_impl.py", line 1053, in apache_beam.coders.coder_impl.AbstractComponentCoderImpl.get_estimated_size_and_observables
c.get_estimated_size_and_observables(
File "apache_beam/coders/coder_impl.py", line 207, in apache_beam.coders.coder_impl.CoderImpl.get_estimated_size_and_observables
return self.estimate_size(value, nested), []
File "apache_beam/coders/coder_impl.py", line 1582, in apache_beam.coders.coder_impl.LengthPrefixCoderImpl.estimate_size
value_size = self._value_coder.estimate_size(value)
File "apache_beam/coders/coder_impl.py", line 246, in apache_beam.coders.coder_impl.StreamCoderImpl.estimate_size
self.encode_to_stream(value, out, nested)
File "apache_beam/coders/coder_impl.py", line 457, in apache_beam.coders.coder_impl.FastPrimitivesCoderImpl.encode_to_stream
self.encode_special_deterministic(value, stream)
File "apache_beam/coders/coder_impl.py", line 505, in apache_beam.coders.coder_impl.FastPrimitivesCoderImpl.encode_special_deterministic
raise TypeError(
TypeError: Unable to deterministically encode '<apache_beam.transforms.ptransform_test.PickledObject object at 0x7e8cce730890>' of type '<class 'apache_beam.transforms.ptransform_test.PickledObject'>', for the input of 'GroupByKey'. The object defines __getstate__ but not __setstate__.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "apache_beam/runners/common.py", line 1501, in apache_beam.runners.common.DoFnRunner.process
return self.do_fn_invoker.invoke_process(windowed_value)
File "apache_beam/runners/common.py", line 689, in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
File "apache_beam/runners/common.py", line 1687, in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
File "apache_beam/runners/common.py", line 1800, in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
File "apache_beam/runners/worker/operations.py", line 263, in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
File "apache_beam/runners/worker/operations.py", line 950, in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
File "apache_beam/runners/worker/operations.py", line 951, in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
File "apache_beam/runners/common.py", line 1503, in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
File "apache_beam/runners/common.py", line 1611, in apache_beam.runners.common.DoFnRunner._reraise_augmented
self._maybe_sample_exception(exc_info, windowed_value)
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
During handling of the above exception, another exception occurred:
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTest testMethod=test_group_by_key_non_deterministic_coder>
def test_group_by_key_non_deterministic_coder(self):
> with self.assertRaisesRegex(Exception, r'deterministic'):
E AssertionError: "deterministic" does not match "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
apache_beam/transforms/ptransform_test.py:616: AssertionError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase
github-actions / Test Results
All 2 runs failed: test_pipeline_checking_satisfied_but_run_time_types_violate (apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
self = Tuple[<class 'bool'>, <class 'int'>], tuple_instance = (0, 0)
def type_check(self, tuple_instance):
if not isinstance(tuple_instance, tuple):
raise CompositeTypeHintError(
"Tuple type constraint violated. Valid object instance must be of "
"type 'tuple'. Instead, an instance of '%s' was received." %
tuple_instance.__class__.__name__)
if len(tuple_instance) != len(self.tuple_types):
raise CompositeTypeHintError(
'Passed object instance is of the proper type, but differs in '
'length from the hinted type. Expected a tuple of length %s, '
'received a tuple of length %s.' %
(len(self.tuple_types), len(tuple_instance)))
for type_pos, (expected, actual) in enumerate(zip(self.tuple_types,
tuple_instance)):
try:
> check_constraint(expected, actual)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:732:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'bool'>, object_instance = 0
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
raise RuntimeError("bad type: %s" % (type_constraint, ))
elif not isinstance(object_instance, type_constraint):
> raise SimpleTypeHintError
E apache_beam.typehints.typehints.SimpleTypeHintError
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError
During handling of the above exception, another exception occurred:
type_constraint = Tuple[<class 'bool'>, <class 'int'>], datum = (0, 0)
is_input = False
@staticmethod
def type_check(type_constraint, datum, is_input):
"""Typecheck a PTransform related datum according to a type constraint.
This function is used to optionally type-check either an input or an output
to a PTransform.
Args:
type_constraint: An instance of a typehints.TypeContraint, one of the
white-listed builtin Python types, or a custom user class.
datum: An instance of a Python object.
is_input: True if 'datum' is an input to a PTransform's DoFn. False
otherwise.
Raises:
TypeError: If 'datum' fails to type-check according to 'type_constraint'.
"""
datum_type = 'input' if is_input else 'output'
try:
> check_constraint(type_constraint, datum)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:429: in check_constraint
type_constraint.type_check(object_instance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Tuple[<class 'bool'>, <class 'int'>], tuple_instance = (0, 0)
def type_check(self, tuple_instance):
if not isinstance(tuple_instance, tuple):
raise CompositeTypeHintError(
"Tuple type constraint violated. Valid object instance must be of "
"type 'tuple'. Instead, an instance of '%s' was received." %
tuple_instance.__class__.__name__)
if len(tuple_instance) != len(self.tuple_types):
raise CompositeTypeHintError(
'Passed object instance is of the proper type, but differs in '
'length from the hinted type. Expected a tuple of length %s, '
'received a tuple of length %s.' %
(len(self.tuple_types), len(tuple_instance)))
for type_pos, (expected, actual) in enumerate(zip(self.tuple_types,
tuple_instance)):
try:
check_constraint(expected, actual)
continue
except SimpleTypeHintError:
> raise CompositeTypeHintError(
'%s hint type-constraint violated. The type of element #%s in '
'the passed tuple is incorrect. Expected an instance of '
'type %s, instead received an instance of type %s.' %
(repr(self), type_pos, repr(expected), actual.__class__.__name__))
E apache_beam.typehints.typehints.CompositeTypeHintError: Tuple[<class 'bool'>, <class 'int'>] hint type-constraint violated. The type of element #0 in the passed tuple is incorrect. Expected an instance of type <class 'bool'>, instead received an instance of type int.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:735: CompositeTypeHintError
During handling of the above exception, another exception occurred:
self = <apache_beam.typehints.typecheck.OutputCheckWrapperDoFn object at 0x7e3ce813ba10>
method = <bound method TypeCheckWrapperDoFn.process of <apache_beam.typehints.typecheck.TypeCheckWrapperDoFn object at 0x7e3ce8101390>>
args = (0,), kwargs = {}
def wrapper(self, method, args, kwargs):
try:
> result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:151: in process
return self._type_check_result(self.dofn.process(*args, **kwargs))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:178: in _type_check_result
type_check_output(o)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:170: in type_check_output
self.type_check(self._output_type_hint, x, is_input=False)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:204: in type_check
raise TypeCheckError(e.args[0]).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201: in type_check
check_constraint(type_constraint, datum)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:429: in check_constraint
type_constraint.type_check(object_instance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Tuple[<class 'bool'>, <class 'int'>], tuple_instance = (0, 0)
def type_check(self, tuple_instance):
if not isinstance(tuple_instance, tuple):
raise CompositeTypeHintError(
"Tuple type constraint violated. Valid object instance must be of "
"type 'tuple'. Instead, an instance of '%s' was received." %
tuple_instance.__class__.__name__)
if len(tuple_instance) != len(self.tuple_types):
raise CompositeTypeHintError(
'Passed object instance is of the proper type, but differs in '
'length from the hinted type. Expected a tuple of length %s, '
'received a tuple of length %s.' %
(len(self.tuple_types), len(tuple_instance)))
for type_pos, (expected, actual) in enumerate(zip(self.tuple_types,
tuple_instance)):
try:
check_constraint(expected, actual)
continue
except SimpleTypeHintError:
> raise CompositeTypeHintError(
'%s hint type-constraint violated. The type of element #%s in '
'the passed tuple is incorrect. Expected an instance of '
'type %s, instead received an instance of type %s.' %
(repr(self), type_pos, repr(expected), actual.__class__.__name__))
E apache_beam.typehints.decorators.TypeCheckError: Tuple[<class 'bool'>, <class 'int'>] hint type-constraint violated. The type of element #0 in the passed tuple is incorrect. Expected an instance of type <class 'bool'>, instead received an instance of type int.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:735: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:690: in apache_beam.runners.common.SimpleInvoker.invoke_process
windowed_value, self.process_method(windowed_value.value))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:102: in wrapper
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95: in wrapper
result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:151: in process
return self._type_check_result(self.dofn.process(*args, **kwargs))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:178: in _type_check_result
type_check_output(o)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:170: in type_check_output
self.type_check(self._output_type_hint, x, is_input=False)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:204: in type_check
raise TypeCheckError(e.args[0]).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201: in type_check
check_constraint(type_constraint, datum)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:429: in check_constraint
type_constraint.type_check(object_instance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Tuple[<class 'bool'>, <class 'int'>], tuple_instance = (0, 0)
def type_check(self, tuple_instance):
if not isinstance(tuple_instance, tuple):
raise CompositeTypeHintError(
"Tuple type constraint violated. Valid object instance must be of "
"type 'tuple'. Instead, an instance of '%s' was received." %
tuple_instance.__class__.__name__)
if len(tuple_instance) != len(self.tuple_types):
raise CompositeTypeHintError(
'Passed object instance is of the proper type, but differs in '
'length from the hinted type. Expected a tuple of length %s, '
'received a tuple of length %s.' %
(len(self.tuple_types), len(tuple_instance)))
for type_pos, (expected, actual) in enumerate(zip(self.tuple_types,
tuple_instance)):
try:
check_constraint(expected, actual)
continue
except SimpleTypeHintError:
> raise CompositeTypeHintError(
'%s hint type-constraint violated. The type of element #%s in '
'the passed tuple is incorrect. Expected an instance of '
'type %s, instead received an instance of type %s.' %
(repr(self), type_pos, repr(expected), actual.__class__.__name__))
E apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within ParDo(IsEven): Tuple[<class 'bool'>, <class 'int'>] hint type-constraint violated. The type of element #0 in the passed tuple is incorrect. Expected an instance of type <class 'bool'>, instead received an instance of type int.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:735: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase testMethod=test_pipeline_checking_satisfied_but_run_time_types_violate>
def test_pipeline_checking_satisfied_but_run_time_types_violate(self):
self.p._options.view_as(TypeOptions).pipeline_type_check = False
self.p._options.view_as(TypeOptions).runtime_type_check = True
@with_output_types(typing.Tuple[bool, int])
@with_input_types(a=int)
def is_even_as_key(a):
# Simulate a programming error, should be: return (a % 2 == 0, a)
# However this returns Tuple[int, int]
return (a % 2, a)
(
self.p
| 'Nums' >> beam.Create(range(5)).with_output_types(int)
| 'IsEven' >> beam.Map(is_even_as_key)
| 'Parity' >> beam.GroupByKey())
# Although all the types appear to be correct when checked at pipeline
# construction. Runtime type-checking should detect the 'is_even_as_key' is
# returning Tuple[int, int], instead of Tuple[bool, int].
with self.assertRaises(typehints.TypeCheckError) as e:
> self.p.run()
apache_beam/transforms/ptransform_test.py:1705:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase
github-actions / Test Results
All 2 runs failed: test_runtime_type_check_python_type_error (apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
AssertionError: "object of type 'int' has no len() [while running 'Len']" != "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
- object of type 'int' has no len() [while running 'Len']
+ Argument 'exn' has incorrect type (expected BaseException, got tuple)
self = <apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase testMethod=test_runtime_type_check_python_type_error>
def test_runtime_type_check_python_type_error(self):
self.p._options.view_as(TypeOptions).runtime_type_check = True
with self.assertRaises(TypeError) as e:
(
self.p
| beam.Create([1, 2, 3]).with_output_types(int)
| 'Len' >> beam.Map(lambda x: len(x)).with_output_types(int))
self.p.run()
# Our special type-checking related TypeError shouldn't have been raised.
# Instead the above pipeline should have triggered a regular Python runtime
# TypeError.
> self.assertEqual(
"object of type 'int' has no len() [while running 'Len']",
e.exception.args[0])
E AssertionError: "object of type 'int' has no len() [while running 'Len']" != "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
E - object of type 'int' has no len() [while running 'Len']
E + Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/transforms/ptransform_test.py:2538: AssertionError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase
github-actions / Test Results
All 2 runs failed: test_pipeline_runtime_checking_violation_composite_type_input (apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
self = Tuple[<class 'int'>, <class 'int'>], tuple_instance = (1, 3.0)
def type_check(self, tuple_instance):
if not isinstance(tuple_instance, tuple):
raise CompositeTypeHintError(
"Tuple type constraint violated. Valid object instance must be of "
"type 'tuple'. Instead, an instance of '%s' was received." %
tuple_instance.__class__.__name__)
if len(tuple_instance) != len(self.tuple_types):
raise CompositeTypeHintError(
'Passed object instance is of the proper type, but differs in '
'length from the hinted type. Expected a tuple of length %s, '
'received a tuple of length %s.' %
(len(self.tuple_types), len(tuple_instance)))
for type_pos, (expected, actual) in enumerate(zip(self.tuple_types,
tuple_instance)):
try:
> check_constraint(expected, actual)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:732:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'int'>, object_instance = 3.0
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
raise RuntimeError("bad type: %s" % (type_constraint, ))
elif not isinstance(object_instance, type_constraint):
> raise SimpleTypeHintError
E apache_beam.typehints.typehints.SimpleTypeHintError
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError
During handling of the above exception, another exception occurred:
type_constraint = Tuple[<class 'int'>, <class 'int'>], instance = (1, 3.0)
var_name = 'x_y', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
> check_constraint(type_constraint, instance)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:887:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:429: in check_constraint
type_constraint.type_check(object_instance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Tuple[<class 'int'>, <class 'int'>], tuple_instance = (1, 3.0)
def type_check(self, tuple_instance):
if not isinstance(tuple_instance, tuple):
raise CompositeTypeHintError(
"Tuple type constraint violated. Valid object instance must be of "
"type 'tuple'. Instead, an instance of '%s' was received." %
tuple_instance.__class__.__name__)
if len(tuple_instance) != len(self.tuple_types):
raise CompositeTypeHintError(
'Passed object instance is of the proper type, but differs in '
'length from the hinted type. Expected a tuple of length %s, '
'received a tuple of length %s.' %
(len(self.tuple_types), len(tuple_instance)))
for type_pos, (expected, actual) in enumerate(zip(self.tuple_types,
tuple_instance)):
try:
check_constraint(expected, actual)
continue
except SimpleTypeHintError:
> raise CompositeTypeHintError(
'%s hint type-constraint violated. The type of element #%s in '
'the passed tuple is incorrect. Expected an instance of '
'type %s, instead received an instance of type %s.' %
(repr(self), type_pos, repr(expected), actual.__class__.__name__))
E apache_beam.typehints.typehints.CompositeTypeHintError: Tuple[<class 'int'>, <class 'int'>] hint type-constraint violated. The type of element #1 in the passed tuple is incorrect. Expected an instance of type <class 'int'>, instead received an instance of type float.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:735: CompositeTypeHintError
During handling of the above exception, another exception occurred:
self = <apache_beam.typehints.typecheck.OutputCheckWrapperDoFn object at 0x7e3ce84ffc50>
method = <bound method TypeCheckWrapperDoFn.process of <apache_beam.typehints.typecheck.TypeCheckWrapperDoFn object at 0x7e3ce80bccd0>>
args = ((1, 3.0),), kwargs = {}
def wrapper(self, method, args, kwargs):
try:
> result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:150: in process
_check_instance_type(hint, actual_inputs[var], var, True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = Tuple[<class 'int'>, <class 'int'>], instance = (1, 3.0)
var_name = 'x_y', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
except CompositeTypeHintError as e:
> raise TypeCheckError('Type-hint for %s violated: %s' % (hint_type, e))
E apache_beam.typehints.decorators.TypeCheckError: Type-hint for argument: 'x_y' violated: Tuple[<class 'int'>, <class 'int'>] hint type-constraint violated. The type of element #1 in the passed tuple is incorrect. Expected an instance of type <class 'int'>, instead received an instance of type float.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:898: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:690: in apache_beam.runners.common.SimpleInvoker.invoke_process
windowed_value, self.process_method(windowed_value.value))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:102: in wrapper
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95: in wrapper
result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:150: in process
_check_instance_type(hint, actual_inputs[var], var, True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = Tuple[<class 'int'>, <class 'int'>], instance = (1, 3.0)
var_name = 'x_y', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
except CompositeTypeHintError as e:
> raise TypeCheckError('Type-hint for %s violated: %s' % (hint_type, e))
E apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within ParDo(Add): Type-hint for argument: 'x_y' violated: Tuple[<class 'int'>, <class 'int'>] hint type-constraint violated. The type of element #1 in the passed tuple is incorrect. Expected an instance of type <class 'int'>, instead received an instance of type float.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:898: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase testMethod=test_pipeline_runtime_checking_violation_composite_type_input>
def test_pipeline_runtime_checking_violation_composite_type_input(self):
self.p._options.view_as(TypeOptions).runtime_type_check = True
self.p._options.view_as(TypeOptions).pipeline_type_check = False
with self.assertRaises(typehints.TypeCheckError) as e:
(
self.p
| beam.Create([(1, 3.0), (2, 4.9), (3, 9.5)])
| (
'Add' >>
beam.FlatMap(lambda x_y: [x_y[0] + x_y[1]]).with_input_types(
typing.Tuple[int, int]).with_output_types(int)))
> self.p.run()
apache_beam/transforms/ptransform_test.py:1770:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase
github-actions / Test Results
All 2 runs failed: test_pipeline_runtime_checking_violation_composite_type_output (apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = Tuple[<class 'float'>, <class 'int'>], datum = 4.0
is_input = False
@staticmethod
def type_check(type_constraint, datum, is_input):
"""Typecheck a PTransform related datum according to a type constraint.
This function is used to optionally type-check either an input or an output
to a PTransform.
Args:
type_constraint: An instance of a typehints.TypeContraint, one of the
white-listed builtin Python types, or a custom user class.
datum: An instance of a Python object.
is_input: True if 'datum' is an input to a PTransform's DoFn. False
otherwise.
Raises:
TypeError: If 'datum' fails to type-check according to 'type_constraint'.
"""
datum_type = 'input' if is_input else 'output'
try:
> check_constraint(type_constraint, datum)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:429: in check_constraint
type_constraint.type_check(object_instance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Tuple[<class 'float'>, <class 'int'>], tuple_instance = 4.0
def type_check(self, tuple_instance):
if not isinstance(tuple_instance, tuple):
> raise CompositeTypeHintError(
"Tuple type constraint violated. Valid object instance must be of "
"type 'tuple'. Instead, an instance of '%s' was received." %
tuple_instance.__class__.__name__)
E apache_beam.typehints.typehints.CompositeTypeHintError: Tuple type constraint violated. Valid object instance must be of type 'tuple'. Instead, an instance of 'float' was received.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:717: CompositeTypeHintError
During handling of the above exception, another exception occurred:
self = <apache_beam.typehints.typecheck.OutputCheckWrapperDoFn object at 0x7e3ce84890d0>
method = <bound method TypeCheckWrapperDoFn.process of <apache_beam.typehints.typecheck.TypeCheckWrapperDoFn object at 0x7e3ce8488390>>
args = ((1, 3.0),), kwargs = {}
def wrapper(self, method, args, kwargs):
try:
> result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:151: in process
return self._type_check_result(self.dofn.process(*args, **kwargs))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:178: in _type_check_result
type_check_output(o)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:170: in type_check_output
self.type_check(self._output_type_hint, x, is_input=False)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:204: in type_check
raise TypeCheckError(e.args[0]).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201: in type_check
check_constraint(type_constraint, datum)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:429: in check_constraint
type_constraint.type_check(object_instance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Tuple[<class 'float'>, <class 'int'>], tuple_instance = 4.0
def type_check(self, tuple_instance):
if not isinstance(tuple_instance, tuple):
> raise CompositeTypeHintError(
"Tuple type constraint violated. Valid object instance must be of "
"type 'tuple'. Instead, an instance of '%s' was received." %
tuple_instance.__class__.__name__)
E apache_beam.typehints.decorators.TypeCheckError: Tuple type constraint violated. Valid object instance must be of type 'tuple'. Instead, an instance of 'float' was received.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:717: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:690: in apache_beam.runners.common.SimpleInvoker.invoke_process
windowed_value, self.process_method(windowed_value.value))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:102: in wrapper
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95: in wrapper
result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:151: in process
return self._type_check_result(self.dofn.process(*args, **kwargs))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:178: in _type_check_result
type_check_output(o)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:170: in type_check_output
self.type_check(self._output_type_hint, x, is_input=False)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:204: in type_check
raise TypeCheckError(e.args[0]).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201: in type_check
check_constraint(type_constraint, datum)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:429: in check_constraint
type_constraint.type_check(object_instance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Tuple[<class 'float'>, <class 'int'>], tuple_instance = 4.0
def type_check(self, tuple_instance):
if not isinstance(tuple_instance, tuple):
> raise CompositeTypeHintError(
"Tuple type constraint violated. Valid object instance must be of "
"type 'tuple'. Instead, an instance of '%s' was received." %
tuple_instance.__class__.__name__)
E apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within ParDo(Swap): Tuple type constraint violated. Valid object instance must be of type 'tuple'. Instead, an instance of 'float' was received.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:717: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase testMethod=test_pipeline_runtime_checking_violation_composite_type_output>
def test_pipeline_runtime_checking_violation_composite_type_output(self):
self.p._options.view_as(TypeOptions).runtime_type_check = True
self.p._options.view_as(TypeOptions).pipeline_type_check = False
# The type-hinted applied via the 'returns()' method indicates the ParDo
# should return an instance of type: Tuple[float, int]. However, an instance
# of 'int' will be generated instead.
with self.assertRaises(typehints.TypeCheckError) as e:
(
self.p
| beam.Create([(1, 3.0), (2, 4.9), (3, 9.5)])
| (
'Swap' >>
beam.FlatMap(lambda x_y1: [x_y1[0] + x_y1[1]]).with_input_types(
typing.Tuple[int, float]).with_output_types(
typing.Tuple[float, int])))
> self.p.run()
apache_beam/transforms/ptransform_test.py:1835:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase
github-actions / Test Results
All 2 runs failed: test_pipeline_runtime_checking_violation_simple_type_input (apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = <class 'str'>, instance = 1, var_name = 'x', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
> check_constraint(type_constraint, instance)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:887:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'str'>, object_instance = 1
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
raise RuntimeError("bad type: %s" % (type_constraint, ))
elif not isinstance(object_instance, type_constraint):
> raise SimpleTypeHintError
E apache_beam.typehints.typehints.SimpleTypeHintError
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError
During handling of the above exception, another exception occurred:
self = <apache_beam.typehints.typecheck.OutputCheckWrapperDoFn object at 0x7e3ce82ca0d0>
method = <bound method TypeCheckWrapperDoFn.process of <apache_beam.typehints.typecheck.TypeCheckWrapperDoFn object at 0x7e3ce82cb810>>
args = (1,), kwargs = {}
def wrapper(self, method, args, kwargs):
try:
> result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:150: in process
_check_instance_type(hint, actual_inputs[var], var, True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'str'>, instance = 1, var_name = 'x', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
> raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
E apache_beam.typehints.decorators.TypeCheckError: Type-hint for argument: 'x' violated. Expected an instance of <class 'str'>, instead found 1, an instance of <class 'int'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:893: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:690: in apache_beam.runners.common.SimpleInvoker.invoke_process
windowed_value, self.process_method(windowed_value.value))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:102: in wrapper
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95: in wrapper
result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:150: in process
_check_instance_type(hint, actual_inputs[var], var, True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'str'>, instance = 1, var_name = 'x', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
> raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
E apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within ParDo(ToInt): Type-hint for argument: 'x' violated. Expected an instance of <class 'str'>, instead found 1, an instance of <class 'int'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:893: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase testMethod=test_pipeline_runtime_checking_violation_simple_type_input>
def test_pipeline_runtime_checking_violation_simple_type_input(self):
self.p._options.view_as(TypeOptions).runtime_type_check = True
self.p._options.view_as(TypeOptions).pipeline_type_check = False
# The type-hinted applied via the 'with_input_types()' method indicates the
# ParDo should receive an instance of type 'str', however an 'int' will be
# passed instead.
with self.assertRaises(typehints.TypeCheckError) as e:
(
self.p
| beam.Create([1, 1, 1])
| (
'ToInt' >> beam.FlatMap(lambda x: [int(x)]).with_input_types(
str).with_output_types(int)))
> self.p.run()
apache_beam/transforms/ptransform_test.py:1749:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase
github-actions / Test Results
All 2 runs failed: test_pipeline_runtime_checking_violation_simple_type_output (apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = <class 'int'>, datum = 1.0, is_input = False
@staticmethod
def type_check(type_constraint, datum, is_input):
"""Typecheck a PTransform related datum according to a type constraint.
This function is used to optionally type-check either an input or an output
to a PTransform.
Args:
type_constraint: An instance of a typehints.TypeContraint, one of the
white-listed builtin Python types, or a custom user class.
datum: An instance of a Python object.
is_input: True if 'datum' is an input to a PTransform's DoFn. False
otherwise.
Raises:
TypeError: If 'datum' fails to type-check according to 'type_constraint'.
"""
datum_type = 'input' if is_input else 'output'
try:
> check_constraint(type_constraint, datum)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'int'>, object_instance = 1.0
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
raise RuntimeError("bad type: %s" % (type_constraint, ))
elif not isinstance(object_instance, type_constraint):
> raise SimpleTypeHintError
E apache_beam.typehints.typehints.SimpleTypeHintError
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError
During handling of the above exception, another exception occurred:
self = <apache_beam.typehints.typecheck.OutputCheckWrapperDoFn object at 0x7e3ce813eed0>
method = <bound method TypeCheckWrapperDoFn.process of <apache_beam.typehints.typecheck.TypeCheckWrapperDoFn object at 0x7e3ce8210110>>
args = (1,), kwargs = {}
def wrapper(self, method, args, kwargs):
try:
> result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:151: in process
return self._type_check_result(self.dofn.process(*args, **kwargs))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:178: in _type_check_result
type_check_output(o)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:170: in type_check_output
self.type_check(self._output_type_hint, x, is_input=False)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:211: in type_check
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201: in type_check
check_constraint(type_constraint, datum)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'int'>, object_instance = 1.0
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
raise RuntimeError("bad type: %s" % (type_constraint, ))
elif not isinstance(object_instance, type_constraint):
> raise SimpleTypeHintError
E apache_beam.typehints.decorators.TypeCheckError: According to type-hint expected output should be of type <class 'int'>. Instead, received '1.0', an instance of type <class 'float'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:436: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:690: in apache_beam.runners.common.SimpleInvoker.invoke_process
windowed_value, self.process_method(windowed_value.value))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:102: in wrapper
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95: in wrapper
result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:151: in process
return self._type_check_result(self.dofn.process(*args, **kwargs))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:178: in _type_check_result
type_check_output(o)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:170: in type_check_output
self.type_check(self._output_type_hint, x, is_input=False)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:211: in type_check
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201: in type_check
check_constraint(type_constraint, datum)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'int'>, object_instance = 1.0
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
raise RuntimeError("bad type: %s" % (type_constraint, ))
elif not isinstance(object_instance, type_constraint):
> raise SimpleTypeHintError
E apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within ParDo(ToInt): According to type-hint expected output should be of type <class 'int'>. Instead, received '1.0', an instance of type <class 'float'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:436: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase testMethod=test_pipeline_runtime_checking_violation_simple_type_output>
def test_pipeline_runtime_checking_violation_simple_type_output(self):
self.p._options.view_as(TypeOptions).runtime_type_check = True
self.p._options.view_as(TypeOptions).pipeline_type_check = False
# The type-hinted applied via the 'returns()' method indicates the ParDo
# should output an instance of type 'int', however a 'float' will be
# generated instead.
print(
"HINTS",
(
'ToInt' >> beam.FlatMap(lambda x: [float(x)]).with_input_types(
int).with_output_types(int)).get_type_hints())
with self.assertRaises(typehints.TypeCheckError) as e:
(
self.p
| beam.Create([1, 1, 1])
| (
'ToInt' >> beam.FlatMap(lambda x: [float(x)]).with_input_types(
int).with_output_types(int)))
> self.p.run()
apache_beam/transforms/ptransform_test.py:1800:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase
github-actions / Test Results
All 2 runs failed: test_pipeline_runtime_checking_violation_with_side_inputs_decorator (apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = <class 'int'>, instance = 1.0, var_name = 'b', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
> check_constraint(type_constraint, instance)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:887:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'int'>, object_instance = 1.0
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
raise RuntimeError("bad type: %s" % (type_constraint, ))
elif not isinstance(object_instance, type_constraint):
> raise SimpleTypeHintError
E apache_beam.typehints.typehints.SimpleTypeHintError
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError
During handling of the above exception, another exception occurred:
self = <apache_beam.typehints.typecheck.OutputCheckWrapperDoFn object at 0x7e3ce80eea10>
method = <bound method TypeCheckWrapperDoFn.process of <apache_beam.typehints.typecheck.TypeCheckWrapperDoFn object at 0x7e3ce828d890>>
args = (1, 1.0), kwargs = {}
def wrapper(self, method, args, kwargs):
try:
> result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:150: in process
_check_instance_type(hint, actual_inputs[var], var, True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'int'>, instance = 1.0, var_name = 'b', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
> raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
E apache_beam.typehints.decorators.TypeCheckError: Type-hint for argument: 'b' violated. Expected an instance of <class 'int'>, instead found 1.0, an instance of <class 'float'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:893: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:917: in apache_beam.runners.common.PerWindowInvoker.invoke_process
self._invoke_process_per_window(
apache_beam/runners/common.py:1061: in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window
self.process_method(*args_for_process, **kwargs_for_process),
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:102: in wrapper
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95: in wrapper
result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:150: in process
_check_instance_type(hint, actual_inputs[var], var, True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'int'>, instance = 1.0, var_name = 'b', verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
> raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
E apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within ParDo(Add 1): Type-hint for argument: 'b' violated. Expected an instance of <class 'int'>, instead found 1.0, an instance of <class 'float'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:893: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase testMethod=test_pipeline_runtime_checking_violation_with_side_inputs_decorator>
def test_pipeline_runtime_checking_violation_with_side_inputs_decorator(self):
self.p._options.view_as(TypeOptions).pipeline_type_check = False
self.p._options.view_as(TypeOptions).runtime_type_check = True
@with_output_types(int)
@with_input_types(a=int, b=int)
def add(a, b):
return a + b
with self.assertRaises(typehints.TypeCheckError) as e:
(self.p | beam.Create([1, 2, 3, 4]) | 'Add 1' >> beam.Map(add, 1.0))
> self.p.run()
apache_beam/transforms/ptransform_test.py:1864:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase
github-actions / Test Results
All 2 runs failed: test_pipeline_runtime_checking_violation_with_side_inputs_via_method (apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = <class 'int'>, instance = 1.0, var_name = 'one'
verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
> check_constraint(type_constraint, instance)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:887:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'int'>, object_instance = 1.0
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
raise RuntimeError("bad type: %s" % (type_constraint, ))
elif not isinstance(object_instance, type_constraint):
> raise SimpleTypeHintError
E apache_beam.typehints.typehints.SimpleTypeHintError
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError
During handling of the above exception, another exception occurred:
self = <apache_beam.typehints.typecheck.OutputCheckWrapperDoFn object at 0x7e3ce81ecc10>
method = <bound method TypeCheckWrapperDoFn.process of <apache_beam.typehints.typecheck.TypeCheckWrapperDoFn object at 0x7e3ce8338a10>>
args = (1, 1.0), kwargs = {}
def wrapper(self, method, args, kwargs):
try:
> result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:150: in process
_check_instance_type(hint, actual_inputs[var], var, True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'int'>, instance = 1.0, var_name = 'one'
verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
> raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
E apache_beam.typehints.decorators.TypeCheckError: Type-hint for argument: 'one' violated. Expected an instance of <class 'int'>, instead found 1.0, an instance of <class 'float'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:893: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:917: in apache_beam.runners.common.PerWindowInvoker.invoke_process
self._invoke_process_per_window(
apache_beam/runners/common.py:1061: in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window
self.process_method(*args_for_process, **kwargs_for_process),
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:102: in wrapper
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95: in wrapper
result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:150: in process
_check_instance_type(hint, actual_inputs[var], var, True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'int'>, instance = 1.0, var_name = 'one'
verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
> raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
E apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within ParDo(Add 1): Type-hint for argument: 'one' violated. Expected an instance of <class 'int'>, instead found 1.0, an instance of <class 'float'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:893: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase testMethod=test_pipeline_runtime_checking_violation_with_side_inputs_via_method>
def test_pipeline_runtime_checking_violation_with_side_inputs_via_method(self): # pylint: disable=line-too-long
self.p._options.view_as(TypeOptions).runtime_type_check = True
self.p._options.view_as(TypeOptions).pipeline_type_check = False
with self.assertRaises(typehints.TypeCheckError) as e:
(
self.p
| beam.Create([1, 2, 3, 4])
| (
'Add 1' >> beam.Map(lambda x, one: x + one, 1.0).with_input_types(
int, int).with_output_types(float)))
> self.p.run()
apache_beam/transforms/ptransform_test.py:1884:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase
github-actions / Test Results
All 2 runs failed: test_run_time_type_checking_enabled_type_violation (apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = <class 'int'>, instance = 'some_string', var_name = 'x'
verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
> check_constraint(type_constraint, instance)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:887:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'int'>, object_instance = 'some_string'
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
raise RuntimeError("bad type: %s" % (type_constraint, ))
elif not isinstance(object_instance, type_constraint):
> raise SimpleTypeHintError
E apache_beam.typehints.typehints.SimpleTypeHintError
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError
During handling of the above exception, another exception occurred:
self = <apache_beam.typehints.typecheck.OutputCheckWrapperDoFn object at 0x7e3cea0cdb90>
method = <bound method TypeCheckWrapperDoFn.process of <apache_beam.typehints.typecheck.TypeCheckWrapperDoFn object at 0x7e3cea0cec10>>
args = ('some_string',), kwargs = {}
def wrapper(self, method, args, kwargs):
try:
> result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:150: in process
_check_instance_type(hint, actual_inputs[var], var, True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'int'>, instance = 'some_string', var_name = 'x'
verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
> raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
E apache_beam.typehints.decorators.TypeCheckError: Type-hint for argument: 'x' violated. Expected an instance of <class 'int'>, instead found some_string, an instance of <class 'str'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:893: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:690: in apache_beam.runners.common.SimpleInvoker.invoke_process
windowed_value, self.process_method(windowed_value.value))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:102: in wrapper
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95: in wrapper
result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:150: in process
_check_instance_type(hint, actual_inputs[var], var, True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'int'>, instance = 'some_string', var_name = 'x'
verbose = True
def _check_instance_type(
type_constraint, instance, var_name=None, verbose=False):
"""A helper function to report type-hint constraint violations.
Args:
type_constraint: An instance of a 'TypeConstraint' or a built-in Python
type.
instance: The candidate object which will be checked by to satisfy
'type_constraint'.
var_name: If 'instance' is an argument, then the actual name for the
parameter in the original function definition.
Raises:
TypeCheckError: If 'instance' fails to meet the type-constraint of
'type_constraint'.
"""
hint_type = (
"argument: '%s'" % var_name if var_name is not None else 'return type')
try:
check_constraint(type_constraint, instance)
except SimpleTypeHintError:
if verbose:
verbose_instance = '%s, ' % instance
else:
verbose_instance = ''
> raise TypeCheckError(
'Type-hint for %s violated. Expected an '
'instance of %s, instead found %san instance of %s.' %
(hint_type, type_constraint, verbose_instance, type(instance)))
E apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within ParDo(ToStr): Type-hint for argument: 'x' violated. Expected an instance of <class 'int'>, instead found some_string, an instance of <class 'str'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/decorators.py:893: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase testMethod=test_run_time_type_checking_enabled_type_violation>
def test_run_time_type_checking_enabled_type_violation(self):
self.p._options.view_as(TypeOptions).pipeline_type_check = False
self.p._options.view_as(TypeOptions).runtime_type_check = True
@with_output_types(str)
@with_input_types(x=int)
def int_to_string(x):
return str(x)
# Function above has been type-hinted to only accept an int. But in the
# pipeline execution it'll be passed a string due to the output of Create.
(
self.p
| 'T' >> beam.Create(['some_string'])
| 'ToStr' >> beam.Map(int_to_string))
with self.assertRaises(typehints.TypeCheckError) as e:
> self.p.run()
apache_beam/transforms/ptransform_test.py:1651:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/testing/test_pipeline.py:115: in run
result = super().run(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
github-actions / Test Results
All 2 runs failed: test_opts_with_check_typevar (apache_beam.transforms.timestamped_value_type_test.TypeCheckTimestampedValueTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:690: in apache_beam.runners.common.SimpleInvoker.invoke_process
windowed_value, self.process_method(windowed_value.value))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95: in wrapper
result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:151: in process
return self._type_check_result(self.dofn.process(*args, **kwargs))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:178: in _type_check_result
type_check_output(o)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:165: in type_check_output
self.type_check(beam_type, x, is_input=False)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201: in type_check
check_constraint(type_constraint, datum)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = ~T, object_instance = ['abc', 'cde']
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
> raise RuntimeError("bad type: %s" % (type_constraint, ))
E RuntimeError: bad type: ~T
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:434: RuntimeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.timestamped_value_type_test.TypeCheckTimestampedValueTestCase testMethod=test_opts_with_check_typevar>
def test_opts_with_check_typevar(self):
with self.assertRaises(RuntimeError):
> with beam.Pipeline(options=self.opts) as p:
apache_beam/transforms/timestamped_value_type_test.py:130:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:620: in __exit__
self.result = self.run()
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
github-actions / Test Results
All 2 runs failed: test_opts_with_check_wrong_data (apache_beam.transforms.timestamped_value_type_test.TypeCheckTimestampedValueTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = <class 'str'>, datum = 1234, is_input = False
@staticmethod
def type_check(type_constraint, datum, is_input):
"""Typecheck a PTransform related datum according to a type constraint.
This function is used to optionally type-check either an input or an output
to a PTransform.
Args:
type_constraint: An instance of a typehints.TypeContraint, one of the
white-listed builtin Python types, or a custom user class.
datum: An instance of a Python object.
is_input: True if 'datum' is an input to a PTransform's DoFn. False
otherwise.
Raises:
TypeError: If 'datum' fails to type-check according to 'type_constraint'.
"""
datum_type = 'input' if is_input else 'output'
try:
> check_constraint(type_constraint, datum)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'str'>, object_instance = 1234
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
raise RuntimeError("bad type: %s" % (type_constraint, ))
elif not isinstance(object_instance, type_constraint):
> raise SimpleTypeHintError
E apache_beam.typehints.typehints.SimpleTypeHintError
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError
During handling of the above exception, another exception occurred:
self = <apache_beam.typehints.typecheck.OutputCheckWrapperDoFn object at 0x7da3215fb910>
method = <bound method TypeCheckWrapperDoFn.process of <apache_beam.typehints.typecheck.TypeCheckWrapperDoFn object at 0x7da3215fbd90>>
args = ({'name': 1234, 'season': 1585699200},), kwargs = {}
def wrapper(self, method, args, kwargs):
try:
> result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:151: in process
return self._type_check_result(self.dofn.process(*args, **kwargs))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:178: in _type_check_result
type_check_output(o)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:165: in type_check_output
self.type_check(beam_type, x, is_input=False)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:211: in type_check
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201: in type_check
check_constraint(type_constraint, datum)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'str'>, object_instance = 1234
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
raise RuntimeError("bad type: %s" % (type_constraint, ))
elif not isinstance(object_instance, type_constraint):
> raise SimpleTypeHintError
E apache_beam.typehints.decorators.TypeCheckError: According to type-hint expected output should be of type <class 'str'>. Instead, received '1234', an instance of type <class 'int'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:436: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:690: in apache_beam.runners.common.SimpleInvoker.invoke_process
windowed_value, self.process_method(windowed_value.value))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:102: in wrapper
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95: in wrapper
result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:151: in process
return self._type_check_result(self.dofn.process(*args, **kwargs))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:178: in _type_check_result
type_check_output(o)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:165: in type_check_output
self.type_check(beam_type, x, is_input=False)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:211: in type_check
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201: in type_check
check_constraint(type_constraint, datum)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type_constraint = <class 'str'>, object_instance = 1234
def check_constraint(type_constraint, object_instance):
"""Determine if the passed type instance satisfies the TypeConstraint.
When examining a candidate type for constraint satisfaction in
'type_check', all CompositeTypeHint's eventually call this function. This
function may end up being called recursively if the hinted type of a
CompositeTypeHint is another CompositeTypeHint.
Args:
type_constraint: An instance of a TypeConstraint or a built-in Python type.
object_instance: An object instance.
Raises:
SimpleTypeHintError: If 'type_constraint' is a one of the allowed primitive
Python types and 'object_instance' isn't an instance of this type.
CompositeTypeHintError: If 'type_constraint' is a TypeConstraint object and
'object_instance' does not satisfy its constraint.
"""
if type_constraint is None and object_instance is None:
return
elif isinstance(type_constraint, TypeConstraint):
type_constraint.type_check(object_instance)
elif type_constraint is None:
# TODO(robertwb): Fix uses of None for Any.
pass
elif not isinstance(type_constraint, type):
raise RuntimeError("bad type: %s" % (type_constraint, ))
elif not isinstance(object_instance, type_constraint):
> raise SimpleTypeHintError
E apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within ParDo(With timestamps): According to type-hint expected output should be of type <class 'str'>. Instead, received '1234', an instance of type <class 'int'>.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:436: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.timestamped_value_type_test.TypeCheckTimestampedValueTestCase testMethod=test_opts_with_check_wrong_data>
def test_opts_with_check_wrong_data(self):
with self.assertRaises(TypeCheckError):
> with beam.Pipeline(options=self.opts) as p:
apache_beam/transforms/timestamped_value_type_test.py:104:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:620: in __exit__
self.result = self.run()
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
github-actions / Test Results
All 2 runs failed: test_opts_with_check_wrong_data_list_str (apache_beam.transforms.timestamped_value_type_test.TypeCheckTimestampedValueTestCase)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 0s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = List[<class 'str'>], datum = 1234, is_input = False
@staticmethod
def type_check(type_constraint, datum, is_input):
"""Typecheck a PTransform related datum according to a type constraint.
This function is used to optionally type-check either an input or an output
to a PTransform.
Args:
type_constraint: An instance of a typehints.TypeContraint, one of the
white-listed builtin Python types, or a custom user class.
datum: An instance of a Python object.
is_input: True if 'datum' is an input to a PTransform's DoFn. False
otherwise.
Raises:
TypeError: If 'datum' fails to type-check according to 'type_constraint'.
"""
datum_type = 'input' if is_input else 'output'
try:
> check_constraint(type_constraint, datum)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:429: in check_constraint
type_constraint.type_check(object_instance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = List[<class 'str'>], sequence_instance = 1234
def type_check(self, sequence_instance):
if not isinstance(sequence_instance, self._sequence_type):
> raise CompositeTypeHintError(
"%s type-constraint violated. Valid object instance "
"must be of type '%s'. Instead, an instance of '%s' "
"was received." % (
self._sequence_type.__name__.title(),
self._sequence_type.__name__.lower(),
sequence_instance.__class__.__name__))
E apache_beam.typehints.typehints.CompositeTypeHintError: List type-constraint violated. Valid object instance must be of type 'list'. Instead, an instance of 'int' was received.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:275: CompositeTypeHintError
During handling of the above exception, another exception occurred:
self = <apache_beam.typehints.typecheck.OutputCheckWrapperDoFn object at 0x7da31a3ba0d0>
method = <bound method TypeCheckWrapperDoFn.process of <apache_beam.typehints.typecheck.TypeCheckWrapperDoFn object at 0x7da320136f90>>
args = ({'name': 1234, 'season': 1585699200},), kwargs = {}
def wrapper(self, method, args, kwargs):
try:
> result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:151: in process
return self._type_check_result(self.dofn.process(*args, **kwargs))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:178: in _type_check_result
type_check_output(o)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:165: in type_check_output
self.type_check(beam_type, x, is_input=False)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:204: in type_check
raise TypeCheckError(e.args[0]).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201: in type_check
check_constraint(type_constraint, datum)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:429: in check_constraint
type_constraint.type_check(object_instance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = List[<class 'str'>], sequence_instance = 1234
def type_check(self, sequence_instance):
if not isinstance(sequence_instance, self._sequence_type):
> raise CompositeTypeHintError(
"%s type-constraint violated. Valid object instance "
"must be of type '%s'. Instead, an instance of '%s' "
"was received." % (
self._sequence_type.__name__.title(),
self._sequence_type.__name__.lower(),
sequence_instance.__class__.__name__))
E apache_beam.typehints.decorators.TypeCheckError: List type-constraint violated. Valid object instance must be of type 'list'. Instead, an instance of 'int' was received.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:275: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:690: in apache_beam.runners.common.SimpleInvoker.invoke_process
windowed_value, self.process_method(windowed_value.value))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:78: in process
return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:102: in wrapper
raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:95: in wrapper
result = method(*args, **kwargs)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:151: in process
return self._type_check_result(self.dofn.process(*args, **kwargs))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:178: in _type_check_result
type_check_output(o)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:165: in type_check_output
self.type_check(beam_type, x, is_input=False)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:204: in type_check
raise TypeCheckError(e.args[0]).with_traceback(tb)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typecheck.py:201: in type_check
check_constraint(type_constraint, datum)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:429: in check_constraint
type_constraint.type_check(object_instance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = List[<class 'str'>], sequence_instance = 1234
def type_check(self, sequence_instance):
if not isinstance(sequence_instance, self._sequence_type):
> raise CompositeTypeHintError(
"%s type-constraint violated. Valid object instance "
"must be of type '%s'. Instead, an instance of '%s' "
"was received." % (
self._sequence_type.__name__.title(),
self._sequence_type.__name__.lower(),
sequence_instance.__class__.__name__))
E apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within ParDo(With timestamps): List type-constraint violated. Valid object instance must be of type 'list'. Instead, an instance of 'int' was received.
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/typehints/typehints.py:275: TypeCheckError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.timestamped_value_type_test.TypeCheckTimestampedValueTestCase testMethod=test_opts_with_check_wrong_data_list_str>
def test_opts_with_check_wrong_data_list_str(self):
with self.assertRaises(TypeCheckError):
> with beam.Pipeline(options=self.opts) as p:
apache_beam/transforms/timestamped_value_type_test.py:113:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:620: in __exit__
self.result = self.run()
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/pipeline.py:594: in run
return self.runner.run_pipeline(self, self._options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
return runner.run_pipeline(pipeline, options)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:195: in run_pipeline
self._latest_run_result = self.run_via_runner_api(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:221: in run_via_runner_api
return self.run_stages(stage_context, stages)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
bundle_results = self._execute_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
self._run_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
result, splits = bundle_manager.process_bundle(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1358: in process_bundle
result_future = self._worker_handler.control_conn.push(process_bundle_req)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
response = self.worker.do_instruction(request)
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
return getattr(self, request_type)(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
bundle_processor.process_bundle(instruction_id))
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:1274: in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/runners/worker/bundle_processor.py:237: in process_encoded
self.output(decoded_value)
apache_beam/runners/worker/operations.py:567: in apache_beam.runners.worker.operations.Operation.output
def output(self, windowed_value, output_index=0):
apache_beam/runners/worker/operations.py:569: in apache_beam.runners.worker.operations.Operation.output
_cast_to_receiver(self.receivers[output_index]).receive(windowed_value)
apache_beam/runners/worker/operations.py:260: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
def receive(self, windowed_value):
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
Check warning on line 0 in apache_beam.transforms.ptransform_test.DeadLettersTest_1
github-actions / Test Results
All 2 runs failed: test_threshold (apache_beam.transforms.ptransform_test.DeadLettersTest_1)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 8s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 8s]
Raw output
AssertionError: "2 / 8 = 0.25 > 0.1" does not match "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:917: in apache_beam.runners.common.PerWindowInvoker.invoke_process
self._invoke_process_per_window(
apache_beam/runners/common.py:1061: in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window
self.process_method(*args_for_process, **kwargs_for_process),
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/transforms/core.py:2084: in <lambda>
wrapper = lambda x, *args, **kwargs: [fn(x, *args, **kwargs)]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
bad = 2, total = 8, threshold = 0.1, window = GlobalWindow
def check_threshold(bad, total, threshold, window=DoFn.WindowParam):
if bad > total * threshold:
> raise ValueError(
'The number of failing elements within the window %r '
'exceeded threshold: %s / %s = %s > %s' %
(window, bad, total, bad / total, threshold))
E ValueError: The number of failing elements within the window GlobalWindow exceeded threshold: 2 / 8 = 0.25 > 0.1
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/transforms/core.py:2339: ValueError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "apache_beam/runners/common.py", line 1501, in apache_beam.runners.common.DoFnRunner.process
return self.do_fn_invoker.invoke_process(windowed_value)
File "apache_beam/runners/common.py", line 917, in apache_beam.runners.common.PerWindowInvoker.invoke_process
self._invoke_process_per_window(
File "apache_beam/runners/common.py", line 1061, in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window
self.process_method(*args_for_process, **kwargs_for_process),
File "/runner/_work/beam/beam/sdks/python/test-suites/tox/py311/build/srcs/sdks/python/target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/transforms/core.py", line 2084, in <lambda>
wrapper = lambda x, *args, **kwargs: [fn(x, *args, **kwargs)]
^^^^^^^^^^^^^^^^^^^^^^
File "/runner/_work/beam/beam/sdks/python/test-suites/tox/py311/build/srcs/sdks/python/target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/transforms/core.py", line 2339, in check_threshold
raise ValueError(
ValueError: The number of failing elements within the window GlobalWindow exceeded threshold: 2 / 8 = 0.25 > 0.1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "apache_beam/runners/common.py", line 1501, in apache_beam.runners.common.DoFnRunner.process
return self.do_fn_invoker.invoke_process(windowed_value)
File "apache_beam/runners/common.py", line 689, in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
File "apache_beam/runners/common.py", line 1687, in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
File "apache_beam/runners/common.py", line 1800, in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
File "apache_beam/runners/worker/operations.py", line 263, in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
File "apache_beam/runners/worker/operations.py", line 950, in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
File "apache_beam/runners/worker/operations.py", line 951, in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
File "apache_beam/runners/common.py", line 1503, in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
File "apache_beam/runners/common.py", line 1611, in apache_beam.runners.common.DoFnRunner._reraise_augmented
self._maybe_sample_exception(exc_info, windowed_value)
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
During handling of the above exception, another exception occurred:
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.DeadLettersTest_1 testMethod=test_threshold>
def test_threshold(self):
# The threshold is high enough.
with TestPipeline() as p:
_ = (
p
| beam.Create([-1, -2, 0, 1, 2, 3, 4, 5])
| beam.Map(self.die_if_negative).with_exception_handling(
threshold=0.5, use_subprocess=self.use_subprocess))
# The threshold is too low enough.
> with self.assertRaisesRegex(Exception, "2 / 8 = 0.25 > 0.1"):
E AssertionError: "2 / 8 = 0.25 > 0.1" does not match "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
apache_beam/transforms/ptransform_test.py:2856: AssertionError
Check warning on line 0 in apache_beam.transforms.trigger_test.TestStreamTranscriptTest
github-actions / Test Results
All 2 runs failed: test_bad_expected_values (apache_beam.transforms.trigger_test.TestStreamTranscriptTest)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 2s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 2s]
Raw output
AssertionError: "Unmatched output" does not match "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
self = <apache_beam.transforms.trigger_test.Check object at 0x7e3ce83cf6d0>
element = ('original', ('expect', [{'values': [1, 2], 'window': [0, 9]}]))
seen = <apache_beam.runners.direct.direct_userstate.BagRuntimeState object at 0x7e3cdabe53d0>
expected = <apache_beam.runners.direct.direct_userstate.BagRuntimeState object at 0x7e3ce8162dd0>
def process(
self,
element,
seen=beam.DoFn.StateParam(
beam.transforms.userstate.BagStateSpec(
'seen', beam.coders.FastPrimitivesCoder())),
expected=beam.DoFn.StateParam(
beam.transforms.userstate.BagStateSpec(
'expected', beam.coders.FastPrimitivesCoder()))):
key, (action, data) = element
if self.allow_out_of_order:
if action == 'expect' and not list(seen.read()):
if data:
expected.add(data)
return
elif action == 'actual' and list(expected.read()):
seen.add(data)
all_data = list(seen.read())
all_expected = list(expected.read())
if len(all_data) == len(all_expected[0]):
expected.clear()
for expect in all_expected[1:]:
expected.add(expect)
action, data = 'expect', all_expected[0]
else:
return
if action == 'actual':
seen.add(data)
elif action == 'expect':
actual = list(seen.read())
seen.clear()
> _windowed_value_info_check(actual, data, key)
apache_beam/transforms/trigger_test.py:1223:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = [{'early': False, 'final': False, 'index': 0, 'late': False, ...}]
expected = [{'values': [1, 2], 'window': [0, 9]}], key = 'original'
def _windowed_value_info_check(actual, expected, key=None):
key_string = ' for %s' % key if key else ''
def format(panes):
return '\n[%s]\n' % '\n '.join(
str(pane)
for pane in sorted(panes, key=lambda pane: pane.get('timestamp', None)))
if len(actual) > len(expected):
raise AssertionError(
'Unexpected output%s: expected %s but got %s' %
(key_string, format(expected), format(actual)))
elif len(expected) > len(actual):
raise AssertionError(
'Unmatched output%s: expected %s but got %s' %
(key_string, format(expected), format(actual)))
else:
def diff(actual, expected):
for key in sorted(expected.keys(), reverse=True):
if key in actual:
if actual[key] != expected[key]:
return key
for output in actual:
diffs = [diff(output, pane) for pane in expected]
if all(diffs):
> raise AssertionError(
'Unmatched output%s: %s not found in %s (diffs in %s)' %
(key_string, output, format(expected), diffs))
E AssertionError: Unmatched output for original: {'window': [0, 9], 'values': [1, 2, 3], 'timestamp': 9, 'index': 0, 'nonspeculative_index': 0, 'early': False, 'late': False, 'final': False} not found in
E [{'window': [0, 9], 'values': [1, 2]}]
E (diffs in ['values'])
apache_beam/transforms/trigger_test.py:1000: AssertionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "apache_beam/runners/common.py", line 1501, in apache_beam.runners.common.DoFnRunner.process
return self.do_fn_invoker.invoke_process(windowed_value)
File "apache_beam/runners/common.py", line 917, in apache_beam.runners.common.PerWindowInvoker.invoke_process
self._invoke_process_per_window(
File "apache_beam/runners/common.py", line 1061, in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window
self.process_method(*args_for_process, **kwargs_for_process),
File "/runner/_work/beam/beam/sdks/python/test-suites/tox/py311/build/srcs/sdks/python/apache_beam/transforms/trigger_test.py", line 1223, in process
_windowed_value_info_check(actual, data, key)
File "/runner/_work/beam/beam/sdks/python/test-suites/tox/py311/build/srcs/sdks/python/apache_beam/transforms/trigger_test.py", line 1000, in _windowed_value_info_check
raise AssertionError(
AssertionError: Unmatched output for original: {'window': [0, 9], 'values': [1, 2, 3], 'timestamp': 9, 'index': 0, 'nonspeculative_index': 0, 'early': False, 'late': False, 'final': False} not found in
[{'window': [0, 9], 'values': [1, 2]}]
(diffs in ['values'])
During handling of the above exception, another exception occurred:
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.trigger_test.TestStreamTranscriptTest testMethod=test_bad_expected_values>
> test_method = lambda self: self._run_log_test(spec)
apache_beam/transforms/trigger_test.py:823:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/transforms/trigger_test.py:838: in _run_log_test
self.assertRaisesRegex(Exception, spec['error'], self._run_log, spec)
E AssertionError: "Unmatched output" does not match "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
Check warning on line 0 in apache_beam.transforms.ptransform_test.DeadLettersTest_0
github-actions / Test Results
All 2 runs failed: test_threshold (apache_beam.transforms.ptransform_test.DeadLettersTest_0)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 1s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 1s]
Raw output
AssertionError: "2 / 8 = 0.25 > 0.1" does not match "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:917: in apache_beam.runners.common.PerWindowInvoker.invoke_process
self._invoke_process_per_window(
apache_beam/runners/common.py:1061: in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window
self.process_method(*args_for_process, **kwargs_for_process),
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/transforms/core.py:2084: in <lambda>
wrapper = lambda x, *args, **kwargs: [fn(x, *args, **kwargs)]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
bad = 2, total = 8, threshold = 0.1, window = GlobalWindow
def check_threshold(bad, total, threshold, window=DoFn.WindowParam):
if bad > total * threshold:
> raise ValueError(
'The number of failing elements within the window %r '
'exceeded threshold: %s / %s = %s > %s' %
(window, bad, total, bad / total, threshold))
E ValueError: The number of failing elements within the window GlobalWindow exceeded threshold: 2 / 8 = 0.25 > 0.1
target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/transforms/core.py:2339: ValueError
During handling of the above exception, another exception occurred:
> return self.do_fn_invoker.invoke_process(windowed_value)
apache_beam/runners/common.py:1501:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/runners/common.py:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
apache_beam/runners/common.py:1687: in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
apache_beam/runners/common.py:1800: in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
apache_beam/runners/worker/operations.py:263: in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
apache_beam/runners/worker/operations.py:950: in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
apache_beam/runners/worker/operations.py:951: in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
apache_beam/runners/common.py:1503: in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> self._maybe_sample_exception(exc_info, windowed_value)
E TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
apache_beam/runners/common.py:1611: TypeError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "apache_beam/runners/common.py", line 1501, in apache_beam.runners.common.DoFnRunner.process
return self.do_fn_invoker.invoke_process(windowed_value)
File "apache_beam/runners/common.py", line 917, in apache_beam.runners.common.PerWindowInvoker.invoke_process
self._invoke_process_per_window(
File "apache_beam/runners/common.py", line 1061, in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window
self.process_method(*args_for_process, **kwargs_for_process),
File "/runner/_work/beam/beam/sdks/python/test-suites/tox/py311/build/srcs/sdks/python/target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/transforms/core.py", line 2084, in <lambda>
wrapper = lambda x, *args, **kwargs: [fn(x, *args, **kwargs)]
^^^^^^^^^^^^^^^^^^^^^^
File "/runner/_work/beam/beam/sdks/python/test-suites/tox/py311/build/srcs/sdks/python/target/.tox-py311/py311/lib/python3.11/site-packages/apache_beam/transforms/core.py", line 2339, in check_threshold
raise ValueError(
ValueError: The number of failing elements within the window GlobalWindow exceeded threshold: 2 / 8 = 0.25 > 0.1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "apache_beam/runners/common.py", line 1501, in apache_beam.runners.common.DoFnRunner.process
return self.do_fn_invoker.invoke_process(windowed_value)
File "apache_beam/runners/common.py", line 689, in apache_beam.runners.common.SimpleInvoker.invoke_process
self.output_handler.handle_process_outputs(
File "apache_beam/runners/common.py", line 1687, in apache_beam.runners.common._OutputHandler.handle_process_outputs
self._write_value_to_tag(tag, windowed_value, watermark_estimator)
File "apache_beam/runners/common.py", line 1800, in apache_beam.runners.common._OutputHandler._write_value_to_tag
self.main_receivers.receive(windowed_value)
File "apache_beam/runners/worker/operations.py", line 263, in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
self.consumer.process(windowed_value)
File "apache_beam/runners/worker/operations.py", line 950, in apache_beam.runners.worker.operations.DoOperation.process
with self.scoped_process_state:
File "apache_beam/runners/worker/operations.py", line 951, in apache_beam.runners.worker.operations.DoOperation.process
delayed_applications = self.dofn_runner.process(o)
File "apache_beam/runners/common.py", line 1503, in apache_beam.runners.common.DoFnRunner.process
self._reraise_augmented(exn, windowed_value)
File "apache_beam/runners/common.py", line 1611, in apache_beam.runners.common.DoFnRunner._reraise_augmented
self._maybe_sample_exception(exc_info, windowed_value)
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
During handling of the above exception, another exception occurred:
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.ptransform_test.DeadLettersTest_0 testMethod=test_threshold>
def test_threshold(self):
# The threshold is high enough.
with TestPipeline() as p:
_ = (
p
| beam.Create([-1, -2, 0, 1, 2, 3, 4, 5])
| beam.Map(self.die_if_negative).with_exception_handling(
threshold=0.5, use_subprocess=self.use_subprocess))
# The threshold is too low enough.
> with self.assertRaisesRegex(Exception, "2 / 8 = 0.25 > 0.1"):
E AssertionError: "2 / 8 = 0.25 > 0.1" does not match "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
apache_beam/transforms/ptransform_test.py:2856: AssertionError
Check warning on line 0 in apache_beam.transforms.trigger_test.TestStreamTranscriptTest
github-actions / Test Results
All 2 runs failed: test_bad_expected_window (apache_beam.transforms.trigger_test.TestStreamTranscriptTest)
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311-cloud.xml [took 2s]
sdks/python/test-suites/tox/py311/build/srcs/sdks/python/pytest_py311.xml [took 2s]
Raw output
AssertionError: "Unmatched output" does not match "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
self = <apache_beam.transforms.trigger_test.Check object at 0x7e3cdb5afb10>
element = ('original', ('expect', [{'values': [1, 2, 3], 'window': [0, 19]}]))
seen = <apache_beam.runners.direct.direct_userstate.BagRuntimeState object at 0x7e3ce833bd10>
expected = <apache_beam.runners.direct.direct_userstate.BagRuntimeState object at 0x7e3cdb395710>
def process(
self,
element,
seen=beam.DoFn.StateParam(
beam.transforms.userstate.BagStateSpec(
'seen', beam.coders.FastPrimitivesCoder())),
expected=beam.DoFn.StateParam(
beam.transforms.userstate.BagStateSpec(
'expected', beam.coders.FastPrimitivesCoder()))):
key, (action, data) = element
if self.allow_out_of_order:
if action == 'expect' and not list(seen.read()):
if data:
expected.add(data)
return
elif action == 'actual' and list(expected.read()):
seen.add(data)
all_data = list(seen.read())
all_expected = list(expected.read())
if len(all_data) == len(all_expected[0]):
expected.clear()
for expect in all_expected[1:]:
expected.add(expect)
action, data = 'expect', all_expected[0]
else:
return
if action == 'actual':
seen.add(data)
elif action == 'expect':
actual = list(seen.read())
seen.clear()
> _windowed_value_info_check(actual, data, key)
apache_beam/transforms/trigger_test.py:1223:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
actual = [{'early': False, 'final': False, 'index': 0, 'late': False, ...}]
expected = [{'values': [1, 2, 3], 'window': [0, 19]}], key = 'original'
def _windowed_value_info_check(actual, expected, key=None):
key_string = ' for %s' % key if key else ''
def format(panes):
return '\n[%s]\n' % '\n '.join(
str(pane)
for pane in sorted(panes, key=lambda pane: pane.get('timestamp', None)))
if len(actual) > len(expected):
raise AssertionError(
'Unexpected output%s: expected %s but got %s' %
(key_string, format(expected), format(actual)))
elif len(expected) > len(actual):
raise AssertionError(
'Unmatched output%s: expected %s but got %s' %
(key_string, format(expected), format(actual)))
else:
def diff(actual, expected):
for key in sorted(expected.keys(), reverse=True):
if key in actual:
if actual[key] != expected[key]:
return key
for output in actual:
diffs = [diff(output, pane) for pane in expected]
if all(diffs):
> raise AssertionError(
'Unmatched output%s: %s not found in %s (diffs in %s)' %
(key_string, output, format(expected), diffs))
E AssertionError: Unmatched output for original: {'window': [0, 9], 'values': [1, 2, 3], 'timestamp': 9, 'index': 0, 'nonspeculative_index': 0, 'early': False, 'late': False, 'final': False} not found in
E [{'window': [0, 19], 'values': [1, 2, 3]}]
E (diffs in ['window'])
apache_beam/transforms/trigger_test.py:1000: AssertionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "apache_beam/runners/common.py", line 1501, in apache_beam.runners.common.DoFnRunner.process
return self.do_fn_invoker.invoke_process(windowed_value)
File "apache_beam/runners/common.py", line 917, in apache_beam.runners.common.PerWindowInvoker.invoke_process
self._invoke_process_per_window(
File "apache_beam/runners/common.py", line 1061, in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window
self.process_method(*args_for_process, **kwargs_for_process),
File "/runner/_work/beam/beam/sdks/python/test-suites/tox/py311/build/srcs/sdks/python/apache_beam/transforms/trigger_test.py", line 1223, in process
_windowed_value_info_check(actual, data, key)
File "/runner/_work/beam/beam/sdks/python/test-suites/tox/py311/build/srcs/sdks/python/apache_beam/transforms/trigger_test.py", line 1000, in _windowed_value_info_check
raise AssertionError(
AssertionError: Unmatched output for original: {'window': [0, 9], 'values': [1, 2, 3], 'timestamp': 9, 'index': 0, 'nonspeculative_index': 0, 'early': False, 'late': False, 'final': False} not found in
[{'window': [0, 19], 'values': [1, 2, 3]}]
(diffs in ['window'])
During handling of the above exception, another exception occurred:
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
During handling of the above exception, another exception occurred:
self = <apache_beam.transforms.trigger_test.TestStreamTranscriptTest testMethod=test_bad_expected_window>
> test_method = lambda self: self._run_log_test(spec)
apache_beam/transforms/trigger_test.py:823:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apache_beam/transforms/trigger_test.py:838: in _run_log_test
self.assertRaisesRegex(Exception, spec['error'], self._run_log, spec)
E AssertionError: "Unmatched output" does not match "Argument 'exn' has incorrect type (expected BaseException, got tuple)"