You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by di...@apache.org on 2020/05/08 01:32:08 UTC
[flink] branch release-1.10 updated: [FLINK-17092][python] Add
retry when pip install dependencies (#12024)
This is an automated email from the ASF dual-hosted git repository.
dianfu 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 62c0589 [FLINK-17092][python] Add retry when pip install dependencies (#12024)
62c0589 is described below
commit 62c058984d4212a70c6b61c8ca09052fa90ce8c3
Author: Shuiqiang Chen <ac...@alibaba-inc.com>
AuthorDate: Fri May 8 09:29:37 2020 +0800
[FLINK-17092][python] Add retry when pip install dependencies (#12024)
---
flink-python/pyflink/fn_execution/boot.py | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/flink-python/pyflink/fn_execution/boot.py b/flink-python/pyflink/fn_execution/boot.py
index 51db49f..d374397 100644
--- a/flink-python/pyflink/fn_execution/boot.py
+++ b/flink-python/pyflink/fn_execution/boot.py
@@ -112,14 +112,24 @@ def pip_install_requirements():
if requirements_cache_path is not None:
pip_install_commands.extend(["--find-links", requirements_cache_path])
- logging.info("Run command: %s\n" % " ".join(pip_install_commands))
- exit_code = call(
- pip_install_commands, stdout=sys.stdout, stderr=sys.stderr, env=env)
- if exit_code > 0:
- raise Exception(
- "Run command: %s error! exit code: %d" %
- (" ".join(pip_install_commands), exit_code))
-
+ max_retry_times = 3
+ cur_retry = 0
+ while cur_retry < max_retry_times:
+ cur_retry += 1
+ logging.info("Run command: %s with retry (%d/%d)\n" % (" ".join(pip_install_commands),
+ cur_retry, max_retry_times))
+ exit_code = call(
+ pip_install_commands, stdout=sys.stdout, stderr=sys.stderr, env=env)
+ if exit_code != 0:
+ if cur_retry < max_retry_times:
+ logging.error("Run command: %s error! exit code: %d. Retry to run again!" %
+ (" ".join(pip_install_commands), exit_code))
+ else:
+ raise Exception(
+ "Run command: %s error! exit code: %d. Max retry times exhausted!" %
+ (" ".join(pip_install_commands), exit_code))
+ else:
+ break
os.environ["PYTHONPATH"] = env["PYTHONPATH"]
os.environ["PATH"] = env["PATH"]