ifndef-SleePy commented on a change in pull request #11831: URL: https://github.com/apache/flink/pull/11831#discussion_r415003793
########## File path: flink-end-to-end-tests/test-scripts/common_ha.sh ########## @@ -23,10 +23,9 @@ source "${END_TO_END_DIR}"/test-scripts/common.sh # flag indicating if we have already cleared up things after a test CLEARED=0 -JM_WATCHDOG_PID=0 Review comment: Just a curiosity, what's the reason of this change? ########## File path: flink-end-to-end-tests/test-scripts/test_ha_datastream.sh ########## @@ -100,4 +102,21 @@ STATE_BACKEND_FILE_ASYNC=${2:-true} STATE_BACKEND_ROCKS_INCREMENTAL=${3:-false} ZOOKEEPER_VERSION=${4:-3.4} -run_ha_test 4 ${STATE_BACKEND_TYPE} ${STATE_BACKEND_FILE_ASYNC} ${STATE_BACKEND_ROCKS_INCREMENTAL} ${ZOOKEEPER_VERSION} +function kill_test_watchdog() { + local watchdog_pid=`cat $TEST_DATA_DIR/job_watchdog.pid` + echo "Stopping job timeout watchdog (with pid=$watchdog_pid)" + kill $watchdog_pid +} +on_exit kill_test_watchdog + +( + cmdpid=$BASHPID; Review comment: `BASHPID` does not work on my Mac. It's introduced in Bash 4, however the version of Bash on my Mac is 3.2. Maybe we could use `$$` when `BASHPID` is not supported? `$$` is more general, however sometimes it does not work well as expected, like executing in background. ########## File path: flink-end-to-end-tests/test-scripts/test_ha_per_job_cluster_datastream.sh ########## @@ -148,4 +149,23 @@ STATE_BACKEND_TYPE=${1:-file} STATE_BACKEND_FILE_ASYNC=${2:-true} STATE_BACKEND_ROCKS_INCREMENTAL=${3:-false} -run_ha_test 4 ${STATE_BACKEND_TYPE} ${STATE_BACKEND_FILE_ASYNC} ${STATE_BACKEND_ROCKS_INCREMENTAL} +function kill_test_watchdog() { + local watchdog_pid=`cat $TEST_DATA_DIR/job_watchdog.pid` + echo "Stopping job timeout watchdog (with pid=$watchdog_pid)" + kill $watchdog_pid +} +on_exit kill_test_watchdog + +( + cmdpid=$BASHPID; + (sleep $TEST_TIMEOUT_SECONDS; # set a timeout of 10 minutes for this test + echo "Test (pid: $cmdpid) did not finish after $TEST_TIMEOUT_SECONDS seconds." + echo "Printing Flink logs and killing it:" + cat ${FLINK_DIR}/log/* + kill "$cmdpid") & watchdog_pid=$! Review comment: Another curiosity, is there any magic of inline `watchdog_pid=$!`? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org