49InjectorFunction dcs2dpl(std::string& ccdbhost, std::string& bkhost, std::string& qchost,
int qcwriteperiod, std::string& ctpcfgdir)
51 auto runMgr = std::make_shared<o2::ctp::CTPRunManager>();
52 runMgr->setCCDBHost(ccdbhost);
53 runMgr->setBKHost(bkhost);
54 runMgr->setQCDBHost(qchost);
55 runMgr->setQCWritePeriod(qcwriteperiod);
56 runMgr->setCtpCfgDir(ctpcfgdir);
59 static int nprint = 0;
67 std::string messageHeader{
static_cast<const char*
>(parts.At(0)->GetData()), parts.At(0)->GetSize()};
68 size_t dataSize = parts.At(1)->GetSize();
69 std::string messageData{
static_cast<const char*
>(parts.At(1)->GetData()), parts.At(1)->GetSize()};
73 if (nprint > nlimit && nprint < (nlimit + nrange + 1)) {
74 LOG(info) <<
"received message " << messageHeader <<
" of size " <<
dataSize <<
" # parts:" << parts.Size();
75 if (nprint == (nlimit + nrange)) {
79 runMgr->processMessage(messageHeader, messageData);
85void customize(std::vector<ConfigParamSpec>& workflowOptions)
87 workflowOptions.push_back(
ConfigParamSpec{
"subscribe-to", VariantType::String,
"type=sub,method=connect,address=tcp://188.184.30.57:5556,rateLogging=10,transport=zeromq", {
"channel subscribe to"}});
88 workflowOptions.push_back(
ConfigParamSpec{
"ccdb-host", VariantType::String,
"http://o2-ccdb.internal:8080", {
"ccdb host"}});
89 workflowOptions.push_back(
ConfigParamSpec{
"bk-host", VariantType::String,
"none", {
"bk host"}});
90 workflowOptions.push_back(
ConfigParamSpec{
"qc-host", VariantType::String,
"none", {
"qc host"}});
91 workflowOptions.push_back(
ConfigParamSpec{
"ctpcfg-dir", VariantType::String,
"none", {
"ctp.cfg file directory"}});
92 workflowOptions.push_back(
ConfigParamSpec{
"qc-writeperiod", VariantType::Int, 30, {
"Period of writing to QCDB in units of 10secs, default = 30 (5 mins)"}});
99 LOG(info) <<
"Defining data processing";
100 auto setChanName = [](
const std::string& chan,
const std::string&
name) {
102 if (std::string(chan).find(
"name=") != std::string::npos) {
103 n = std::string(chan).find(
",");
104 if (
n == std::string::npos) {
105 throw std::runtime_error(fmt::format(
"wrongly formatted channel: {}", chan));
109 LOG(info) <<
"===>inside:" <<
name <<
" " << chan;
112 const std::string devName =
"ctp-proxy";
113 auto chan = config.
options().
get<std::string>(
"subscribe-to");
114 std::string ccdbhost = config.
options().
get<std::string>(
"ccdb-host");
115 std::string bkhost = config.
options().
get<std::string>(
"bk-host");
116 std::string qchost = config.
options().
get<std::string>(
"qc-host");
117 int qcwriteperiod = config.
options().
get<
int>(
"qc-writeperiod");
118 std::string ctpcfgdir = config.
options().
get<std::string>(
"ctpcfg-dir");
120 throw std::runtime_error(
"input channel is not provided");
122 chan = setChanName(chan, devName);
123 LOG(info) <<
"name:" << devName <<
" chan:" << chan;
124 LOG(info) <<
"Channels setup: " << chan;
126 ctpCountersOutputs.emplace_back(
"CTP",
"CTP_COUNTERS", 0, Lifetime::Timeframe);
127 LOG(info) <<
"===> Proxy to be set";
130 std::move(ctpCountersOutputs),
133 dcs2dpl(ccdbhost, bkhost, qchost, qcwriteperiod, ctpcfgdir));
135 LOG(info) <<
"===> Proxy done";
137 workflow.emplace_back(ctpProxy);
ConfigParamRegistry & options() const
DataProcessorSpec specifyExternalFairMQDeviceProxy(char const *label, std::vector< OutputSpec > const &outputs, const char *defaultChannelConfig, InjectorFunction converter, uint64_t minSHM=0, bool sendTFcounter=false, bool doInjectMissingData=false, unsigned int doPrintSizes=0)
std::function< bool(TimingInfo &, ServiceRegistryRef const &services, fair::mq::Parts &inputs, ChannelRetriever, size_t newTimesliceId, bool &stop)> InjectorFunction