From af1f13fb1eccaa482f55d08ecd4214c1aee52989 Mon Sep 17 00:00:00 2001 From: Shunping Huang Date: Fri, 29 May 2026 09:36:51 -0400 Subject: [PATCH] Disable gRPC fork support in PortableRunnerTestWithSubprocesses Avoids deadline exceeded failures in subprocess tests. Redundant setup and teardown in the multi-worker subclass are removed to inherit them cleanly. --- .../portability/portable_runner_test.py | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sdks/python/apache_beam/runners/portability/portable_runner_test.py b/sdks/python/apache_beam/runners/portability/portable_runner_test.py index a1ed7448f050..e781e13ce663 100644 --- a/sdks/python/apache_beam/runners/portability/portable_runner_test.py +++ b/sdks/python/apache_beam/runners/portability/portable_runner_test.py @@ -295,6 +295,22 @@ def create_options(self): class PortableRunnerTestWithSubprocesses(PortableRunnerTest): _use_subprocesses = True + # TODO(https://github.com/grpc/grpc/issues/37710): Remove once fixed. + @classmethod + def setUpClass(cls): + cls._old_fork_support = os.environ.get('GRPC_ENABLE_FORK_SUPPORT') + os.environ['GRPC_ENABLE_FORK_SUPPORT'] = 'false' + super().setUpClass() + + # TODO(https://github.com/grpc/grpc/issues/37710): Remove once fixed. + @classmethod + def tearDownClass(cls): + if cls._old_fork_support is None: + os.environ.pop('GRPC_ENABLE_FORK_SUPPORT', None) + else: + os.environ['GRPC_ENABLE_FORK_SUPPORT'] = cls._old_fork_support + super().tearDownClass() + def create_options(self): options = super().create_options() options.view_as(PortableOptions).environment_type = ( @@ -329,22 +345,6 @@ class PortableRunnerTestWithSubprocessesAndMultiWorkers( PortableRunnerTestWithSubprocesses): _use_subprocesses = True - # TODO(https://github.com/grpc/grpc/issues/37710): Remove once fixed. - @classmethod - def setUpClass(cls): - cls._old_fork_support = os.environ.get('GRPC_ENABLE_FORK_SUPPORT') - os.environ['GRPC_ENABLE_FORK_SUPPORT'] = 'false' - super().setUpClass() - - # TODO(https://github.com/grpc/grpc/issues/37710): Remove once fixed. - @classmethod - def tearDownClass(cls): - if cls._old_fork_support is None: - os.environ.pop('GRPC_ENABLE_FORK_SUPPORT', None) - else: - os.environ['GRPC_ENABLE_FORK_SUPPORT'] = cls._old_fork_support - super().tearDownClass() - def create_options(self): options = super() \ .create_options()