From 46014118f03aa11b37b0778d2e4c02b0213bf0d7 Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Mon, 30 Mar 2020 11:57:54 +0200 Subject: [PATCH] QC ex: rename qc devices, granular state control --- examples/README.md | 4 ++-- examples/qc/CMakeLists.txt | 14 +++++++------- examples/qc/README.md | 2 +- examples/qc/ex-qc-topology.xml | 12 ++++++------ examples/qc/fairmq-start-ex-qc.sh.in | 14 ++++++++------ .../qc/{runQCProducer.cxx => runQCDispatcher.cxx} | 8 ++++---- examples/qc/{runQCConsumer.cxx => runQCTask.cxx} | 6 +++--- 7 files changed, 31 insertions(+), 29 deletions(-) rename examples/qc/{runQCProducer.cxx => runQCDispatcher.cxx} (92%) rename examples/qc/{runQCConsumer.cxx => runQCTask.cxx} (91%) diff --git a/examples/README.md b/examples/README.md index 762b6ee7..a4855954 100644 --- a/examples/README.md +++ b/examples/README.md @@ -40,7 +40,7 @@ A topology consisting of three layers of devices: synchronizer -> n * senders -> ## QC -A topology consisting of 4 devices - Sampler, QCProducer, QCConsumer and Sink. The data flows from Sampler through QCProducer to Sink. On demand - by setting the corresponding configuration property - the QCProducer device will duplicate the data to the QCConsumer device. The property is set by the topology controller, in this example this is the `fairmq-dds-command-ui` utility. +A topology consisting of 4 devices - Sampler, QCDispatcher, QCTask and Sink. The data flows from Sampler through QCDispatcher to Sink. On demand - by setting the corresponding configuration property - the QCDispatcher device will duplicate the data to the QCTask device. The property is set by the topology controller, in this example this is the `fairmq-dds-command-ui` utility. ## Readout @@ -52,4 +52,4 @@ This example demonstrates the use of a more advanced feature - UnmanagedRegion, ## Request & Reply -This topology contains two devices that communicate with each other via the **REQ-REP** pettern. Bidirectional communication via a single socket. \ No newline at end of file +This topology contains two devices that communicate with each other via the **REQ-REP** pettern. Bidirectional communication via a single socket. diff --git a/examples/qc/CMakeLists.txt b/examples/qc/CMakeLists.txt index 22822395..ba01160e 100644 --- a/examples/qc/CMakeLists.txt +++ b/examples/qc/CMakeLists.txt @@ -9,16 +9,16 @@ add_executable(fairmq-ex-qc-sampler runSampler.cxx) target_link_libraries(fairmq-ex-qc-sampler PRIVATE FairMQ) -add_executable(fairmq-ex-qc-producer runQCProducer.cxx) -target_link_libraries(fairmq-ex-qc-producer PRIVATE FairMQ) +add_executable(fairmq-ex-qc-dispatcher runQCDispatcher.cxx) +target_link_libraries(fairmq-ex-qc-dispatcher PRIVATE FairMQ) -add_executable(fairmq-ex-qc-consumer runQCConsumer.cxx) -target_link_libraries(fairmq-ex-qc-consumer PRIVATE FairMQ) +add_executable(fairmq-ex-qc-task runQCTask.cxx) +target_link_libraries(fairmq-ex-qc-task PRIVATE FairMQ) add_executable(fairmq-ex-qc-sink runSink.cxx) target_link_libraries(fairmq-ex-qc-sink PRIVATE FairMQ) -add_custom_target(ExampleQC DEPENDS fairmq-ex-qc-sampler fairmq-ex-qc-producer fairmq-ex-qc-consumer fairmq-ex-qc-sink) +add_custom_target(ExampleQC DEPENDS fairmq-ex-qc-sampler fairmq-ex-qc-dispatcher fairmq-ex-qc-task fairmq-ex-qc-sink) list(JOIN Boost_LIBRARY_DIRS ":" LIB_DIR) set(BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_BINARY_DIR}/fairmq/plugins/DDS) @@ -37,8 +37,8 @@ endif() install( TARGETS fairmq-ex-qc-sampler - fairmq-ex-qc-producer - fairmq-ex-qc-consumer + fairmq-ex-qc-dispatcher + fairmq-ex-qc-task fairmq-ex-qc-sink LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR} diff --git a/examples/qc/README.md b/examples/qc/README.md index 3436f436..4ceb2402 100644 --- a/examples/qc/README.md +++ b/examples/qc/README.md @@ -1,4 +1,4 @@ QC == -A topology consisting of 4 devices - Sampler, QCProducer, QCConsumer and Sink. The data flows from Sampler through QCProducer to Sink. On demand - by setting the corresponding configuration property - the QCProducer device will duplicate the data to the QCConsumer device. The property is set by the topology controller, in this example this is the `fairmq-dds-command-ui` utility. +A topology consisting of 4 devices - Sampler, QCDispatcher, QCTask and Sink. The data flows from Sampler through QCDispatcher to Sink. On demand - by setting the corresponding configuration property - the QCDispatcher device will duplicate the data to the QCTask device. The property is set by the topology controller, in this example this is the `fairmq-dds-command-ui` utility. diff --git a/examples/qc/ex-qc-topology.xml b/examples/qc/ex-qc-topology.xml index 2fd2942d..fd92a207 100644 --- a/examples/qc/ex-qc-topology.xml +++ b/examples/qc/ex-qc-topology.xml @@ -12,8 +12,8 @@ - - fairmq-ex-qc-producer --color false --channel-config name=data1,type=pull,method=connect name=data2,type=push,method=connect name=qc,type=push,method=connect -P dds + + fairmq-ex-qc-dispatcher --color false --channel-config name=data1,type=pull,method=connect name=data2,type=push,method=connect name=qc,type=push,method=connect -P dds fairmq-ex-qc-env.sh fmqchan_data1 @@ -22,8 +22,8 @@ - - fairmq-ex-qc-consumer --color false --channel-config name=qc,type=pull,method=bind -P dds + + fairmq-ex-qc-task --color false --channel-config name=qc,type=pull,method=bind -P dds fairmq-ex-qc-env.sh fmqchan_qc @@ -40,8 +40,8 @@
Sampler - QCProducer - QCConsumer + QCDispatcher + QCTask Sink
diff --git a/examples/qc/fairmq-start-ex-qc.sh.in b/examples/qc/fairmq-start-ex-qc.sh.in index a64466eb..5ddedc60 100755 --- a/examples/qc/fairmq-start-ex-qc.sh.in +++ b/examples/qc/fairmq-start-ex-qc.sh.in @@ -51,12 +51,14 @@ 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 -qcconsumer="main/QCConsumer.*" -qcproducer="main/QCProducer.*" -fairmq-dds-command-ui -c p --property-key qc --property-value active -p $qcproducer -fairmq-dds-command-ui -w "RUNNING->READY" -p $qcconsumer -echo "...$qcconsumer received data and transitioned to READY, sending shutdown..." +allexceptqctasks="main/(Sampler|QCDispatcher|Sink)" +fairmq-dds-command-ui -c r -p $allexceptqctasks +qctask="main/QCTask.*" +qcdispatcher="main/QCDispatcher.*" +fairmq-dds-command-ui -c p --property-key qc --property-value active -p $qcdispatcher +fairmq-dds-command-ui -c r -p $qctask +fairmq-dds-command-ui -w "RUNNING->READY" -p $qctask +echo "...$qctask received data and transitioned to READY, sending shutdown..." fairmq-dds-command-ui -c s fairmq-dds-command-ui -c t fairmq-dds-command-ui -c d diff --git a/examples/qc/runQCProducer.cxx b/examples/qc/runQCDispatcher.cxx similarity index 92% rename from examples/qc/runQCProducer.cxx rename to examples/qc/runQCDispatcher.cxx index b17ab833..d0fedba4 100644 --- a/examples/qc/runQCProducer.cxx +++ b/examples/qc/runQCDispatcher.cxx @@ -9,13 +9,13 @@ #include "runFairMQDevice.h" #include "FairMQDevice.h" -class QCProducer : public FairMQDevice +class QCDispatcher : public FairMQDevice { public: - QCProducer() + QCDispatcher() : fDoQC(false) { - OnData("data1", &QCProducer::HandleData); + OnData("data1", &QCDispatcher::HandleData); } void InitTask() override @@ -56,4 +56,4 @@ class QCProducer : public FairMQDevice }; void addCustomOptions(boost::program_options::options_description& /*options*/) {} -FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new QCProducer(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new QCDispatcher(); } diff --git a/examples/qc/runQCConsumer.cxx b/examples/qc/runQCTask.cxx similarity index 91% rename from examples/qc/runQCConsumer.cxx rename to examples/qc/runQCTask.cxx index fb337593..6cb4d636 100644 --- a/examples/qc/runQCConsumer.cxx +++ b/examples/qc/runQCTask.cxx @@ -9,10 +9,10 @@ #include "runFairMQDevice.h" #include "FairMQDevice.h" -class QCConsumer : public FairMQDevice +class QCTask : public FairMQDevice { public: - QCConsumer() + QCTask() { OnData("qc", [](FairMQMessagePtr& /*msg*/, int) { LOG(info) << "received data"; @@ -23,4 +23,4 @@ class QCConsumer : public FairMQDevice namespace bpo = boost::program_options; void addCustomOptions(bpo::options_description& /*options*/) {} -FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new QCConsumer(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new QCTask(); }