You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2022/07/18 23:24:40 UTC
[beam] branch master updated: Fix typo in use_single_core_per_container logic. (#22318)
This is an automated email from the ASF dual-hosted git repository.
robertwb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 70f26ad92a3 Fix typo in use_single_core_per_container logic. (#22318)
70f26ad92a3 is described below
commit 70f26ad92a32ea6853f75db6368b98fd1c03ca8f
Author: Robert Bradshaw <ro...@gmail.com>
AuthorDate: Mon Jul 18 16:24:31 2022 -0700
Fix typo in use_single_core_per_container logic. (#22318)
This fixes https://github.com/apache/beam/issues/22317
---
sdks/python/apache_beam/runners/dataflow/internal/apiclient.py | 2 +-
.../apache_beam/runners/dataflow/internal/apiclient_test.py | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py b/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
index fcaf889633a..81ce4c0c300 100644
--- a/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
+++ b/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
@@ -298,7 +298,7 @@ class Environment(object):
container_image = dataflow.SdkHarnessContainerImage()
container_image.containerImage = container_image_url
container_image.useSingleCorePerContainer = (
- common_urns.protocols.MULTI_CORE_BUNDLE_PROCESSING not in
+ common_urns.protocols.MULTI_CORE_BUNDLE_PROCESSING.urn not in
environment.capabilities)
container_image.environmentId = id
for capability in environment.capabilities:
diff --git a/sdks/python/apache_beam/runners/dataflow/internal/apiclient_test.py b/sdks/python/apache_beam/runners/dataflow/internal/apiclient_test.py
index 0433892d935..153200117c9 100644
--- a/sdks/python/apache_beam/runners/dataflow/internal/apiclient_test.py
+++ b/sdks/python/apache_beam/runners/dataflow/internal/apiclient_test.py
@@ -187,6 +187,8 @@ class UtilTest(unittest.TestCase):
payload=(
beam_runner_api_pb2.DockerPayload(
container_image='dummy_image')).SerializeToString())
+ dummy_env.capabilities.append(
+ common_urns.protocols.MULTI_CORE_BUNDLE_PROCESSING.urn)
proto_pipeline.components.environments['dummy_env_id'].CopyFrom(dummy_env)
dummy_transform = beam_runner_api_pb2.PTransform(
@@ -203,6 +205,12 @@ class UtilTest(unittest.TestCase):
worker_pool = env.proto.workerPools[0]
self.assertEqual(2, len(worker_pool.sdkHarnessContainerImages))
+ # Only one of the environments is missing MULTI_CORE_BUNDLE_PROCESSING.
+ self.assertEqual(
+ 1,
+ sum(
+ c.useSingleCorePerContainer
+ for c in worker_pool.sdkHarnessContainerImages))
env_and_image = [(item.environmentId, item.containerImage)
for item in worker_pool.sdkHarnessContainerImages]