#!/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" } source @DDS_INSTALL_PREFIX@/DDS_env.sh 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 requiredNofAgents=12 if [[ "$plugin" == "ssh" ]]; then dds-submit -r ${plugin} -c @DATA_DIR@/ex-dds-hosts.cfg else dds-submit -r ${plugin} -n ${requiredNofAgents} fi echo "...waiting for ${requiredNofAgents} idle agents..." dds-info --wait-for-idle-agents ${requiredNofAgents} topologyFile=@DATA_DIR@/ex-dds-topology.xml echo "TOPOLOGY FILE: ${topologyFile}" # TODO Uncomment once DDS 2.6 is released # echo "TOPOLOGY NAME: $(dds-topology --disable-validation --topology-name ${topologyFile})" # TODO Uncomment once DDS 2.6 is released # dds-info --active-topology dds-topology --activate ${topologyFile} # dds-info --active-topology # dds-info --wait-for-executing-agents ${requiredNofAgents} sleep 1 echo "------------------------" echo "...waiting for Topology to finish..." # TODO Retrieve number of devices from DDS topology API instead of having the user pass it explicitely fairmq-dds-command-ui -w "IDLE" -n ${requiredNofAgents} fairmq-dds-command-ui -c i -w "INITIALIZING DEVICE" -n ${requiredNofAgents} fairmq-dds-command-ui -c k -w "INITIALIZED" -n ${requiredNofAgents} fairmq-dds-command-ui -c b -w "BOUND" -n ${requiredNofAgents} fairmq-dds-command-ui -c x -w "DEVICE READY" -n ${requiredNofAgents} fairmq-dds-command-ui -c j -w "READY" -n ${requiredNofAgents} fairmq-dds-command-ui -c r sampler_and_sink="main/(Sampler|Sink)" fairmq-dds-command-ui -p $sampler_and_sink -w "RUNNING->READY" -n 2 echo "...$sampler_and_sink are READY, sending shutdown..." fairmq-dds-command-ui -c s -w "RUNNING->READY" -n ${requiredNofAgents} fairmq-dds-command-ui -c t -w "DEVICE READY" -n ${requiredNofAgents} fairmq-dds-command-ui -c d -w "IDLE" -n ${requiredNofAgents} fairmq-dds-command-ui -c q echo "...waiting for ${requiredNofAgents} idle agents..." dds-info --wait-for-idle-agents ${requiredNofAgents} echo "------------------------" # TODO Uncomment once DDS 2.6 is released # dds-info --active-topology dds-topology --stop # dds-info --active-topology dds-agent-cmd getlog -a logDir="${wrkDir}/logs" for file in $(find "${logDir}" -name "*.tar.gz"); do tar -xf ${file} -C "${logDir}" ; done echo "AGENT LOG FILES IN: ${logDir}" # This string is used by ctest to detect success echo "Example successful :)" # Cleanup function is called by EXIT trap