Skip to content

Add fallback platforms for stager#38688

Open
shunping wants to merge 1 commit into
apache:masterfrom
shunping:fix-stager
Open

Add fallback platforms for stager#38688
shunping wants to merge 1 commit into
apache:masterfrom
shunping:fix-stager

Conversation

@shunping
Copy link
Copy Markdown
Collaborator

@shunping shunping commented May 26, 2026

Add fallback manylinux platform tags for pip download in Stager. (follow-up of #38611)

Ensures that cross-platform binary downloads for environment staging do not fail if PyPI dependencies (e.g. TensorFlow, Numpy, etc) do not publish wheels matching the strictest modern manylinux tag. Falls back dynamically to older, compatible manylinux standards (manylinux2014/manylinux2010).

This fixed PreCommit Python 3.10 failure on MLTest.test_ml_preprocessing_yaml (https://github.com/apache/beam/actions/runs/26420471407/job/77774009271), and PostCommit Python 3.10 failure on VertexAIImageEmbeddingsTest.test_image_embedding_pipeline_from_path (https://github.com/apache/beam/actions/runs/26424456835/job/77785233507).

@shunping shunping marked this pull request as ready for review May 26, 2026 03:39
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves the reliability of the Apache Beam Stager by implementing a fallback mechanism for manylinux platform tags. By attempting downloads with progressively more compatible platform tags when the preferred tag fails, the system avoids unnecessary errors during the staging of dependencies that may not have published modern wheels.

Highlights

  • Manylinux Platform Fallbacks: Introduced a list of prioritized manylinux platform tags to allow the Stager to dynamically fall back to older, more compatible standards if modern tags fail during pip downloads.
  • Robust Pip Download Logic: Refactored the pip download process to iterate through fallback platforms, ensuring that cross-platform binary dependencies can be successfully staged even when specific modern wheels are missing from PyPI.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a fallback mechanism for downloading Python dependencies using pip, iterating through a list of older manylinux platform tags if the preferred modern tag fails. The review feedback highlights that the hardcoded _MANYLINUX_PLATFORMS list only supports _x86_64 architectures, which bypasses the fallback mechanism on ARM64 (aarch64) environments. To resolve this, it is recommended to define base tags and dynamically append the architecture suffix, while filtering out unsupported combinations like manylinux2010 on ARM64.

Comment on lines +93 to +97
_MANYLINUX_PLATFORMS = [
'manylinux_2_28_x86_64',
'manylinux2014_x86_64', # equivalent to manylinux_2_17
'manylinux2010_x86_64', # equivalent to manylinux_2_12
]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The hardcoded _MANYLINUX_PLATFORMS list only contains _x86_64 platform tags. This means that on ARM64 (aarch64) environments (such as Apple Silicon or AWS Graviton), the fallback mechanism will be completely bypassed because the preferred platform (e.g., manylinux_2_28_aarch64) won't be found in this list.

To support both x86_64 and aarch64 architectures, we should define a list of base manylinux tags and dynamically append the appropriate architecture suffix.

Suggested change
_MANYLINUX_PLATFORMS = [
'manylinux_2_28_x86_64',
'manylinux2014_x86_64', # equivalent to manylinux_2_17
'manylinux2010_x86_64', # equivalent to manylinux_2_12
]
_MANYLINUX_BASE_TAGS = [
'manylinux_2_28',
'manylinux2014', # equivalent to manylinux_2_17
'manylinux2010', # equivalent to manylinux_2_12
]

Comment on lines +803 to +807
try:
start_idx = _MANYLINUX_PLATFORMS.index(preferred_platform)
platforms = _MANYLINUX_PLATFORMS[start_idx:]
except ValueError:
platforms = [preferred_platform]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Since we've refactored _MANYLINUX_PLATFORMS to _MANYLINUX_BASE_TAGS to support multiple architectures, we should dynamically detect the architecture suffix (e.g., _x86_64 or _aarch64) from the preferred_platform and reconstruct the platform list. Note that manylinux2010 is not supported on aarch64, so we should exclude it for ARM64.

Suggested change
try:
start_idx = _MANYLINUX_PLATFORMS.index(preferred_platform)
platforms = _MANYLINUX_PLATFORMS[start_idx:]
except ValueError:
platforms = [preferred_platform]
arch = None
for suffix in ['_x86_64', '_aarch64']:
if preferred_platform.endswith(suffix):
arch = suffix
break
if arch:
platforms_with_arch = [
f'{base}{arch}'
for base in _MANYLINUX_BASE_TAGS
if not (base == 'manylinux2010' and arch == '_aarch64')
]
try:
start_idx = platforms_with_arch.index(preferred_platform)
platforms = platforms_with_arch[start_idx:]
except ValueError:
platforms = [preferred_platform]
else:
platforms = [preferred_platform]

@github-actions
Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @tvalentyn for label python.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant