mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
93 lines
3.0 KiB
Bash
Executable File
93 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
export FAIRMQ_PATH=@FAIRMQ_BIN_DIR@
|
|
|
|
transport="zeromq"
|
|
|
|
if [[ $1 =~ ^[a-z]+$ ]]; then
|
|
transport=$1
|
|
fi
|
|
|
|
session="$(@CMAKE_BINARY_DIR@/fairmq/fairmq-uuid-gen -h)"
|
|
chan1="data1"
|
|
chan2="data2"
|
|
chan1Addr="/tmp/fmq_$session""_""$chan1""_""$transport"
|
|
chan2Addr="/tmp/fmq_$session""_""$chan2""_""$transport"
|
|
|
|
# setup a trap to kill everything if the test fails/timeouts
|
|
trap 'set +e; kill -TERM $SAMPLER_PID; kill -TERM $SINK_PID; kill -TERM $PROCESSOR1_PID; kill -TERM $PROCESSOR2_PID; wait $SAMPLER_PID; wait $SINK_PID; wait $PROCESSOR1_PID; wait $PROCESSOR2_PID; rm $chan1Addr; rm $chan2Addr; exit 0' TERM
|
|
|
|
SAMPLER="fairmq-ex-1-n-1-sampler"
|
|
SAMPLER+=" --id sampler1"
|
|
SAMPLER+=" --transport $transport"
|
|
SAMPLER+=" --verbosity veryhigh"
|
|
SAMPLER+=" --session $session"
|
|
SAMPLER+=" --severity debug"
|
|
SAMPLER+=" --shm-segment-size 100000000"
|
|
SAMPLER+=" --shm-monitor true"
|
|
SAMPLER+=" --control static --color false"
|
|
SAMPLER+=" --max-iterations 2"
|
|
SAMPLER+=" --channel-config name=$chan1,type=push,method=bind,address=ipc://$chan1Addr,rateLogging=0"
|
|
@CMAKE_CURRENT_BINARY_DIR@/$SAMPLER &
|
|
SAMPLER_PID=$!
|
|
|
|
PROCESSOR1="fairmq-ex-1-n-1-processor"
|
|
PROCESSOR1+=" --id processor1"
|
|
PROCESSOR1+=" --transport $transport"
|
|
PROCESSOR1+=" --verbosity veryhigh"
|
|
PROCESSOR1+=" --session $session"
|
|
PROCESSOR1+=" --severity debug"
|
|
PROCESSOR1+=" --shm-segment-size 100000000"
|
|
PROCESSOR1+=" --shm-monitor true"
|
|
PROCESSOR1+=" --control static --color false"
|
|
PROCESSOR1+=" --channel-config name=$chan1,type=pull,method=connect,address=ipc://$chan1Addr,rateLogging=0"
|
|
PROCESSOR1+=" name=$chan2,type=push,method=connect,address=ipc://$chan2Addr,rateLogging=0"
|
|
@CMAKE_CURRENT_BINARY_DIR@/$PROCESSOR1 &
|
|
PROCESSOR1_PID=$!
|
|
|
|
PROCESSOR2="fairmq-ex-1-n-1-processor"
|
|
PROCESSOR2+=" --id processor2"
|
|
PROCESSOR2+=" --transport $transport"
|
|
PROCESSOR2+=" --verbosity veryhigh"
|
|
PROCESSOR2+=" --session $session"
|
|
PROCESSOR2+=" --severity debug"
|
|
PROCESSOR2+=" --shm-segment-size 100000000"
|
|
PROCESSOR2+=" --shm-monitor true"
|
|
PROCESSOR2+=" --control static --color false"
|
|
PROCESSOR2+=" --channel-config name=$chan1,type=pull,method=connect,address=ipc://$chan1Addr,rateLogging=0"
|
|
PROCESSOR2+=" name=$chan2,type=push,method=connect,address=ipc://$chan2Addr,rateLogging=0"
|
|
@CMAKE_CURRENT_BINARY_DIR@/$PROCESSOR2 &
|
|
PROCESSOR2_PID=$!
|
|
|
|
SINK="fairmq-ex-1-n-1-sink"
|
|
SINK+=" --id sink1"
|
|
SINK+=" --transport $transport"
|
|
SINK+=" --verbosity veryhigh"
|
|
SINK+=" --session $session"
|
|
SINK+=" --severity debug"
|
|
SINK+=" --shm-segment-size 100000000"
|
|
SINK+=" --shm-monitor true"
|
|
SINK+=" --control static --color false"
|
|
SINK+=" --max-iterations 2"
|
|
SINK+=" --channel-config name=$chan2,type=pull,method=bind,address=ipc://$chan2Addr,rateLogging=0"
|
|
@CMAKE_CURRENT_BINARY_DIR@/$SINK &
|
|
SINK_PID=$!
|
|
|
|
# wait for sampler and sink to finish
|
|
wait $SAMPLER_PID
|
|
wait $SINK_PID
|
|
|
|
# stop processors
|
|
kill -SIGINT $PROCESSOR1_PID
|
|
kill -SIGINT $PROCESSOR2_PID
|
|
|
|
# wait for everything to finish
|
|
wait $PROCESSOR1_PID
|
|
wait $PROCESSOR2_PID
|
|
|
|
set +e
|
|
rm $chan1Addr; rm $chan2Addr
|
|
exit 0
|