Skip to content

Commit 6b72e5e

Browse files
committed
Update run.sh
1 parent 1f5046e commit 6b72e5e

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

tests/soak/run.sh

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/bash
2-
#
32

4-
set -e
53
source venv/bin/activate
64

75
librdkafka_version=$(python3 -c 'from confluent_kafka import libversion; print(libversion()[0])')
@@ -11,22 +9,25 @@ if [[ -z $librdkafka_version ]]; then
119
exit 1
1210
fi
1311

14-
if [[ -z $STY ]]; then
15-
echo "This script should be run from inside a screen session"
16-
exit 1
17-
fi
18-
1912
set -u
2013
topic="pysoak-$TESTID-$librdkafka_version"
21-
logfile="${topic}.log.bz2"
22-
23-
24-
echo "Starting soak client using topic $topic"
14+
logfile="${TESTID}.log.bz2"
15+
export HOSTNAME=$(hostname)
16+
echo "Starting soak client using topic $topic. Logging to $logfile."
2517
set +x
26-
time confluent-kafka-python/tests/soak/soakclient.py -t $topic -r 80 -f confluent-kafka-python/ccloud.config 2>&1 \
27-
| tee /dev/stderr | bzip2 > $logfile
18+
# Ignore SIGINT in children (inherited)
19+
trap "" SIGINT
20+
time opentelemetry-instrument confluent-kafka-python/tests/soak/soakclient.py -i $TESTID -t $topic -r 80 -f $1 |& tee /dev/tty | bzip2 > $logfile &
21+
PID=$!
22+
# On SIGINT kill only the first process of the pipe
23+
onsigint() {
24+
# List children of $PID only
25+
ps --ppid $PID -f | grep soakclient.py | grep -v grep | awk '{print $2}' | xargs kill
26+
}
27+
trap onsigint SIGINT
28+
# Await the result
29+
wait $PID
2830
ret=$?
2931
echo "Python client exited with status $ret"
32+
echo "Ending soak client using topic $topic. Logging to $logfile."
3033
exit $ret
31-
32-

0 commit comments

Comments
 (0)