You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by an...@apache.org on 2024/02/04 17:21:15 UTC

(beam) branch master updated: Try a different approach for cibuildwheel flake. (#30204)

This is an automated email from the ASF dual-hosted git repository.

anandinguva 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 34bbbda9f98 Try a different approach for cibuildwheel flake. (#30204)
34bbbda9f98 is described below

commit 34bbbda9f9822301d1186a5d524480bcd8fbfa43
Author: tvalentyn <tv...@users.noreply.github.com>
AuthorDate: Sun Feb 4 09:21:09 2024 -0800

    Try a different approach for cibuildwheel flake. (#30204)
---
 sdks/python/build.gradle | 37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/sdks/python/build.gradle b/sdks/python/build.gradle
index ab6f75fc653..7f2bc7f5d42 100644
--- a/sdks/python/build.gradle
+++ b/sdks/python/build.gradle
@@ -94,17 +94,32 @@ platform_identifiers_map.each { platform, idsuffix ->
 
       // generated installable Python SDK package
       doLast {
-        exec {
-          environment CIBW_BUILD: "cp${pyversion}-${idsuffix}"
-          environment CIBW_ENVIRONMENT: "SETUPTOOLS_USE_DISTUTILS=stdlib"
-          // note: sync cibuildwheel version with GitHub Action
-          // .github/workflow/build_wheel.yml:build_wheels "Install cibuildwheel" step
-          // note(https://github.com/pypa/cibuildwheel/issues/1692): cibuildwheel appears to timeout occasionally.
-          executable 'sh'
-          args '-c', ". ${envdir}/bin/activate && " +
-              "pip install cibuildwheel==2.9.0 && " +
-              "cibuildwheel --print-build-identifiers --platform ${platform} --archs ${archs} && " +
-              "for i in {1..3}; do cibuildwheel --output-dir ${buildDir} --platform ${platform} --archs ${archs} && break; done"
+        int maxRetries = 3
+        int retryCount = 0
+        // note(https://github.com/pypa/cibuildwheel/issues/1692): cibuildwheel appears to timeout occasionally.
+        while (retryCount < maxRetries) {
+          try {
+            exec {
+             environment CIBW_BUILD: "cp${pyversion}-${idsuffix}"
+             environment CIBW_ENVIRONMENT: "SETUPTOOLS_USE_DISTUTILS=stdlib"
+             executable 'sh'
+             args '-c', ". ${envdir}/bin/activate && " +
+                 // note: sync cibuildwheel version with GitHub Action
+                 // .github/workflows/build_wheel.yml:build_wheels "Install cibuildwheel" step
+                 "pip install cibuildwheel==2.9.0 && " +
+                 "cibuildwheel --print-build-identifiers --platform ${platform} --archs ${archs} && " +
+                 "cibuildwheel --output-dir ${buildDir} --platform ${platform} --archs ${archs} "
+           }
+           break;
+         }
+         catch (Exception e) {
+            retryCount++
+            if (retryCount < maxRetries) {
+                println "cibuildwheel failed on attempt ${retryCount}. Will retry."
+            } else {
+                throw e
+            }
+         }
         }
       }
     }