This is an automated email from the ASF dual-hosted git repository. hxb pushed a commit to branch release-1.15 in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.15 by this push: new 23070648898 [FLINK-28355][python][e2e] Clean up python environment after e2e tests 23070648898 is described below commit 230706488987d9ae96154ddf95247fc293e2bc6c Author: huangxingbo <h...@apache.org> AuthorDate: Wed Jul 6 01:33:22 2022 +0800 [FLINK-28355][python][e2e] Clean up python environment after e2e tests --- .../test_kubernetes_pyflink_application.sh | 6 ++++++ flink-end-to-end-tests/test-scripts/test_pyflink.sh | 3 +++ .../test-scripts/test_pyflink_yarn.sh | 6 ++++++ flink-python/dev/lint-python.sh | 19 ++++++++++++++++++- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/flink-end-to-end-tests/test-scripts/test_kubernetes_pyflink_application.sh b/flink-end-to-end-tests/test-scripts/test_kubernetes_pyflink_application.sh index a7b6c93a548..ff84554dee8 100755 --- a/flink-end-to-end-tests/test-scripts/test_kubernetes_pyflink_application.sh +++ b/flink-end-to-end-tests/test-scripts/test_kubernetes_pyflink_application.sh @@ -118,3 +118,9 @@ wait_rest_endpoint_up_k8s $jm_pod_name # instead of checking the result kubectl logs -f $jm_pod_name >$LOCAL_LOGS_PATH/jobmanager.log grep -E "Job [A-Za-z0-9]+ reached terminal state FINISHED" $LOCAL_LOGS_PATH/jobmanager.log + +# clean up python env +"${FLINK_PYTHON_DIR}/dev/lint-python.sh" -r + +# clean up apache-flink-libraries +rm -rf "${FLINK_PYTHON_DIR}/apache-flink-libraries/dist/${PYFLINK_LIBRARIES_PACKAGE_FILE}" diff --git a/flink-end-to-end-tests/test-scripts/test_pyflink.sh b/flink-end-to-end-tests/test-scripts/test_pyflink.sh index 54dd42a58fa..a8729170ae2 100755 --- a/flink-end-to-end-tests/test-scripts/test_pyflink.sh +++ b/flink-end-to-end-tests/test-scripts/test_pyflink.sh @@ -271,3 +271,6 @@ if [[ "${EXPECTED_MSG[*]}" != "${SORTED_READ_MSG[*]}" ]]; then echo -e "ACTUAL: --${SORTED_READ_MSG[*]}--" exit 1 fi + +# clean up python env +"${FLINK_PYTHON_DIR}/dev/lint-python.sh" -r diff --git a/flink-end-to-end-tests/test-scripts/test_pyflink_yarn.sh b/flink-end-to-end-tests/test-scripts/test_pyflink_yarn.sh index bd8d3300942..2a5e8375b7d 100755 --- a/flink-end-to-end-tests/test-scripts/test_pyflink_yarn.sh +++ b/flink-end-to-end-tests/test-scripts/test_pyflink_yarn.sh @@ -75,3 +75,9 @@ docker exec master bash -c "export HADOOP_CLASSPATH=\`hadoop classpath\` && \ -pyexec venv.zip/.conda/bin/python \ -py /tmp/python_job.py \ pipeline.jars file:/tmp/PythonUdfSqlJobExample.jar" + +# clean up python env +"${FLINK_PYTHON_DIR}/dev/lint-python.sh" -r + +# clean up apache-flink-libraries +rm -rf "${FLINK_PYTHON_DIR}/apache-flink-libraries/dist/${PYFLINK_LIBRARIES_PACKAGE_FILE}" diff --git a/flink-python/dev/lint-python.sh b/flink-python/dev/lint-python.sh index 789720208ec..b69764f1412 100755 --- a/flink-python/dev/lint-python.sh +++ b/flink-python/dev/lint-python.sh @@ -755,6 +755,10 @@ SUPPORTED_INSTALLATION_COMPONENTS=() get_all_supported_install_components INSTALLATION_COMPONENTS=() + +# whether remove the installed python environment. +CLEAN_UP_FLAG=0 + # parse_opts USAGE=" usage: $0 [options] @@ -781,8 +785,9 @@ Examples: ./lint-python => exec all checks. ./lint-python -f => reinstall environment with all components and exec all checks. ./lint-python -l => list all checks supported. + ./lint-python -r => clean up python environment. " -while getopts "hfs:i:e:l" arg; do +while getopts "hfs:i:e:lr" arg; do case "$arg" in h) printf "%s\\n" "$USAGE" @@ -807,6 +812,10 @@ while getopts "hfs:i:e:l" arg; do done exit 2 ;; + r) + printf "clean up python environment:\n" + CLEAN_UP_FLAG=1 + ;; ?) printf "ERROR: did not recognize option '%s', please try -h\\n" "$1" exit 1 @@ -816,6 +825,14 @@ done # decides whether to skip check stage skip_checks=0 + +if [[ ${CLEAN_UP_FLAG} -eq 1 ]]; then + rm -rf ${CONDA_HOME} + rm -rf ${STAGE_FILE} + rm -rf ${FLINK_PYTHON_DIR}/.tox + skip_checks=1 +fi + if [ ! -z "$INSTALLATION_COMPONENTS" ]; then parse_component_args skip_checks=1