mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
Example.DDS: Add start script
This commit is contained in:
parent
b53691c8ad
commit
d4f96db69c
|
@ -1,5 +1,5 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
# Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||||
# #
|
# #
|
||||||
# This software is distributed under the terms of the #
|
# This software is distributed under the terms of the #
|
||||||
# GNU Lesser General Public Licence (LGPL) version 3, #
|
# GNU Lesser General Public Licence (LGPL) version 3, #
|
||||||
|
@ -28,12 +28,12 @@ target_link_libraries(fairmq-ex-dds-sink PRIVATE ExampleDDSLib)
|
||||||
|
|
||||||
add_custom_target(ExampleDDS DEPENDS fairmq-ex-dds-sampler fairmq-ex-dds-processor fairmq-ex-dds-sink)
|
add_custom_target(ExampleDDS DEPENDS fairmq-ex-dds-sampler fairmq-ex-dds-processor fairmq-ex-dds-sink)
|
||||||
|
|
||||||
set(EX_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
set(BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
set(DDS_PLUGIN_LIB_DIR ${CMAKE_BINARY_DIR}/fairmq/plugins/DDS)
|
set(PLUGIN_DIR ${CMAKE_BINARY_DIR}/fairmq/plugins/DDS)
|
||||||
set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq)
|
set(DATA_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ex-dds-topology.xml ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-topology.xml @ONLY)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ex-dds-topology.xml ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-topology.xml @ONLY)
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ex-dds-hosts.cfg ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-hosts.cfg COPYONLY)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ex-dds-hosts.cfg ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-hosts.cfg COPYONLY)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-dds.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-dds.sh @ONLY)
|
||||||
|
|
||||||
# test
|
# test
|
||||||
|
|
||||||
|
@ -50,10 +50,11 @@ install(
|
||||||
)
|
)
|
||||||
|
|
||||||
# configure run script with different executable paths for build and for install directories
|
# configure run script with different executable paths for build and for install directories
|
||||||
set(EX_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR})
|
set(BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR})
|
||||||
set(DDS_PLUGIN_LIB_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_LIBDIR})
|
set(PLUGIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_LIBDIR})
|
||||||
set(FAIRMQ_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}/fairmq)
|
set(DATA_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_DATADIR})
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ex-dds-topology.xml ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-topology.xml_install @ONLY)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ex-dds-topology.xml ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-topology.xml_install @ONLY)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-dds.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-dds.sh_install @ONLY)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-topology.xml_install
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-topology.xml_install
|
||||||
|
@ -65,3 +66,9 @@ install(
|
||||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-hosts.cfg
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-hosts.cfg
|
||||||
DESTINATION ${PROJECT_INSTALL_DATADIR}
|
DESTINATION ${PROJECT_INSTALL_DATADIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-dds.sh_install
|
||||||
|
DESTINATION ${PROJECT_INSTALL_BINDIR}
|
||||||
|
RENAME fairmq-start-ex-dds.sh
|
||||||
|
)
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
<declrequirement name="ProcessorWorker" type="wnname" value="processor"/>
|
<declrequirement name="ProcessorWorker" type="wnname" value="processor"/>
|
||||||
<declrequirement name="SinkWorker" type="wnname" value="sink"/>
|
<declrequirement name="SinkWorker" type="wnname" value="sink"/>
|
||||||
|
|
||||||
<decltask name="Sampler">
|
<decltask id="Sampler">
|
||||||
<exe reachable="true">@EX_BIN_DIR@/fairmq-ex-dds-sampler --id sampler --color false --channel-config name=data1,type=push,method=bind -S "<@DDS_PLUGIN_LIB_DIR@/" -P dds</exe>
|
<exe reachable="true">fairmq-ex-dds-sampler --id sampler --channel-config name=data1,type=push,method=bind -S "<@PLUGIN_DIR@/" -P dds</exe>
|
||||||
<requirements>
|
<requirements>
|
||||||
<name>SamplerWorker</name>
|
<name>SamplerWorker</name>
|
||||||
</requirements>
|
</requirements>
|
||||||
|
@ -17,10 +17,10 @@
|
||||||
</properties>
|
</properties>
|
||||||
</decltask>
|
</decltask>
|
||||||
|
|
||||||
<decltask name="Processor">
|
<decltask id="Processor">
|
||||||
<exe reachable="true">@EX_BIN_DIR@/fairmq-ex-dds-processor --id processor_%taskIndex% --config-key processor --color false --channel-config name=data1,type=pull,method=connect name=data2,type=push,method=connect -S "<@DDS_PLUGIN_LIB_DIR@/" -P dds</exe>
|
<exe reachable="true">fairmq-ex-dds-processor --id processor_%taskIndex% --channel-config name=data1,type=pull,method=connect name=data2,type=push,method=connect -S "<@PLUGIN_DIR@/" -P dds</exe>
|
||||||
<requirements>
|
<requirements>
|
||||||
<name>ProcessorWorker</name>
|
<id>ProcessWorker</id>
|
||||||
</requirements>
|
</requirements>
|
||||||
<properties>
|
<properties>
|
||||||
<name access="read">data1</name>
|
<name access="read">data1</name>
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
</properties>
|
</properties>
|
||||||
</decltask>
|
</decltask>
|
||||||
|
|
||||||
<decltask name="Sink">
|
<decltask id="Sink">
|
||||||
<exe reachable="true">@EX_BIN_DIR@/fairmq-ex-dds-sink --id sink --color false --channel-config name=data2,type=pull,method=bind -S "<@DDS_PLUGIN_LIB_DIR@/" -P dds</exe>
|
<exe reachable="true">fairmq-ex-dds-sink --id sink --channel-config name=data2,type=pull,method=bind -S "<@PLUGIN_DIR@/" -P dds</exe>
|
||||||
<requirements>
|
<requirements>
|
||||||
<name>SinkWorker</name>
|
<name>SinkWorker</name>
|
||||||
</requirements>
|
</requirements>
|
||||||
|
|
58
examples/dds/fairmq-start-ex-dds.sh.in
Executable file
58
examples/dds/fairmq-start-ex-dds.sh.in
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/usr/bin/env 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" #
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
dds-session stop $1
|
||||||
|
echo "CLEANUP PERFORMED"
|
||||||
|
}
|
||||||
|
|
||||||
|
source @DDS_INSTALL_PREFIX@/DDS_env.sh
|
||||||
|
export PATH=@BIN_DIR@:@PLUGIN_DIR@:$PATH
|
||||||
|
|
||||||
|
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
|
||||||
|
dds-submit -s ${DDS_SESSION_ID} -r localhost -n ${requiredNofAgents}
|
||||||
|
dds-info -s ${DDS_SESSION_ID} --wait-for-idle-agents ${requiredNofAgents}
|
||||||
|
|
||||||
|
topologyFile=@DATA_DIR@/ex-dds-topology.xml
|
||||||
|
echo "TOPOLOGY FILE: ${topologyFile}"
|
||||||
|
|
||||||
|
dds-topology -s ${DDS_SESSION_ID} --disable-validation --activate ${topologyFile}
|
||||||
|
|
||||||
|
echo "------------------------"
|
||||||
|
echo "Waiting for Topology to finish ..."
|
||||||
|
sampler_and_sink="main/(Sampler|Sink)"
|
||||||
|
fairmq-dds-command-ui -p $sampler_and_sink --wait-for-state RUNNING->READY
|
||||||
|
echo "..."
|
||||||
|
fairmq-dds-command-ui -c s -w READY
|
||||||
|
fairmq-dds-command-ui -c t -w "DEVICE READY"
|
||||||
|
fairmq-dds-command-ui -c d -w IDLE
|
||||||
|
fairmq-dds-command-ui -c q -w EXITING
|
||||||
|
# fairmq-dds-command-ui -c q! -w EXITING
|
||||||
|
echo "..."
|
||||||
|
dds-info -s ${DDS_SESSION_ID} --wait-for-idle-agents ${requiredNofAgents}
|
||||||
|
echo "------------------------"
|
||||||
|
|
||||||
|
dds-topology -s ${DDS_SESSION_ID} --stop
|
||||||
|
|
||||||
|
dds-agent-cmd getlog -a -s ${DDS_SESSION_ID}
|
||||||
|
logDir="${wrkDir}/logs"
|
||||||
|
for file in $(find "${logDir}" -name "*.tar.gz"); do tar -xf ${file} -C "${logDir}" ; done
|
||||||
|
echo "AGENT LOG FILES IN: ${logDir}"
|
||||||
|
|
||||||
|
# Cleanup function is called by EXIT trap
|
Loading…
Reference in New Issue
Block a user