From c6549e71ea454a7efb80c890bacb257813a36be8 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Mon, 11 Nov 2024 12:09:39 -0500 Subject: [PATCH] Fix exception sampling logic (#33076) * Fix exception sampling logic * Allow subclasses of BaseException * Mock cython if not present * Use correct types/names * format --- sdks/python/apache_beam/runners/common.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sdks/python/apache_beam/runners/common.py b/sdks/python/apache_beam/runners/common.py index 8a4f26c18e88..c43870d55ebb 100644 --- a/sdks/python/apache_beam/runners/common.py +++ b/sdks/python/apache_beam/runners/common.py @@ -1504,8 +1504,7 @@ def process(self, windowed_value): return [] def _maybe_sample_exception( - self, exn: BaseException, - windowed_value: Optional[WindowedValue]) -> None: + self, exc_info: Tuple, windowed_value: Optional[WindowedValue]) -> None: if self.execution_context is None: return @@ -1516,7 +1515,7 @@ def _maybe_sample_exception( output_sampler.sample_exception( windowed_value, - exn, + exc_info, self.transform_id, self.execution_context.instruction_id)