Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dataflow python to use external containers #26383

Merged
merged 6 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -1207,19 +1207,21 @@ def get_container_image_from_options(pipeline_options):
if worker_options.sdk_container_image:
return worker_options.sdk_container_image

# TODO(tvalentyn): Use enumerated type instead of strings for job types.
if _is_runner_v2(pipeline_options):
fnapi_suffix = '-fnapi'
else:
fnapi_suffix = ''
is_runner_v2 = _is_runner_v2(pipeline_options)

# Legacy and runner v2 exist in different repositories.
# Set to legacy format, override if runner v2
version_suffix = '%s%s' % (sys.version_info[0:2])
image_name = '{repository}/python{version_suffix}{fnapi_suffix}'.format(
repository=names.DATAFLOW_CONTAINER_IMAGE_REPOSITORY,
version_suffix=version_suffix,
fnapi_suffix=fnapi_suffix)
container_repo = names.DATAFLOW_CONTAINER_IMAGE_REPOSITORY
image_name = '{repository}/python{version_suffix}'.format(
repository=container_repo, version_suffix=version_suffix)

if is_runner_v2:
version_suffix = '%s.%s' % (sys.version_info[0:2])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually need this, it inserts a . while the last one does not.

With that said, I don't think this is helpful (the difference is too subtle), so I removed version_suffix entirely and replaced it with major/minor

image_name = '{repository}/beam_python{version_suffix}_sdk'.format(
repository=container_repo, version_suffix=version_suffix)

image_tag = _get_required_container_version(_is_runner_v2(pipeline_options))
image_tag = _get_required_container_version(is_runner_v2)
return image_name + ':' + image_tag


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ def test_pinned_worker_harness_image_tag_used_in_dev_sdk(self):
self.assertEqual(
env.proto.workerPools[0].workerHarnessContainerImage,
(
names.DATAFLOW_CONTAINER_IMAGE_REPOSITORY + '/python%d%d-fnapi:%s' %
(
names.DATAFLOW_CONTAINER_IMAGE_REPOSITORY +
'/beam_python%d.%d_sdk:%s' % (
sys.version_info[0],
sys.version_info[1],
names.BEAM_FNAPI_CONTAINER_VERSION)))
Expand Down Expand Up @@ -670,7 +670,7 @@ def test_worker_harness_image_tag_matches_released_sdk_version(self):
env.proto.workerPools[0].workerHarnessContainerImage,
(
names.DATAFLOW_CONTAINER_IMAGE_REPOSITORY +
'/python%d%d-fnapi:2.2.0' %
'/beam_python%d.%d_sdk:2.2.0' %
(sys.version_info[0], sys.version_info[1])))

# batch, legacy pipeline.
Expand Down Expand Up @@ -704,7 +704,7 @@ def test_worker_harness_image_tag_matches_base_sdk_version_of_an_rc(self):
env.proto.workerPools[0].workerHarnessContainerImage,
(
names.DATAFLOW_CONTAINER_IMAGE_REPOSITORY +
'/python%d%d-fnapi:2.2.0' %
'/beam_python%d.%d_sdk:2.2.0' %
(sys.version_info[0], sys.version_info[1])))

# batch, legacy pipeline.
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/apache_beam/runners/dataflow/internal/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
BEAM_CONTAINER_VERSION = 'beam-master-20230412'
# Update this version to the next version whenever there is a change that
# requires changes to SDK harness container or SDK harness launcher.
BEAM_FNAPI_CONTAINER_VERSION = 'beam-master-20230412'
BEAM_FNAPI_CONTAINER_VERSION = 'beam-master-20230422'

DATAFLOW_CONTAINER_IMAGE_REPOSITORY = 'gcr.io/cloud-dataflow/v1beta3'

Expand Down