Skip to content

Commit f771827

Browse files
authored
Disable gRPC fork support in PortableRunnerTestWithSubprocesses (#38744)
Avoids deadline exceeded failures in subprocess tests. Redundant setup and teardown in the multi-worker subclass are removed to inherit them cleanly.
1 parent 2b5c113 commit f771827

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

sdks/python/apache_beam/runners/portability/portable_runner_test.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,22 @@ def create_options(self):
295295
class PortableRunnerTestWithSubprocesses(PortableRunnerTest):
296296
_use_subprocesses = True
297297

298+
# TODO(https://github.com/grpc/grpc/issues/37710): Remove once fixed.
299+
@classmethod
300+
def setUpClass(cls):
301+
cls._old_fork_support = os.environ.get('GRPC_ENABLE_FORK_SUPPORT')
302+
os.environ['GRPC_ENABLE_FORK_SUPPORT'] = 'false'
303+
super().setUpClass()
304+
305+
# TODO(https://github.com/grpc/grpc/issues/37710): Remove once fixed.
306+
@classmethod
307+
def tearDownClass(cls):
308+
if cls._old_fork_support is None:
309+
os.environ.pop('GRPC_ENABLE_FORK_SUPPORT', None)
310+
else:
311+
os.environ['GRPC_ENABLE_FORK_SUPPORT'] = cls._old_fork_support
312+
super().tearDownClass()
313+
298314
def create_options(self):
299315
options = super().create_options()
300316
options.view_as(PortableOptions).environment_type = (
@@ -329,22 +345,6 @@ class PortableRunnerTestWithSubprocessesAndMultiWorkers(
329345
PortableRunnerTestWithSubprocesses):
330346
_use_subprocesses = True
331347

332-
# TODO(https://github.com/grpc/grpc/issues/37710): Remove once fixed.
333-
@classmethod
334-
def setUpClass(cls):
335-
cls._old_fork_support = os.environ.get('GRPC_ENABLE_FORK_SUPPORT')
336-
os.environ['GRPC_ENABLE_FORK_SUPPORT'] = 'false'
337-
super().setUpClass()
338-
339-
# TODO(https://github.com/grpc/grpc/issues/37710): Remove once fixed.
340-
@classmethod
341-
def tearDownClass(cls):
342-
if cls._old_fork_support is None:
343-
os.environ.pop('GRPC_ENABLE_FORK_SUPPORT', None)
344-
else:
345-
os.environ['GRPC_ENABLE_FORK_SUPPORT'] = cls._old_fork_support
346-
super().tearDownClass()
347-
348348
def create_options(self):
349349
options = super() \
350350
.create_options()

0 commit comments

Comments
 (0)