mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
91 lines
3.0 KiB
Bash
Executable File
91 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
################################################################################
|
|
# Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
|
# #
|
|
# This software is distributed under the terms of the #
|
|
# GNU Lesser General Public Licence (LGPL) version 3, #
|
|
# copied verbatim in the file "LICENSE" #
|
|
################################################################################
|
|
|
|
# fairmq-start-ex-dds.sh [localhost] -> submit agents with localhost plugin
|
|
# fairmq-start-ex-dds.sh ssh -> submit agents with ssh plugin
|
|
|
|
set -e
|
|
|
|
cleanup() {
|
|
dds-session stop $1
|
|
echo "CLEANUP PERFORMED"
|
|
}
|
|
|
|
if [[ -e "@DDS_INSTALL_PREFIX@/DDS_env.sh" ]]; then
|
|
source @DDS_INSTALL_PREFIX@/DDS_env.sh
|
|
elif command -v DDS_env.sh &> /dev/null; then
|
|
source DDS_env.sh
|
|
fi
|
|
|
|
export PATH=@BIN_DIR@:$PATH
|
|
|
|
plugin=${1:-localhost}
|
|
|
|
exec 5>&1
|
|
output=$(dds-session start | tee >(cat - >&5))
|
|
export DDS_SESSION_ID=$(echo ${output} | grep "DDS session ID: " | cut -d' ' -f4)
|
|
echo "SESSION ID: ${DDS_SESSION_ID}"
|
|
|
|
trap "cleanup ${DDS_SESSION_ID}" EXIT
|
|
|
|
requiredNofSlots=12
|
|
if [[ "$plugin" == "ssh" ]]; then
|
|
dds-submit -r ${plugin} -c @DATA_DIR@/ex-dds-hosts.cfg
|
|
else
|
|
dds-submit -r ${plugin} --slots ${requiredNofSlots}
|
|
fi
|
|
echo "...waiting for ${requiredNofSlots} idle slots..."
|
|
dds-info --idle-count --wait ${requiredNofSlots}
|
|
|
|
export FAIRMQ_DDS_TOPO_FILE=@DATA_DIR@/ex-dds-topology.xml
|
|
echo "TOPOLOGY FILE: ${FAIRMQ_DDS_TOPO_FILE}"
|
|
echo "TOPOLOGY NAME: $(dds-topology --disable-validation --topology-name ${FAIRMQ_DDS_TOPO_FILE})"
|
|
|
|
dds-info --active-topology
|
|
dds-topology --activate ${FAIRMQ_DDS_TOPO_FILE}
|
|
dds-info --active-topology
|
|
echo "...waiting for ${requiredNofSlots} executing slots..."
|
|
dds-info --executing-count --wait ${requiredNofSlots}
|
|
|
|
echo "------------------------"
|
|
echo "...waiting for Topology to finish..."
|
|
fairmq-dds-command-ui -w "IDLE"
|
|
fairmq-dds-command-ui -c i
|
|
fairmq-dds-command-ui -c k
|
|
fairmq-dds-command-ui -c b
|
|
fairmq-dds-command-ui -c x
|
|
fairmq-dds-command-ui -c j
|
|
fairmq-dds-command-ui -c r
|
|
sampler_and_sink="main/(Sampler|Sink).*"
|
|
fairmq-dds-command-ui -w "RUNNING->READY" -p $sampler_and_sink
|
|
echo "...$sampler_and_sink are READY, sending shutdown..."
|
|
fairmq-dds-command-ui -c s
|
|
fairmq-dds-command-ui -c t
|
|
fairmq-dds-command-ui -c d
|
|
fairmq-dds-command-ui -c q
|
|
echo "...waiting for ${requiredNofSlots} idle slots..."
|
|
dds-info --idle-count --wait ${requiredNofSlots}
|
|
echo "------------------------"
|
|
|
|
dds-info --active-topology
|
|
dds-topology --stop
|
|
dds-info --active-topology
|
|
|
|
# TODO Simplify, see https://github.com/FairRootGroup/DDS/issues/369
|
|
if dds-agent-cmd getlog -a; then
|
|
logDir=$(eval "echo $(dds-user-defaults --key server.sandbox_dir)/log/agents")
|
|
echo "AGENT LOG FILES IN: ${logDir}"
|
|
fi
|
|
|
|
# This string is used by ctest to detect success
|
|
echo "Example successful :)"
|
|
|
|
# Cleanup function is called by EXIT trap
|