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

hequn pushed a commit to branch release-1.10
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.10 by this push:
     new 729e87c  [FLINK-14944][python] Fix pip install ConnectionResetError
729e87c is described below

commit 729e87cf3371d8b42383564d45caaf4518afc4c9
Author: huangxingbo <[email protected]>
AuthorDate: Mon Dec 16 19:44:40 2019 +0800

    [FLINK-14944][python] Fix pip install ConnectionResetError
    
    Add retry logic for pip install to fix the possible ConnectionResetError
    when downloading python packages on high-speed networks.
    
    This closes #10613.
---
 flink-python/{tox.ini => dev/install_command.sh} | 36 +++++++++---------------
 flink-python/tox.ini                             |  4 +++
 2 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/flink-python/tox.ini b/flink-python/dev/install_command.sh
old mode 100644
new mode 100755
similarity index 53%
copy from flink-python/tox.ini
copy to flink-python/dev/install_command.sh
index 7b5c571..f914200
--- a/flink-python/tox.ini
+++ b/flink-python/dev/install_command.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
 
################################################################################
 #  Licensed to the Apache Software Foundation (ASF) under one
 #  or more contributor license agreements.  See the NOTICE file
@@ -15,27 +16,16 @@
 #  See the License for the specific language governing permissions and
 # limitations under the License.
 
################################################################################
+retry_times=3
+install_command="python -m pip install $@"
+${install_command}
+status=$?
+while [[ ${status} -ne 0 ]] && [[ ${retry_times} -gt 0 ]]; do
+    retry_times=$((retry_times-1))
+    # sleep 3 seconds and then reinstall.
+    sleep 3
+    ${install_command}
+    status=$?
+done
 
-[tox]
-# tox (https://tox.readthedocs.io/) is a tool for running tests
-# in multiple virtualenvs. This configuration file will run the
-# test suite on all supported python versions.
-# new environments will be excluded by default unless explicitly added to 
envlist.
-envlist = py35, py36, py37
-
-[testenv]
-whitelist_externals=
-    /bin/bash
-deps =
-    pytest
-commands =
-    python --version
-    pytest --durations=0
-    bash ./dev/run_pip_test.sh
-
-[flake8]
-# We follow PEP 8 (https://www.python.org/dev/peps/pep-0008/) with one 
exception: lines can be
-# up to 100 characters in length, not 79.
-ignore=E226,E241,E305,E402,E722,E731,E741,W503,W504
-max-line-length=100
-exclude=.tox/*,dev/*,lib/*,target/*,build/*,dist/*,pyflink/shell.py,.eggs/*,pyflink/fn_execution/tests/process_mode_test_data.py,pyflink/fn_execution/*_pb2.py
+exit ${status}
diff --git a/flink-python/tox.ini b/flink-python/tox.ini
index 7b5c571..058f4f1 100644
--- a/flink-python/tox.ini
+++ b/flink-python/tox.ini
@@ -28,10 +28,14 @@ whitelist_externals=
     /bin/bash
 deps =
     pytest
+    grpcio-tools>=1.3.5,<=1.14.2
 commands =
     python --version
     pytest --durations=0
     bash ./dev/run_pip_test.sh
+# Replace the default installation command with a custom retry installation 
script, because on high-speed
+# networks, downloading a package may raise a ConnectionResetError: [Errno 
104] Peer reset connection.
+install_command = {toxinidir}/dev/install_command.sh {opts} {packages}
 
 [flake8]
 # We follow PEP 8 (https://www.python.org/dev/peps/pep-0008/) with one 
exception: lines can be

Reply via email to