From 3a04868d64d15acc1cb398d3fd47b6639915aa4b Mon Sep 17 00:00:00 2001 From: xingbo Date: Sun, 18 Feb 2024 15:26:17 +0800 Subject: [PATCH] [FLINK-34202][python] Optimize Python nightly CI time --- flink-python/dev/lint-python.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/flink-python/dev/lint-python.sh b/flink-python/dev/lint-python.sh index 00230799817f5..acabe908b5e2f 100755 --- a/flink-python/dev/lint-python.sh +++ b/flink-python/dev/lint-python.sh @@ -605,7 +605,16 @@ function tox_check() { # Only run test in latest python version triggered by a Git push $TOX_PATH -vv -c $FLINK_PYTHON_DIR/tox.ini -e ${LATEST_PYTHON} --recreate 2>&1 | tee -a $LOG_FILE else - $TOX_PATH -vv -c $FLINK_PYTHON_DIR/tox.ini --recreate 2>&1 | tee -a $LOG_FILE + # Only run random selected python version in nightly CI. + ENV_LIST_STRING=`$TOX_PATH -l -c $FLINK_PYTHON_DIR/tox.ini` + _OLD_IFS=$IFS + IFS=$'\n' + ENV_LIST=(${ENV_LIST_STRING}) + IFS=$_OLD_IFS + + ENV_LIST_SIZE=${#ENV_LIST[@]} + index=$(($RANDOM % ENV_LIST_SIZE)) + $TOX_PATH -vv -c $FLINK_PYTHON_DIR/tox.ini -e ${ENV_LIST[$index]} --recreate 2>&1 | tee -a $LOG_FILE fi TOX_RESULT=$((grep -c "congratulations :)" "$LOG_FILE") 2>&1)