Github user twalthr commented on a diff in the pull request:
https://github.com/apache/flink/pull/5750#discussion_r177343482
--- Diff: flink-end-to-end-tests/test-scripts/common.sh ---
@@ -59,9 +162,42 @@ function start_cluster {
done
}
+function jm_watchdog() {
+ expectedJms=$1
+ ipPort=$2
+
+ while true; do
+ runningJms=`jps | grep -o 'StandaloneSessionClusterEntrypoint' |
wc -l`;
+ missingJms=$((expectedJms-runningJms))
+ for (( c=0; c<missingJms; c++ )); do
+ "$FLINK_DIR"/bin/jobmanager.sh start "localhost" ${ipPort}
+ done
+ sleep 5;
+ done
+}
+
+function kill_jm {
+ idx=$1
+
+ jm_pids=`jps | grep 'StandaloneSessionClusterEntrypoint' | cut -d " "
-f 1`
+ jm_pids=(${jm_pids[@]})
+
+ pid=${jm_pids[$idx]}
+
+ # kill the JM and wait for the completion of its termination
+ kill -9 ${pid}
+
+ echo "Killed JM @ ${pid}."
+}
+
function stop_cluster {
"$FLINK_DIR"/bin/stop-cluster.sh
+ # stop zookeeper only if there are processes running
--- End diff --
I would move this to a `stop_ha_cluster` function. Btw we also don't call
`stop-zookeeper-quorum.sh`.
---