You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "shunping (via GitHub)" <gi...@apache.org> on 2026/05/26 00:36:33 UTC

[PR] Add fallback platforms for stager [beam]

shunping opened a new pull request, #38688:
URL: https://github.com/apache/beam/pull/38688

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enforce binary-only constraints during early requirements cache attempts [beam]

Posted by "tvalentyn (via GitHub)" <gi...@apache.org>.
tvalentyn commented on code in PR #38688:
URL: https://github.com/apache/beam/pull/38688#discussion_r3306218534


##########
sdks/python/apache_beam/runners/portability/stager.py:
##########
@@ -781,23 +787,60 @@ def _populate_requirements_cache(
       ]
 
       if populate_cache_with_sdists:
-        cmd_args.extend(['--no-binary', ':all:'])
+        download_dir = tempfile.mkdtemp(dir=temp_directory)
+        cmd_args.extend(['--dest', download_dir, '--no-binary', ':all:'])
+        _LOGGER.info('Executing command: %s', cmd_args)
+        processes.check_output(cmd_args, stderr=processes.STDOUT)
       else:
         language_implementation_tag = 'cp'
         abi_suffix = 'm' if sys.version_info < (3, 8) else ''
         abi_tag = 'cp%d%d%s' % (
             sys.version_info[0], sys.version_info[1], abi_suffix)
-        platform_tag = Stager._get_platform_for_default_sdk_container()
-        cmd_args.extend([
-            '--implementation',
-            language_implementation_tag,
-            '--abi',
-            abi_tag,
-            '--platform',
-            platform_tag
-        ])
-      _LOGGER.info('Executing command: %s', cmd_args)
-      processes.check_output(cmd_args, stderr=processes.STDOUT)
+        preferred_platform = Stager._get_platform_for_default_sdk_container()

Review Comment:
   high-level comments:
   - I'd prefer to extract this logic into a helper since this method is getting long. Options (no strong opinion): _get_platform_for_default_sdk_container(package_name) , download_dist_for_package(package_name), etc.
   - _get_platform_for_default_sdk_container is becoming obsolete since it no longer fully captures the logic selecting the platform given the list we are introducting; we should keep that logic in one place, perhaps by getting rid of _get_platform_for_default_sdk_container and add the default into the map itself.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enforce binary-only constraints during early requirements cache attempts [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on code in PR #38688:
URL: https://github.com/apache/beam/pull/38688#discussion_r3306445358


##########
sdks/python/apache_beam/runners/portability/stager.py:
##########
@@ -781,23 +787,60 @@ def _populate_requirements_cache(
       ]
 
       if populate_cache_with_sdists:
-        cmd_args.extend(['--no-binary', ':all:'])
+        download_dir = tempfile.mkdtemp(dir=temp_directory)
+        cmd_args.extend(['--dest', download_dir, '--no-binary', ':all:'])
+        _LOGGER.info('Executing command: %s', cmd_args)
+        processes.check_output(cmd_args, stderr=processes.STDOUT)
       else:
         language_implementation_tag = 'cp'
         abi_suffix = 'm' if sys.version_info < (3, 8) else ''
         abi_tag = 'cp%d%d%s' % (
             sys.version_info[0], sys.version_info[1], abi_suffix)
-        platform_tag = Stager._get_platform_for_default_sdk_container()
-        cmd_args.extend([
-            '--implementation',
-            language_implementation_tag,
-            '--abi',
-            abi_tag,
-            '--platform',
-            platform_tag
-        ])
-      _LOGGER.info('Executing command: %s', cmd_args)
-      processes.check_output(cmd_args, stderr=processes.STDOUT)
+        preferred_platform = Stager._get_platform_for_default_sdk_container()

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add fallback platforms for stager [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #38688:
URL: https://github.com/apache/beam/pull/38688#issuecomment-4545032110

   Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment `assign set of reviewers`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add fallback platforms for stager [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on PR #38688:
URL: https://github.com/apache/beam/pull/38688#issuecomment-4539779237

   ## Summary of Changes
   
   Hello, I'm Gemini Code Assist[^1]! 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.
   
   <details>
   <summary><b>New Features</b></summary>
   
   🧠 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](https://codeassist.google/code-review/login) to enable Memory in your admin console.**
   </details>
   
   <details>
   <summary><b>Using Gemini Code Assist</b></summary>
   <br>
   
   The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips.
   
   <b>Invoking Gemini</b>
   
   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.
   
   <b>Customization</b>
   
   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](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
   
   <b>Limitations & Feedback</b>
   
   Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with :thumbsup: and :thumbsdown: 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](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG).
   </details>
   
   
   [^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enforce binary-only constraints during early requirements cache attempts [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on PR #38688:
URL: https://github.com/apache/beam/pull/38688#issuecomment-4545254872

   cc'ed @derrickaw 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add fallback platforms for stager [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #38688:
URL: https://github.com/apache/beam/pull/38688#discussion_r3301059314


##########
sdks/python/apache_beam/runners/portability/stager.py:
##########
@@ -781,23 +787,54 @@ def _populate_requirements_cache(
       ]
 
       if populate_cache_with_sdists:
-        cmd_args.extend(['--no-binary', ':all:'])
+        download_dir = tempfile.mkdtemp(dir=temp_directory)
+        cmd_args.extend(['--dest', download_dir, '--no-binary', ':all:'])
+        _LOGGER.info('Executing command: %s', cmd_args)
+        processes.check_output(cmd_args, stderr=processes.STDOUT)
       else:
         language_implementation_tag = 'cp'
         abi_suffix = 'm' if sys.version_info < (3, 8) else ''
         abi_tag = 'cp%d%d%s' % (
             sys.version_info[0], sys.version_info[1], abi_suffix)
-        platform_tag = Stager._get_platform_for_default_sdk_container()
-        cmd_args.extend([
-            '--implementation',
-            language_implementation_tag,
-            '--abi',
-            abi_tag,
-            '--platform',
-            platform_tag
-        ])
-      _LOGGER.info('Executing command: %s', cmd_args)
-      processes.check_output(cmd_args, stderr=processes.STDOUT)
+        preferred_platform = Stager._get_platform_for_default_sdk_container()
+
+        # Fallback platform tags in case the preferred modern tag is too strict
+        # for some dependencies on PyPI.
+        try:
+          start_idx = _MANYLINUX_PLATFORMS.index(preferred_platform)
+          platforms = _MANYLINUX_PLATFORMS[start_idx:]
+        except ValueError:
+          platforms = [preferred_platform]

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   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.
   
   ```suggestion
           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]
   ```



##########
sdks/python/apache_beam/runners/portability/stager.py:
##########
@@ -88,6 +88,14 @@
 # One of the choices for user to use for requirements cache during staging
 SKIP_REQUIREMENTS_CACHE = 'skip'
 
+# Ordered list of manylinux tags from newest (strictest) to oldest (most compatible)
+# used for cross-platform binary dependency downloads.
+_MANYLINUX_PLATFORMS = [
+    'manylinux_2_28_x86_64',
+    'manylinux2014_x86_64',  # equivalent to manylinux_2_17
+    'manylinux2010_x86_64',  # equivalent to manylinux_2_12
+]

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   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.
   
   ```suggestion
   _MANYLINUX_BASE_TAGS = [
       'manylinux_2_28',
       'manylinux2014',  # equivalent to manylinux_2_17
       'manylinux2010',  # equivalent to manylinux_2_12
   ]
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add fallback platforms for stager [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on PR #38688:
URL: https://github.com/apache/beam/pull/38688#issuecomment-4545019547

   r: @claudevdm 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add fallback platforms for stager [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on code in PR #38688:
URL: https://github.com/apache/beam/pull/38688#discussion_r3304490339


##########
sdks/python/apache_beam/runners/portability/stager.py:
##########
@@ -88,6 +88,14 @@
 # One of the choices for user to use for requirements cache during staging
 SKIP_REQUIREMENTS_CACHE = 'skip'
 
+# Ordered list of manylinux tags from newest (strictest) to oldest (most compatible)
+# used for cross-platform binary dependency downloads.
+_MANYLINUX_PLATFORMS = [
+    'manylinux_2_28_x86_64',
+    'manylinux2014_x86_64',  # equivalent to manylinux_2_17
+    'manylinux2010_x86_64',  # equivalent to manylinux_2_12
+]

Review Comment:
   Let's focus on x86_64 in this PR, since we have never considered aarch64 in stager.py before.



##########
sdks/python/apache_beam/runners/portability/stager.py:
##########
@@ -781,23 +787,54 @@ def _populate_requirements_cache(
       ]
 
       if populate_cache_with_sdists:
-        cmd_args.extend(['--no-binary', ':all:'])
+        download_dir = tempfile.mkdtemp(dir=temp_directory)
+        cmd_args.extend(['--dest', download_dir, '--no-binary', ':all:'])
+        _LOGGER.info('Executing command: %s', cmd_args)
+        processes.check_output(cmd_args, stderr=processes.STDOUT)
       else:
         language_implementation_tag = 'cp'
         abi_suffix = 'm' if sys.version_info < (3, 8) else ''
         abi_tag = 'cp%d%d%s' % (
             sys.version_info[0], sys.version_info[1], abi_suffix)
-        platform_tag = Stager._get_platform_for_default_sdk_container()
-        cmd_args.extend([
-            '--implementation',
-            language_implementation_tag,
-            '--abi',
-            abi_tag,
-            '--platform',
-            platform_tag
-        ])
-      _LOGGER.info('Executing command: %s', cmd_args)
-      processes.check_output(cmd_args, stderr=processes.STDOUT)
+        preferred_platform = Stager._get_platform_for_default_sdk_container()
+
+        # Fallback platform tags in case the preferred modern tag is too strict
+        # for some dependencies on PyPI.
+        try:
+          start_idx = _MANYLINUX_PLATFORMS.index(preferred_platform)
+          platforms = _MANYLINUX_PLATFORMS[start_idx:]
+        except ValueError:
+          platforms = [preferred_platform]

Review Comment:
   Let's focus on x86_64 in this PR, since we have never considered aarch64 in stager.py before.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enforce binary-only constraints during early requirements cache attempts [beam]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #38688:
URL: https://github.com/apache/beam/pull/38688#issuecomment-4545579655

   ## [Codecov](https://app.codecov.io/gh/apache/beam/pull/38688?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `63.33333%` with `11 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 58.39%. Comparing base ([`d901481`](https://app.codecov.io/gh/apache/beam/commit/d901481e8512fcb4adf0bd50c1fe272d5aa2aec0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`bb20201`](https://app.codecov.io/gh/apache/beam/commit/bb20201d69601aaa2d6cef92cd4b48e6352e5109?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 11 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/beam/pull/38688?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...s/python/apache\_beam/runners/portability/stager.py](https://app.codecov.io/gh/apache/beam/pull/38688?src=pr&el=tree&filepath=sdks%2Fpython%2Fapache_beam%2Frunners%2Fportability%2Fstager.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy9wb3J0YWJpbGl0eS9zdGFnZXIucHk=) | 63.33% | [11 Missing :warning: ](https://app.codecov.io/gh/apache/beam/pull/38688?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff            @@
   ##             master   #38688   +/-   ##
   =========================================
     Coverage     58.38%   58.39%           
     Complexity    14637    14637           
   =========================================
     Files          2725     2725           
     Lines        271438   271498   +60     
     Branches      11884    11884           
   =========================================
   + Hits         158490   158539   +49     
   - Misses       106801   106812   +11     
     Partials       6147     6147           
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/beam/pull/38688/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [python](https://app.codecov.io/gh/apache/beam/pull/38688/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `79.87% <63.33%> (+<0.01%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/beam/pull/38688?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add fallback platforms for stager [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #38688:
URL: https://github.com/apache/beam/pull/38688#issuecomment-4540181375

   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).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enforce binary-only constraints during early requirements cache attempts [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping merged PR #38688:
URL: https://github.com/apache/beam/pull/38688


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org