From 00fc8c0bfa2ba88a8d3ca449b09a1e075c30f0c2 Mon Sep 17 00:00:00 2001 From: Tamas Gal <himself@tamasgal.com> Date: Mon, 18 Oct 2021 11:19:35 +0200 Subject: [PATCH] Use Jpp 14.4.3 --- docker-compose.yml | 8 +-- ligiermirror/Dockerfile | 8 --- ligiermirror/JLigierMirror.cc | 124 ---------------------------------- ligiermirror/Makefile | 1 - 4 files changed, 4 insertions(+), 137 deletions(-) delete mode 100644 ligiermirror/Dockerfile delete mode 100644 ligiermirror/JLigierMirror.cc delete mode 100644 ligiermirror/Makefile diff --git a/docker-compose.yml b/docker-compose.yml index 8bf7a18..45aeb77 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: "3" services: ligier: - image: "docker.km3net.de/jpp:v14.1.0" + image: "docker.km3net.de/jpp:v14.4.3" command: JLigier -d2 volumes: - ./logs:/logs @@ -9,10 +9,10 @@ services: - ${MONITORING_LIGIER_PORT}:5553 ligiermirror: - build: ./ligiermirror + image: "docker.km3net.de/jpp:v14.4.3" env_file: - .env - command: JLigierMirror -H ${DAQ_LIGIER_IP}:${DAQ_LIGIER_PORT} -X monitoring_ligier_1:5553 -t ${TAGS_TO_MIRROR} + command: JLigierMirror -H ${DAQ_LIGIER_IP}:${DAQ_LIGIER_PORT} -X monitoring_ligier_1:5553 -t "${TAGS_TO_MIRROR}" volumes: - ./logs:/logs depends_on: @@ -20,7 +20,7 @@ services: restart: unless-stopped ligierlogmirror: - build: ./ligiermirror + image: "docker.km3net.de/jpp:v14.4.3" env_file: - .env command: JLigierMirror -H ${LOG_LIGIER_IP}:${LOG_LIGIER_PORT} -X monitoring_ligier_1:5553 -t MSG diff --git a/ligiermirror/Dockerfile b/ligiermirror/Dockerfile deleted file mode 100644 index 8f92cf2..0000000 --- a/ligiermirror/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM docker.km3net.de/jpp:v14.1.0 - MAINTAINER Tamas Gal <tgal@km3net.de> - - WORKDIR /ligiermirror - - COPY . . - - RUN source /Jpp/setenv.sh /Jpp && make && mv JLigierMirror /usr/local/bin diff --git a/ligiermirror/JLigierMirror.cc b/ligiermirror/JLigierMirror.cc deleted file mode 100644 index f487ec4..0000000 --- a/ligiermirror/JLigierMirror.cc +++ /dev/null @@ -1,124 +0,0 @@ -#include <chrono> -#include <iostream> -#include <set> -#include <string> - -#include "Jeep/JParser.hh" -#include "Jeep/JMessage.hh" -#include "JNet/JControlHost.hh" -#include "JSystem/JDate.hh" - - -/** - * \file - * - * A tool to forward messages with the given tags from one ControlHost server (e.g. JLigier) to another. - * - * The options <tt>-H \<source\>[:port]</tt> and <tt>-H \<target\>[:port]</tt> - * correponds to the hostname and the port of the source and target server, respectively. - * The options <tt>-t</tt> and <tt>-T</tt> correspond to the ControlHost tag(s) - * with the mode subscription "any" and subscription "all". - * \author tgal - */ -int main(int argc, const char *argv[]) -{ - using namespace std; - - string source; - string target; - int report_interval; // in seconds - set<JNET::JTag> tagList; - set<JNET::JTag> TagList; - int debug; - - try { - - JParser<> zap("Program to forward messages from one ControlHost server to another."); - - zap['H'] = make_field(source) = "localhost"; - zap['X'] = make_field(target) = "localhost"; - zap['t'] = make_field(tagList); - zap['T'] = make_field(TagList); - zap['i'] = make_field(report_interval) = 30; - zap['d'] = make_field(debug) = 0; - - zap['t'] = JPARSER::initialised(); - zap['T'] = JPARSER::initialised(); - - zap(argc, argv); - } - catch(const exception &error) { - FATAL(error.what() << endl); - } - - - if (tagList.empty() && TagList.empty()) { - FATAL("No tags specified."); - } - - using namespace JPP; - - cout << "Forwarding messages from " << endl << " " << source << " -> " << target << endl; - - - JControlHost::Throw(true); - - try { - - JControlHost in(source); - JControlHost out(target); - - cout << "with the following tags: "; - - { - JSubscriptionList buffer; - - for (set<JTag>::const_iterator i = tagList.begin(); i != tagList.end(); ++i) { - buffer.add(JSubscriptionAny(*i)); - cout << *i << "(any) "; - } - - for (set<JTag>::const_iterator i = TagList.begin(); i != TagList.end(); ++i) { - buffer.add(JSubscriptionAll(*i)); - cout << *i << "(all) "; - } - - cout << endl; - - in.Subscribe(buffer); - in.SendMeAlways(); - } - - - JPrefix prefix; - vector<char> buffer; - unsigned int message_count = 0; - float milliseconds_passed; - std::chrono::high_resolution_clock::time_point start_time = std::chrono::high_resolution_clock::now(); - - for (const string stop("stop"); buffer.size() != stop.size() || string(buffer.data(), stop.size()) != stop; ) { - - in.WaitHead(prefix); - - buffer.resize(prefix.getSize()); - - in.GetFullData(buffer.data(), buffer.size()); - - DEBUG(getDateAndTime() << ' ' << left << setw(8) << prefix.getTag() << ' ' << right << setw(8) << prefix.getSize() << endl); - - out.PutFullData(prefix.getTag(), buffer.data(), buffer.size()); - - message_count += 1; - milliseconds_passed = (std::chrono::high_resolution_clock::now() - start_time) / std::chrono::milliseconds(1); - - if(milliseconds_passed > report_interval * 1e3) { - cout << getDateAndTime() << " : " << "Message rate: " << message_count / milliseconds_passed * 1e3 << " Hz" << endl; - start_time = std::chrono::high_resolution_clock::now(); - message_count = 0; - } - } - } - catch(const JControlHostException& error) { - ERROR(error << endl); - } -} diff --git a/ligiermirror/Makefile b/ligiermirror/Makefile deleted file mode 100644 index 424ef2f..0000000 --- a/ligiermirror/Makefile +++ /dev/null @@ -1 +0,0 @@ -include $(JPP_DIR)/make/JMakefile -- GitLab