Skip to content

Add issue link to disabled TensorRT integration test #6011

Add issue link to disabled TensorRT integration test

Add issue link to disabled TensorRT integration test #6011

GitHub Actions / Test Results failed Nov 11, 2024 in 0s

37 fail, 190 skipped, 3 514 pass in 7m 3s

    4 files      4 suites   7m 3s ⏱️
3 741 tests 3 514 ✅ 190 💤 37 ❌
7 447 runs  6 619 ✅ 768 💤 60 ❌

Results for commit a90a100.

Annotations

Check warning on line 0 in apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 2 runs failed: test_create_temp_dataset_exception_0 (apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
Raw output
AssertionError: 'accessDenied' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
a = (<apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery testMethod=test_create_temp_dataset_exception_0>,)
kw = {}

    @wraps(func)
    def standalone_func(*a, **kw):
>       return func(*(a + p.args), **p.kwargs, **kw)

target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/parameterized/parameterized.py:620: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/io/gcp/bigquery_test.py:464: in test_create_temp_dataset_exception
    self.assertIn(error_message, exc.exception.args[0])
E   AssertionError: 'accessDenied' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"

Check warning on line 0 in apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 2 runs failed: test_create_temp_dataset_exception_1 (apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
Raw output
AssertionError: 'backendError' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
a = (<apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery testMethod=test_create_temp_dataset_exception_1>,)
kw = {}

    @wraps(func)
    def standalone_func(*a, **kw):
>       return func(*(a + p.args), **p.kwargs, **kw)

target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/parameterized/parameterized.py:620: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/io/gcp/bigquery_test.py:464: in test_create_temp_dataset_exception
    self.assertIn(error_message, exc.exception.args[0])
E   AssertionError: 'backendError' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"

Check warning on line 0 in apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 2 runs failed: test_query_job_exception_0 (apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
Raw output
AssertionError: 'invalidQuery' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
a = (<apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery testMethod=test_query_job_exception_0>,)
kw = {}

    @wraps(func)
    def standalone_func(*a, **kw):
>       return func(*(a + p.args), **p.kwargs, **kw)

target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/parameterized/parameterized.py:620: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/io/gcp/bigquery_test.py:698: in test_query_job_exception
    self.assertIn(error_message, exc.exception.args[0])
E   AssertionError: 'invalidQuery' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"

Check warning on line 0 in apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 2 runs failed: test_query_job_exception_1 (apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
Raw output
AssertionError: 'notFound' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
a = (<apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery testMethod=test_query_job_exception_1>,)
kw = {}

    @wraps(func)
    def standalone_func(*a, **kw):
>       return func(*(a + p.args), **p.kwargs, **kw)

target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/parameterized/parameterized.py:620: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/io/gcp/bigquery_test.py:698: in test_query_job_exception
    self.assertIn(error_message, exc.exception.args[0])
E   AssertionError: 'notFound' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"

Check warning on line 0 in apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 2 runs failed: test_query_job_exception_2 (apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
Raw output
AssertionError: 'responseTooLarge' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
a = (<apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery testMethod=test_query_job_exception_2>,)
kw = {}

    @wraps(func)
    def standalone_func(*a, **kw):
>       return func(*(a + p.args), **p.kwargs, **kw)

target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/parameterized/parameterized.py:620: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/io/gcp/bigquery_test.py:698: in test_query_job_exception
    self.assertIn(error_message, exc.exception.args[0])
E   AssertionError: 'responseTooLarge' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"

Check warning on line 0 in apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 2 runs failed: test_read_export_exception_0 (apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
Raw output
AssertionError: 'invalid' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
a = (<apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery testMethod=test_read_export_exception_0>,)
kw = {}

    @wraps(func)
    def standalone_func(*a, **kw):
>       return func(*(a + p.args), **p.kwargs, **kw)

target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/parameterized/parameterized.py:620: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/io/gcp/bigquery_test.py:729: in test_read_export_exception
    self.assertIn(error_message, exc.exception.args[0])
E   AssertionError: 'invalid' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"

Check warning on line 0 in apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 2 runs failed: test_read_export_exception_1 (apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
Raw output
AssertionError: 'accessDenied' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
a = (<apache_beam.io.gcp.bigquery_test.TestReadFromBigQuery testMethod=test_read_export_exception_1>,)
kw = {}

    @wraps(func)
    def standalone_func(*a, **kw):
>       return func(*(a + p.args), **p.kwargs, **kw)

target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/parameterized/parameterized.py:620: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/io/gcp/bigquery_test.py:729: in test_read_export_exception
    self.assertIn(error_message, exc.exception.args[0])
E   AssertionError: 'accessDenied' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"

Check warning on line 0 in apache_beam.io.gcp.experimental.spannerio_test.SpannerReadTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 2 runs failed: test_invalid_transaction (apache_beam.io.gcp.experimental.spannerio_test.SpannerReadTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.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: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.io.gcp.experimental.spannerio._NaiveSpannerReadDoFn object at 0x7a87180cb610>
element = ReadOperation(is_sql=True, is_table=False, read_operation='process_query_batch', kwargs={'sql': 'Select * from users', 'params': None, 'param_types': None})
spanner_transaction = {'invalid': 'transaction'}

    def process(self, element, spanner_transaction):
      # `spanner_transaction` should be the instance of the _SPANNER_TRANSACTION
      # object.
      if not isinstance(spanner_transaction, _SPANNER_TRANSACTION):
>       raise ValueError(
            "Invalid transaction object: %s. It should be instance "
            "of SPANNER_TRANSACTION object created by "
            "spannerio.create_transaction transform." % type(spanner_transaction))
E       ValueError: Invalid transaction object: <class 'dict'>. It should be instance of SPANNER_TRANSACTION object created by spannerio.create_transaction transform.

target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/io/gcp/experimental/spannerio.py:401: 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:

self = <apache_beam.io.gcp.experimental.spannerio_test.SpannerReadTest testMethod=test_invalid_transaction>
mock_batch_snapshot_class = <MagicMock name='BatchSnapshot' id='134720642867264'>
mock_client_class = <MagicMock name='Client' id='134720642879056'>

    def test_invalid_transaction(
        self, mock_batch_snapshot_class, mock_client_class):
      # test exception raises at pipeline execution time
      with self.assertRaises(ValueError), TestPipeline() as p:
        transaction = (
            p | beam.Create([{
                "invalid": "transaction"
            }]).with_output_types(typing.Any))
>       _ = (
            p | 'with query' >> ReadFromSpanner(
                project_id=TEST_PROJECT_ID,
                instance_id=TEST_INSTANCE_ID,
                database_id=_generate_database_name(),
                transaction=transaction,
                sql="Select * from users"))

apache_beam/io/gcp/experimental/spannerio_test.py:395: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/pipeline.py:620: in __exit__
    self.result = self.run()
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/testing/test_pipeline.py:115: in run
    result = super().run(
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/pipeline.py:567: in run
    return Pipeline.from_runner_api(
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39-cloud/py39-cloud/lib/python3.9/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-py39-cloud/py39-cloud/lib/python3.9/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-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39-cloud/py39-cloud/lib/python3.9/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-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39-cloud/py39-cloud/lib/python3.9/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-py39-cloud/py39-cloud/lib/python3.9/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.io.fileio_test.MatchTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_match_files_one_directory_failure1 (apache_beam.io.fileio_test.MatchTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 1s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.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))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <apache_beam.io.fileio._MatchAllFn object at 0x7fe5d08454c0>
file_pattern = '/runner/_work/beam/beam/sdks/python/test-suites/tox/py39/build/srcs/sdks/python/target/.tox-py39/py39/tmp/tmp_subytag/*'

    def process(self, file_pattern: str) -> List[filesystem.FileMetadata]:
      # TODO: Should we batch the lookups?
      match_results = filesystems.FileSystems.match([file_pattern])
      match_result = match_results[0]
    
      if (not match_result.metadata_list and
          not EmptyMatchTreatment.allow_empty_match(file_pattern,
                                                    self._empty_match_treatment)):
>       raise BeamIOError(
            'Empty match for pattern %s. Disallowed.' % file_pattern)
E       apache_beam.io.filesystem.BeamIOError: Empty match for pattern /runner/_work/beam/beam/sdks/python/test-suites/tox/py39/build/srcs/sdks/python/target/.tox-py39/py39/tmp/tmp_subytag/*. Disallowed. with exceptions None

target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/io/fileio.py:178: BeamIOError

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.io.fileio_test.MatchTest testMethod=test_match_files_one_directory_failure1>

    def test_match_files_one_directory_failure1(self):
      directories = [
          '%s%s' % (self._new_tempdir(), os.sep),
          '%s%s' % (self._new_tempdir(), os.sep)
      ]
    
      files = []
      files.append(self._create_temp_file(dir=directories[0]))
      files.append(self._create_temp_file(dir=directories[0]))
    
      with self.assertRaises(beam.io.filesystem.BeamIOError):
        with TestPipeline() as p:
          files_pc = (
              p
              | beam.Create([FileSystems.join(d, '*') for d in directories])
              | fileio.MatchAll(fileio.EmptyMatchTreatment.DISALLOW)
              | beam.Map(lambda x: x.path))
    
>         assert_that(files_pc, equal_to(files))

apache_beam/io/fileio_test.py:117: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:620: in __exit__
    self.result = self.run()
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/testing/test_pipeline.py:115: in run
    result = super().run(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:567: in run
    return Pipeline.from_runner_api(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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.pipeline_test.PipelineTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_pipeline_as_context (apache_beam.pipeline_test.PipelineTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
exn = ValueError('msg')

    def raise_exception(exn):
>     raise exn
E     ValueError: msg

apache_beam/pipeline_test.py:387: 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:

self = <apache_beam.pipeline_test.PipelineTest testMethod=test_pipeline_as_context>

    def test_pipeline_as_context(self):
      def raise_exception(exn):
        raise exn
    
      with self.assertRaises(ValueError):
        with Pipeline() as p:
          # pylint: disable=expression-not-assigned
>         p | Create([ValueError('msg')]) | Map(raise_exception)

apache_beam/pipeline_test.py:392: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:620: in __exit__
    self.result = self.run()
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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.io.fileio_test.ReadTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_fail_on_directories (apache_beam.io.fileio_test.ReadTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.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:689: in apache_beam.runners.common.SimpleInvoker.invoke_process
    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.io.fileio._ReadMatchesFn object at 0x7fe5d07ead30>
file_metadata = '/runner/_work/beam/beam/sdks/python/test-suites/tox/py39/build/srcs/sdks/python/target/.tox-py39/py39/tmp/tmp317_vofw//'

    def process(
        self,
        file_metadata: Union[str, filesystem.FileMetadata],
    ) -> Iterable[ReadableFile]:
      metadata = (
          filesystem.FileMetadata(file_metadata, 0) if isinstance(
              file_metadata, str) else file_metadata)
    
      if ((metadata.path.endswith('/') or metadata.path.endswith('\\')) and
          self._skip_directories):
        return
      elif metadata.path.endswith('/') or metadata.path.endswith('\\'):
>       raise BeamIOError(
            'Directories are not allowed in ReadMatches transform.'
            'Found %s.' % metadata.path)
E       apache_beam.io.filesystem.BeamIOError: Directories are not allowed in ReadMatches transform.Found /runner/_work/beam/beam/sdks/python/test-suites/tox/py39/build/srcs/sdks/python/target/.tox-py39/py39/tmp/tmp317_vofw//. with exceptions None

target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/io/fileio.py:253: BeamIOError

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.io.fileio_test.ReadTest testMethod=test_fail_on_directories>

    def test_fail_on_directories(self):
      content = 'thecontent\n'
      files = []
      tempdir = '%s%s' % (self._new_tempdir(), os.sep)
    
      # Create a couple files to be matched
      files.append(self._create_temp_file(dir=tempdir, content=content))
      files.append(self._create_temp_file(dir=tempdir, content=content))
    
      with self.assertRaises(beam.io.filesystem.BeamIOError):
        with TestPipeline() as p:
>         _ = (
              p
              | beam.Create(files + ['%s/' % tempdir])
              | fileio.ReadMatches(skip_directories=False)
              | beam.Map(lambda x: x.read_utf8()))

apache_beam/io/fileio_test.py:264: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:620: in __exit__
    self.result = self.run()
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/testing/test_pipeline.py:115: in run
    result = super().run(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:567: in run
    return Pipeline.from_runner_api(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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.testing.util_test.UtilTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_assert_missing (apache_beam.testing.util_test.UtilTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.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: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-py39/py39/lib/python3.9/site-packages/apache_beam/transforms/core.py:2084: in <lambda>
    wrapper = lambda x, *args, **kwargs: [fn(x, *args, **kwargs)]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

actual = ['a', 'b']
equals_fn = <function equal_to.<locals>._equal.<locals>.<lambda> at 0x78b67b532940>

    def _equal(actual, equals_fn=equals_fn):
      expected_list = list(expected)
    
      # Try to compare actual and expected by sorting. This fails with a
      # TypeError in Python 3 if different types are present in the same
      # collection. It can also raise false negatives for types that don't have
      # a deterministic sort order, like pyarrow Tables as of 0.14.1
      if not equals_fn:
        equals_fn = lambda e, a: e == a
        try:
          sorted_expected = sorted(expected)
          sorted_actual = sorted(actual)
          if sorted_expected == sorted_actual:
            return
        except TypeError:
          pass
      # Slower method, used in two cases:
      # 1) If sorted expected != actual, use this method to verify the inequality.
      #    This ensures we don't raise any false negatives for types that don't
      #    have a deterministic sort order.
      # 2) As a fallback if we encounter a TypeError in python 3. this method
      #    works on collections that have different types.
      unexpected = []
      for element in actual:
        found = False
        for i, v in enumerate(expected_list):
          if equals_fn(v, element):
            found = True
            expected_list.pop(i)
            break
        if not found:
          unexpected.append(element)
      if unexpected or expected_list:
        msg = 'Failed assert: %r == %r' % (expected, actual)
        if unexpected:
          msg = msg + ', unexpected elements %r' % unexpected
        if expected_list:
          msg = msg + ', missing elements %r' % expected_list
>       raise BeamAssertException(msg)
E       apache_beam.testing.util.BeamAssertException: Failed assert: ['a', 'b', 'c'] == ['a', 'b'], missing elements ['c']

target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/testing/util.py:192: BeamAssertException

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.testing.util_test.UtilTest testMethod=test_assert_missing>

    def test_assert_missing(self):
      with self.assertRaisesRegex(BeamAssertException,
                                  r"missing elements \['c'\]"):
        with TestPipeline() as p:
>         assert_that(p | Create(['a', 'b']), equal_to(['a', 'b', 'c']))

apache_beam/testing/util_test.py:73: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:620: in __exit__
    self.result = self.run()
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/testing/test_pipeline.py:115: in run
    result = super().run(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:567: in run
    return Pipeline.from_runner_api(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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.typehints.typecheck_test.RuntimeTypeCheckTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_setup (apache_beam.typehints.typecheck_test.RuntimeTypeCheckTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = <class 'int'>, datum = '1', 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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typecheck.py:201: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'int'>, 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-py39/py39/lib/python3.9/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 0x7b93a1044ca0>
method = <bound method TypeCheckWrapperDoFn.process of <apache_beam.typehints.typecheck.TypeCheckWrapperDoFn object at 0x7b93a1044be0>>
args = (1,), kwargs = {}

    def wrapper(self, method, args, kwargs):
      try:
>       result = method(*args, **kwargs)

target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typecheck.py:95: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typecheck.py:151: in process
    return self._type_check_result(self.dofn.process(*args, **kwargs))
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typecheck.py:178: in _type_check_result
    type_check_output(o)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typecheck.py:211: in type_check
    raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typecheck.py:201: in type_check
    check_constraint(type_constraint, datum)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'int'>, 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.decorators.TypeCheckError: According to type-hint expected output should be of type <class 'int'>. Instead, received '1', an instance of type <class 'str'>.

target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typecheck.py:78: in process
    return self.wrapper(self.dofn.process, args, kwargs)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typecheck.py:102: in wrapper
    raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typecheck.py:95: in wrapper
    result = method(*args, **kwargs)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typecheck.py:151: in process
    return self._type_check_result(self.dofn.process(*args, **kwargs))
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typecheck.py:178: in _type_check_result
    type_check_output(o)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typecheck.py:211: in type_check
    raise TypeCheckError(error_msg).with_traceback(tb)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typecheck.py:201: in type_check
    check_constraint(type_constraint, datum)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'int'>, 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.decorators.TypeCheckError: Runtime type violation detected within ParDo(Map(fn)): According to type-hint expected output should be of type <class 'int'>. Instead, received '1', an instance of type <class 'str'>.

target/.tox-py39/py39/lib/python3.9/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.typehints.typecheck_test.RuntimeTypeCheckTest testMethod=test_setup>

    def test_setup(self):
      # Verifies that runtime type checking is enabled for test cases.
      def fn(e: int) -> int:
        return str(e)  # type: ignore
    
      with self.assertRaisesRegex(TypeCheckError,
                                  r'output should be.*int.*received.*str'):
        _ = self.p | beam.Create([1, 2, 3]) | beam.Map(fn)
>       self.p.run()

apache_beam/typehints/typecheck_test.py:99: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/testing/test_pipeline.py:115: in run
    result = super().run(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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.testing.util_test.UtilTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_assert_missing_and_unexpected (apache_beam.testing.util_test.UtilTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 1s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.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: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-py39/py39/lib/python3.9/site-packages/apache_beam/transforms/core.py:2084: in <lambda>
    wrapper = lambda x, *args, **kwargs: [fn(x, *args, **kwargs)]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

actual = ['a', 'b', 'c']
equals_fn = <function equal_to.<locals>._equal.<locals>.<lambda> at 0x78b675bacb80>

    def _equal(actual, equals_fn=equals_fn):
      expected_list = list(expected)
    
      # Try to compare actual and expected by sorting. This fails with a
      # TypeError in Python 3 if different types are present in the same
      # collection. It can also raise false negatives for types that don't have
      # a deterministic sort order, like pyarrow Tables as of 0.14.1
      if not equals_fn:
        equals_fn = lambda e, a: e == a
        try:
          sorted_expected = sorted(expected)
          sorted_actual = sorted(actual)
          if sorted_expected == sorted_actual:
            return
        except TypeError:
          pass
      # Slower method, used in two cases:
      # 1) If sorted expected != actual, use this method to verify the inequality.
      #    This ensures we don't raise any false negatives for types that don't
      #    have a deterministic sort order.
      # 2) As a fallback if we encounter a TypeError in python 3. this method
      #    works on collections that have different types.
      unexpected = []
      for element in actual:
        found = False
        for i, v in enumerate(expected_list):
          if equals_fn(v, element):
            found = True
            expected_list.pop(i)
            break
        if not found:
          unexpected.append(element)
      if unexpected or expected_list:
        msg = 'Failed assert: %r == %r' % (expected, actual)
        if unexpected:
          msg = msg + ', unexpected elements %r' % unexpected
        if expected_list:
          msg = msg + ', missing elements %r' % expected_list
>       raise BeamAssertException(msg)
E       apache_beam.testing.util.BeamAssertException: Failed assert: ['a', 'b', 'd'] == ['a', 'b', 'c'], unexpected elements ['c'], missing elements ['d']

target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/testing/util.py:192: BeamAssertException

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.testing.util_test.UtilTest testMethod=test_assert_missing_and_unexpected>

    def test_assert_missing_and_unexpected(self):
      with self.assertRaisesRegex(
          BeamAssertException,
          r"unexpected elements \['c'\].*missing elements \['d'\]"):
        with TestPipeline() as p:
>         assert_that(p | Create(['a', 'b', 'c']), equal_to(['a', 'b', 'd']))

apache_beam/testing/util_test.py:87: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:620: in __exit__
    self.result = self.run()
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/testing/test_pipeline.py:115: in run
    result = super().run(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:567: in run
    return Pipeline.from_runner_api(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_do_fn_returning_non_iterable_throws_error (apache_beam.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.xml [took 0s]
Raw output
AssertionError: False is not true : "Argument 'exn' has incorrect type (expected BaseException, got tuple)" does not start with "'int' object is not iterable "
self = <apache_beam.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest testMethod=test_do_fn_returning_non_iterable_throws_error>

    def test_do_fn_returning_non_iterable_throws_error(self):
      # This function is incorrect because it returns a non-iterable object
      def incorrect_par_do_fn(x):
        return x + 5
    
      with self.assertRaises(TypeError) as cm:
        (self.p | beam.Create([1, 1]) | beam.FlatMap(incorrect_par_do_fn))
        self.p.run()
    
>     self.assertStartswith(cm.exception.args[0], "'int' object is not iterable ")

apache_beam/typehints/typecheck_test.py:204: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
apache_beam/typehints/typecheck_test.py:143: in assertStartswith
    self.assertTrue(
E   AssertionError: False is not true : "Argument 'exn' has incorrect type (expected BaseException, got tuple)" does not start with "'int' object is not iterable "

Check warning on line 0 in apache_beam.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_downstream_input_type_hint_error_has_descriptive_error_msg (apache_beam.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = <class 'str'>, instance = 9, 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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/decorators.py:887: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'str'>, object_instance = 9

    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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError

During handling of the above exception, another exception occurred:

>   _check_instance_type(constraint, value, parameter_name, verbose=True)

apache_beam/runners/worker/opcounters.py:246: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'str'>, instance = 9, 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)))
E       apache_beam.typehints.decorators.TypeCheckError: Type-hint for argument: 'element' violated. Expected an instance of <class 'str'>, instead found 9, an instance of <class 'int'>.

target/.tox-py39/py39/lib/python3.9/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: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:259: in apache_beam.runners.worker.opcounters.OperationCounters.do_sample
    self.type_check(windowed_value.value)
apache_beam/runners/worker/opcounters.py:255: in apache_beam.runners.worker.opcounters.OperationCounters.type_check
    raise TypeCheckError(error_msg).with_traceback(traceback)
apache_beam/runners/worker/opcounters.py:246: in apache_beam.runners.worker.opcounters.OperationCounters.type_check
    _check_instance_type(constraint, value, parameter_name, verbose=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'str'>, instance = 9, 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)))
E       apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within ParDo(StrToInt): Type-hint for argument: 'element' violated. Expected an instance of <class 'str'>, instead found 9, an instance of <class 'int'>.

target/.tox-py39/py39/lib/python3.9/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.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest testMethod=test_downstream_input_type_hint_error_has_descriptive_error_msg>

    def test_downstream_input_type_hint_error_has_descriptive_error_msg(self):
      @with_input_types(int)
      @with_output_types(int)
      class IntToInt(beam.DoFn):
        def process(self, element, *args, **kwargs):
          yield element
    
      @with_input_types(str)
      @with_output_types(int)
      class StrToInt(beam.DoFn):
        def process(self, element, *args, **kwargs):
          yield int(element)
    
      # This will raise a type check error in IntToInt even though the actual
      # type check error won't happen until StrToInt. The user will be told that
      # StrToInt's input type hints were not satisfied while running IntToInt.
      with self.assertRaises(TypeCheckError) as e:
        (
            self.p
            | beam.Create([9])
            | beam.ParDo(IntToInt())
            | beam.ParDo(StrToInt()))
>       self.p.run()

apache_beam/typehints/typecheck_test.py:316: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_pipeline_checking_satisfied_but_run_time_types_violate (apache_beam.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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'>], instance = (0, 0)
var_name = None, 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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/decorators.py:887: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typehints.py:735: CompositeTypeHintError

During handling of the above exception, another exception occurred:

>   _check_instance_type(constraint, value, parameter_name, verbose=True)

apache_beam/runners/worker/opcounters.py:246: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = Tuple[<class 'bool'>, <class 'int'>], instance = (0, 0)
var_name = None, 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 return type violated: 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-py39/py39/lib/python3.9/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: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:259: in apache_beam.runners.worker.opcounters.OperationCounters.do_sample
    self.type_check(windowed_value.value)
apache_beam/runners/worker/opcounters.py:255: in apache_beam.runners.worker.opcounters.OperationCounters.type_check
    raise TypeCheckError(error_msg).with_traceback(traceback)
apache_beam/runners/worker/opcounters.py:246: in apache_beam.runners.worker.opcounters.OperationCounters.type_check
    _check_instance_type(constraint, value, parameter_name, verbose=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = Tuple[<class 'bool'>, <class 'int'>], instance = (0, 0)
var_name = None, 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(IsEven): Type-hint for return type violated: 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-py39/py39/lib/python3.9/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:

self = <apache_beam.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest 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
    
      @with_output_types(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(1)).with_output_types(int)
          | 'IsEven' >> beam.Map(is_even_as_key)
          | 'Parity' >> beam.GroupByKey())
    
      with self.assertRaises(TypeCheckError) as e:
>       self.p.run()

apache_beam/typehints/typecheck_test.py:260: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_pipeline_runtime_checking_violation_composite_type_output (apache_beam.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = <class 'int'>, instance = 4.0, var_name = None, 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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/decorators.py:887: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'int'>, object_instance = 4.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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError

During handling of the above exception, another exception occurred:

>   _check_instance_type(constraint, value, parameter_name, verbose=True)

apache_beam/runners/worker/opcounters.py:246: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'int'>, instance = 4.0, var_name = None, 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 return type violated. Expected an instance of <class 'int'>, instead found 4.0, an instance of <class 'float'>.

target/.tox-py39/py39/lib/python3.9/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:346: in apache_beam.runners.worker.operations.GeneralPurposeConsumerSet.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:259: in apache_beam.runners.worker.opcounters.OperationCounters.do_sample
    self.type_check(windowed_value.value)
apache_beam/runners/worker/opcounters.py:255: in apache_beam.runners.worker.opcounters.OperationCounters.type_check
    raise TypeCheckError(error_msg).with_traceback(traceback)
apache_beam/runners/worker/opcounters.py:246: in apache_beam.runners.worker.opcounters.OperationCounters.type_check
    _check_instance_type(constraint, value, parameter_name, verbose=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'int'>, instance = 4.0, var_name = None, 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(Swap): Type-hint for return type violated. Expected an instance of <class 'int'>, instead found 4.0, an instance of <class 'float'>.

target/.tox-py39/py39/lib/python3.9/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.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest 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).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(TypeCheckError) as e:
        (
            self.p
            | beam.Create([(1, 3.0)])
            | (
                'Swap' >>
                beam.FlatMap(lambda x_y1: [x_y1[0] + x_y1[1]]).with_input_types(
                    Tuple[int, float]).with_output_types(int)))
>       self.p.run()

apache_beam/typehints/typecheck_test.py:285: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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.testing.util_test.UtilTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_assert_that_fails_on_is_not_empty_expected (apache_beam.testing.util_test.UtilTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 1s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.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-py39/py39/lib/python3.9/site-packages/apache_beam/transforms/core.py:2086: in <lambda>
    wrapper = lambda x: [fn(x)]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

actual = []

    def _not_empty(actual):
      actual = list(actual)
      if not actual:
>       raise BeamAssertException('Failed assert: pcol is empty')
E       apache_beam.testing.util.BeamAssertException: Failed assert: pcol is empty

target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/testing/util.py:232: BeamAssertException

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.testing.util_test.UtilTest testMethod=test_assert_that_fails_on_is_not_empty_expected>

    def test_assert_that_fails_on_is_not_empty_expected(self):
      with self.assertRaises(BeamAssertException):
        with TestPipeline() as p:
>         assert_that(p | Create([]), is_not_empty())

apache_beam/testing/util_test.py:147: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:620: in __exit__
    self.result = self.run()
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/testing/test_pipeline.py:115: in run
    result = super().run(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:567: in run
    return Pipeline.from_runner_api(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_simple_input_error (apache_beam.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError

During handling of the above exception, another exception occurred:

>   _check_instance_type(constraint, value, parameter_name, verbose=True)

apache_beam/runners/worker/opcounters.py:246: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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-py39/py39/lib/python3.9/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: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:259: in apache_beam.runners.worker.opcounters.OperationCounters.do_sample
    self.type_check(windowed_value.value)
apache_beam/runners/worker/opcounters.py:255: in apache_beam.runners.worker.opcounters.OperationCounters.type_check
    raise TypeCheckError(error_msg).with_traceback(traceback)
apache_beam/runners/worker/opcounters.py:246: in apache_beam.runners.worker.opcounters.OperationCounters.type_check
    _check_instance_type(constraint, value, parameter_name, verbose=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(FlatMap(<lambda at typecheck_test.py:151>)): Type-hint for argument: 'x' violated. Expected an instance of <class 'str'>, instead found 1, an instance of <class 'int'>.

target/.tox-py39/py39/lib/python3.9/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.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest testMethod=test_simple_input_error>

    def test_simple_input_error(self):
      with self.assertRaises(TypeCheckError) as e:
        (
            self.p
            | beam.Create([1, 1])
            | beam.FlatMap(lambda x: [int(x)]).with_input_types(
                str).with_output_types(int))
>       self.p.run()

apache_beam/typehints/typecheck_test.py:153: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_simple_input_error_with_kwarg_typehints (apache_beam.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = <class 'int'>, instance = '1', 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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/decorators.py:887: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'int'>, 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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError

During handling of the above exception, another exception occurred:

>   _check_instance_type(constraint, value, parameter_name, verbose=True)

apache_beam/runners/worker/opcounters.py:246: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'int'>, instance = '1', 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)))
E       apache_beam.typehints.decorators.TypeCheckError: Type-hint for argument: 'element' violated. Expected an instance of <class 'int'>, instead found 1, an instance of <class 'str'>.

target/.tox-py39/py39/lib/python3.9/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: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:259: in apache_beam.runners.worker.opcounters.OperationCounters.do_sample
    self.type_check(windowed_value.value)
apache_beam/runners/worker/opcounters.py:255: in apache_beam.runners.worker.opcounters.OperationCounters.type_check
    raise TypeCheckError(error_msg).with_traceback(traceback)
apache_beam/runners/worker/opcounters.py:246: in apache_beam.runners.worker.opcounters.OperationCounters.type_check
    _check_instance_type(constraint, value, parameter_name, verbose=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'int'>, instance = '1', 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)))
E       apache_beam.typehints.decorators.TypeCheckError: Runtime type violation detected within ParDo(ToInt): Type-hint for argument: 'element' violated. Expected an instance of <class 'int'>, instead found 1, an instance of <class 'str'>.

target/.tox-py39/py39/lib/python3.9/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.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest testMethod=test_simple_input_error_with_kwarg_typehints>

    def test_simple_input_error_with_kwarg_typehints(self):
      @with_input_types(element=int)
      @with_output_types(int)
      class ToInt(beam.DoFn):
        def process(self, element, *args, **kwargs):
          yield int(element)
    
      with self.assertRaises(TypeCheckError) as e:
        (self.p | beam.Create(['1', '1']) | beam.ParDo(ToInt()))
>       self.p.run()

apache_beam/typehints/typecheck_test.py:185: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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.io.gcp.bigquery_test.BigQueryStreamingInsertsErrorHandling

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 2 runs failed: test_insert_rows_json_persistent_retriable_exception_0 (apache_beam.io.gcp.bigquery_test.BigQueryStreamingInsertsErrorHandling)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
Raw output
AssertionError: 'some connection error' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
a = (<apache_beam.io.gcp.bigquery_test.BigQueryStreamingInsertsErrorHandling testMethod=test_insert_rows_json_persistent_retriable_exception_0>,)
kw = {}

    @wraps(func)
    def standalone_func(*a, **kw):
>       return func(*(a + p.args), **p.kwargs, **kw)

target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/parameterized/parameterized.py:620: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/mock/mock.py:1452: in patched
    return func(*newargs, **newkeywargs)
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/parameterized/parameterized.py:93: in dummy_func
    return orgfunc(*args, **kwargs)
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/mock/mock.py:1452: in patched
    return func(*newargs, **newkeywargs)
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/io/gcp/bigquery_test.py:1515: in test_insert_rows_json_persistent_retriable_exception
    self.assertIn(error_message, exc.exception.args[0])
E   AssertionError: 'some connection error' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"

Check warning on line 0 in apache_beam.io.gcp.bigquery_test.BigQueryStreamingInsertsErrorHandling

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 2 runs failed: test_insert_rows_json_persistent_retriable_exception_1 (apache_beam.io.gcp.bigquery_test.BigQueryStreamingInsertsErrorHandling)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
Raw output
AssertionError: 'some timeout error' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"
a = (<apache_beam.io.gcp.bigquery_test.BigQueryStreamingInsertsErrorHandling testMethod=test_insert_rows_json_persistent_retriable_exception_1>,)
kw = {}

    @wraps(func)
    def standalone_func(*a, **kw):
>       return func(*(a + p.args), **p.kwargs, **kw)

target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/parameterized/parameterized.py:620: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/mock/mock.py:1452: in patched
    return func(*newargs, **newkeywargs)
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/parameterized/parameterized.py:93: in dummy_func
    return orgfunc(*args, **kwargs)
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/mock/mock.py:1452: in patched
    return func(*newargs, **newkeywargs)
target/.tox-py39-cloud/py39-cloud/lib/python3.9/site-packages/apache_beam/io/gcp/bigquery_test.py:1515: in test_insert_rows_json_persistent_retriable_exception
    self.assertIn(error_message, exc.exception.args[0])
E   AssertionError: 'some timeout error' not found in "Argument 'exn' has incorrect type (expected BaseException, got tuple)"

Check warning on line 0 in apache_beam.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_simple_output_error (apache_beam.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 0s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.xml [took 0s]
Raw output
TypeError: Argument 'exn' has incorrect type (expected BaseException, got tuple)
type_constraint = <class 'int'>, 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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/decorators.py:887: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'int'>, 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-py39/py39/lib/python3.9/site-packages/apache_beam/typehints/typehints.py:436: SimpleTypeHintError

During handling of the above exception, another exception occurred:

>   _check_instance_type(constraint, value, parameter_name, verbose=True)

apache_beam/runners/worker/opcounters.py:246: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'int'>, 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 'int'>, instead found 1, an instance of <class 'str'>.

target/.tox-py39/py39/lib/python3.9/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: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:259: in apache_beam.runners.worker.opcounters.OperationCounters.do_sample
    self.type_check(windowed_value.value)
apache_beam/runners/worker/opcounters.py:255: in apache_beam.runners.worker.opcounters.OperationCounters.type_check
    raise TypeCheckError(error_msg).with_traceback(traceback)
apache_beam/runners/worker/opcounters.py:246: in apache_beam.runners.worker.opcounters.OperationCounters.type_check
    _check_instance_type(constraint, value, parameter_name, verbose=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_constraint = <class 'int'>, 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(FlatMap(<lambda at typecheck_test.py:166>)): Type-hint for argument: 'x' violated. Expected an instance of <class 'int'>, instead found 1, an instance of <class 'str'>.

target/.tox-py39/py39/lib/python3.9/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.typehints.typecheck_test.PerformanceRuntimeTypeCheckTest testMethod=test_simple_output_error>

    def test_simple_output_error(self):
      with self.assertRaises(TypeCheckError) as e:
        (
            self.p
            | beam.Create(['1', '1'])
            | beam.FlatMap(lambda x: [int(x)]).with_input_types(
                int).with_output_types(int))
>       self.p.run()

apache_beam/typehints/typecheck_test.py:168: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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.testing.util_test.UtilTest

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_assert_unexpected (apache_beam.testing.util_test.UtilTest)

sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39-cloud.xml [took 2s]
sdks/python/test-suites/tox/py39/build/srcs/sdks/python/pytest_py39.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: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-py39/py39/lib/python3.9/site-packages/apache_beam/transforms/core.py:2084: in <lambda>
    wrapper = lambda x, *args, **kwargs: [fn(x, *args, **kwargs)]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

actual = ['a', 'b', 'c', 'd']
equals_fn = <function equal_to.<locals>._equal.<locals>.<lambda> at 0x78b678f47d30>

    def _equal(actual, equals_fn=equals_fn):
      expected_list = list(expected)
    
      # Try to compare actual and expected by sorting. This fails with a
      # TypeError in Python 3 if different types are present in the same
      # collection. It can also raise false negatives for types that don't have
      # a deterministic sort order, like pyarrow Tables as of 0.14.1
      if not equals_fn:
        equals_fn = lambda e, a: e == a
        try:
          sorted_expected = sorted(expected)
          sorted_actual = sorted(actual)
          if sorted_expected == sorted_actual:
            return
        except TypeError:
          pass
      # Slower method, used in two cases:
      # 1) If sorted expected != actual, use this method to verify the inequality.
      #    This ensures we don't raise any false negatives for types that don't
      #    have a deterministic sort order.
      # 2) As a fallback if we encounter a TypeError in python 3. this method
      #    works on collections that have different types.
      unexpected = []
      for element in actual:
        found = False
        for i, v in enumerate(expected_list):
          if equals_fn(v, element):
            found = True
            expected_list.pop(i)
            break
        if not found:
          unexpected.append(element)
      if unexpected or expected_list:
        msg = 'Failed assert: %r == %r' % (expected, actual)
        if unexpected:
          msg = msg + ', unexpected elements %r' % unexpected
        if expected_list:
          msg = msg + ', missing elements %r' % expected_list
>       raise BeamAssertException(msg)
E       apache_beam.testing.util.BeamAssertException: Failed assert: ['a', 'b'] == ['a', 'b', 'c', 'd'], unexpected elements ['c', 'd']

target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/testing/util.py:192: BeamAssertException

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.testing.util_test.UtilTest testMethod=test_assert_unexpected>

    def test_assert_unexpected(self):
      with self.assertRaisesRegex(BeamAssertException,
                                  r"unexpected elements \['c', 'd'\]|"
                                  r"unexpected elements \['d', 'c'\]"):
        with TestPipeline() as p:
>         assert_that(p | Create(['a', 'b', 'c', 'd']), equal_to(['a', 'b']))

apache_beam/testing/util_test.py:80: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:620: in __exit__
    self.result = self.run()
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/testing/test_pipeline.py:115: in run
    result = super().run(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:567: in run
    return Pipeline.from_runner_api(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/pipeline.py:594: in run
    return self.runner.run_pipeline(self, self._options)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/direct/direct_runner.py:184: in run_pipeline
    return runner.run_pipeline(pipeline, options)
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:468: in run_stages
    bundle_results = self._execute_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:793: in _execute_bundle
    self._run_bundle(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner.py:1032: in _run_bundle
    result, splits = bundle_manager.process_bundle(
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/site-packages/apache_beam/runners/portability/fn_api_runner/worker_handlers.py:386: in push
    response = self.worker.do_instruction(request)
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:656: in do_instruction
    return getattr(self, request_type)(
target/.tox-py39/py39/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py:694: in process_bundle
    bundle_processor.process_bundle(instruction_id))
target/.tox-py39/py39/lib/python3.9/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-py39/py39/lib/python3.9/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