From 04fe4b53433f67e1a9e2d0a83d715100795a1bc3 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Fri, 1 Dec 2023 10:13:49 -0800 Subject: [PATCH] Consider underlying providers in both directions when doing affinity test. --- sdks/python/apache_beam/yaml/yaml_provider.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdks/python/apache_beam/yaml/yaml_provider.py b/sdks/python/apache_beam/yaml/yaml_provider.py index 01e39b770c9b..25cc366ec2c7 100644 --- a/sdks/python/apache_beam/yaml/yaml_provider.py +++ b/sdks/python/apache_beam/yaml/yaml_provider.py @@ -109,9 +109,9 @@ def affinity(self, other: "Provider"): # E.g. we could look at the the expected environments themselves. # Possibly, we could provide multiple expansions and have the runner itself # choose the actual implementation based on fusion (and other) criteria. - return ( - self.underlying_provider()._affinity(other) + - other.underlying_provider()._affinity(self)) + a = self.underlying_provider() + b = other.underlying_provider() + return a._affinity(b) + b._affinity(a) def _affinity(self, other: "Provider"): if self is other or self == other: