From 3ab7ee5f029d44443dc0423923dd8029700ece3a Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Tue, 29 Aug 2017 10:15:04 +0200 Subject: [PATCH] FairMQParser: Disable deprecated parsing for singular JSON keys --- fairmq/options/FairMQParser.cxx | 264 ++++++++++++++++---------------- 1 file changed, 132 insertions(+), 132 deletions(-) diff --git a/fairmq/options/FairMQParser.cxx b/fairmq/options/FairMQParser.cxx index 4d9df510..f7d0c3a2 100644 --- a/fairmq/options/FairMQParser.cxx +++ b/fairmq/options/FairMQParser.cxx @@ -107,30 +107,30 @@ void PrintDeviceList(const boost::property_tree::ptree& tree, const std::string& } } - if (p.first == "device") - { - //get id attribute to choose the device - if (formatFlag == "xml") - { - deviceIdKey = p.second.get(".id"); - LOG(TRACE) << "Found config for '" << deviceIdKey << "' in XML input"; - } + // if (p.first == "device") + // { + // //get id attribute to choose the device + // if (formatFlag == "xml") + // { + // deviceIdKey = p.second.get(".id"); + // LOG(TRACE) << "Found config for '" << deviceIdKey << "' in XML input"; + // } - if (formatFlag == "json") - { - string key = p.second.get("key", ""); - if (key != "") - { - deviceIdKey = key; - LOG(TRACE) << "Found config for device key '" << deviceIdKey << "' in JSON input"; - } - else - { - deviceIdKey = p.second.get("id"); - LOG(TRACE) << "Found config for device id '" << deviceIdKey << "' in JSON input"; - } - } - } + // if (formatFlag == "json") + // { + // string key = p.second.get("key", ""); + // if (key != "") + // { + // deviceIdKey = key; + // LOG(TRACE) << "Found config for device key '" << deviceIdKey << "' in JSON input"; + // } + // else + // { + // deviceIdKey = p.second.get("id"); + // LOG(TRACE) << "Found config for device id '" << deviceIdKey << "' in JSON input"; + // } + // } + // } } } @@ -173,40 +173,40 @@ void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap } } - if (p.first == "device") - { - if (formatFlag == "xml") - { - deviceIdKey = p.second.get(".id"); - } + // if (p.first == "device") + // { + // if (formatFlag == "xml") + // { + // deviceIdKey = p.second.get(".id"); + // } - if (formatFlag == "json") - { - // check if key is provided, otherwise use id - string key = p.second.get("key", ""); + // if (formatFlag == "json") + // { + // // check if key is provided, otherwise use id + // string key = p.second.get("key", ""); - if (key != "") - { - deviceIdKey = key; - // LOG(DEBUG) << "Found config for device key '" << deviceIdKey << "' in JSON input"; - } - else - { - deviceIdKey = p.second.get("id"); - // LOG(DEBUG) << "Found config for device id '" << deviceIdKey << "' in JSON input"; - } - } + // if (key != "") + // { + // deviceIdKey = key; + // // LOG(DEBUG) << "Found config for device key '" << deviceIdKey << "' in JSON input"; + // } + // else + // { + // deviceIdKey = p.second.get("id"); + // // LOG(DEBUG) << "Found config for device id '" << deviceIdKey << "' in JSON input"; + // } + // } - // if not correct device id, do not fill MQMap - if (deviceId != deviceIdKey) - { - continue; - } + // // if not correct device id, do not fill MQMap + // if (deviceId != deviceIdKey) + // { + // continue; + // } - LOG(DEBUG) << "Found with following channels:"; + // LOG(DEBUG) << "Found with following channels:"; - ChannelParser(p.second, channelMap, formatFlag); - } + // ChannelParser(p.second, channelMap, formatFlag); + // } } } @@ -270,68 +270,68 @@ void ChannelParser(const boost::property_tree::ptree& tree, FairMQMap& channelMa } } - if (p.first == "channel") - { - // try to get common properties to use for all subChannels - FairMQChannel commonChannel; - int numSockets = 0; + // if (p.first == "channel") + // { + // // try to get common properties to use for all subChannels + // FairMQChannel commonChannel; + // int numSockets = 0; - // get name attribute to form key - if (formatFlag == "xml") - { - channelKey = p.second.get(".name"); - } + // // get name attribute to form key + // if (formatFlag == "xml") + // { + // channelKey = p.second.get(".name"); + // } - if (formatFlag == "json") - { - channelKey = p.second.get("name"); + // if (formatFlag == "json") + // { + // channelKey = p.second.get("name"); - numSockets = p.second.get("numSockets", 0); + // numSockets = p.second.get("numSockets", 0); - // try to get common properties to use for all subChannels - commonChannel.UpdateType(p.second.get("type", commonChannel.GetType())); - commonChannel.UpdateMethod(p.second.get("method", commonChannel.GetMethod())); - commonChannel.UpdateAddress(p.second.get("address", commonChannel.GetAddress())); - commonChannel.UpdateTransport(p.second.get("transport", commonChannel.GetTransport())); - commonChannel.UpdateSndBufSize(p.second.get("sndBufSize", commonChannel.GetSndBufSize())); - commonChannel.UpdateRcvBufSize(p.second.get("rcvBufSize", commonChannel.GetRcvBufSize())); - commonChannel.UpdateSndKernelSize(p.second.get("sndKernelSize", commonChannel.GetSndKernelSize())); - commonChannel.UpdateRcvKernelSize(p.second.get("rcvKernelSize", commonChannel.GetRcvKernelSize())); - commonChannel.UpdateRateLogging(p.second.get("rateLogging", commonChannel.GetRateLogging())); - } + // // try to get common properties to use for all subChannels + // commonChannel.UpdateType(p.second.get("type", commonChannel.GetType())); + // commonChannel.UpdateMethod(p.second.get("method", commonChannel.GetMethod())); + // commonChannel.UpdateAddress(p.second.get("address", commonChannel.GetAddress())); + // commonChannel.UpdateTransport(p.second.get("transport", commonChannel.GetTransport())); + // commonChannel.UpdateSndBufSize(p.second.get("sndBufSize", commonChannel.GetSndBufSize())); + // commonChannel.UpdateRcvBufSize(p.second.get("rcvBufSize", commonChannel.GetRcvBufSize())); + // commonChannel.UpdateSndKernelSize(p.second.get("sndKernelSize", commonChannel.GetSndKernelSize())); + // commonChannel.UpdateRcvKernelSize(p.second.get("rcvKernelSize", commonChannel.GetRcvKernelSize())); + // commonChannel.UpdateRateLogging(p.second.get("rateLogging", commonChannel.GetRateLogging())); + // } - // temporary FairMQChannel container - vector channelList; + // // temporary FairMQChannel container + // vector channelList; - if (numSockets > 0) - { - LOG(DEBUG) << "" << channelKey << ":"; - LOG(DEBUG) << "\tnumSockets of " << numSockets << " specified,"; - LOG(DEBUG) << "\tapplying common settings to each:"; + // if (numSockets > 0) + // { + // LOG(DEBUG) << "" << channelKey << ":"; + // LOG(DEBUG) << "\tnumSockets of " << numSockets << " specified,"; + // LOG(DEBUG) << "\tapplying common settings to each:"; - LOG(DEBUG) << "\ttype = " << commonChannel.GetType(); - LOG(DEBUG) << "\tmethod = " << commonChannel.GetMethod(); - LOG(DEBUG) << "\taddress = " << commonChannel.GetAddress(); - LOG(DEBUG) << "\ttransport = " << commonChannel.GetTransport(); - LOG(DEBUG) << "\tsndBufSize = " << commonChannel.GetSndBufSize(); - LOG(DEBUG) << "\trcvBufSize = " << commonChannel.GetRcvBufSize(); - LOG(DEBUG) << "\tsndKernelSize = " << commonChannel.GetSndKernelSize(); - LOG(DEBUG) << "\trcvKernelSize = " << commonChannel.GetRcvKernelSize(); - LOG(DEBUG) << "\trateLogging = " << commonChannel.GetRateLogging(); + // LOG(DEBUG) << "\ttype = " << commonChannel.GetType(); + // LOG(DEBUG) << "\tmethod = " << commonChannel.GetMethod(); + // LOG(DEBUG) << "\taddress = " << commonChannel.GetAddress(); + // LOG(DEBUG) << "\ttransport = " << commonChannel.GetTransport(); + // LOG(DEBUG) << "\tsndBufSize = " << commonChannel.GetSndBufSize(); + // LOG(DEBUG) << "\trcvBufSize = " << commonChannel.GetRcvBufSize(); + // LOG(DEBUG) << "\tsndKernelSize = " << commonChannel.GetSndKernelSize(); + // LOG(DEBUG) << "\trcvKernelSize = " << commonChannel.GetRcvKernelSize(); + // LOG(DEBUG) << "\trateLogging = " << commonChannel.GetRateLogging(); - for (int i = 0; i < numSockets; ++i) - { - FairMQChannel channel(commonChannel); - channelList.push_back(channel); - } - } - else - { - SocketParser(p.second.get_child(""), channelList, channelKey, commonChannel); - } + // for (int i = 0; i < numSockets; ++i) + // { + // FairMQChannel channel(commonChannel); + // channelList.push_back(channel); + // } + // } + // else + // { + // SocketParser(p.second.get_child(""), channelList, channelKey, commonChannel); + // } - channelMap.insert(make_pair(channelKey, move(channelList))); - } + // channelMap.insert(make_pair(channelKey, move(channelList))); + // } } } @@ -376,36 +376,36 @@ void SocketParser(const boost::property_tree::ptree& tree, vector } } - if (p.first == "socket") - { - // create new channel and apply setting from the common channel - FairMQChannel channel(commonChannel); + // if (p.first == "socket") + // { + // // create new channel and apply setting from the common channel + // FairMQChannel channel(commonChannel); - // if the socket field specifies or overrides something from the common channel, apply those settings - channel.UpdateType(p.second.get("type", channel.GetType())); - channel.UpdateMethod(p.second.get("method", channel.GetMethod())); - channel.UpdateAddress(p.second.get("address", channel.GetAddress())); - channel.UpdateTransport(p.second.get("transport", channel.GetTransport())); - channel.UpdateSndBufSize(p.second.get("sndBufSize", channel.GetSndBufSize())); - channel.UpdateRcvBufSize(p.second.get("rcvBufSize", channel.GetRcvBufSize())); - channel.UpdateSndKernelSize(p.second.get("sndKernelSize", channel.GetSndKernelSize())); - channel.UpdateRcvKernelSize(p.second.get("rcvKernelSize", channel.GetRcvKernelSize())); - channel.UpdateRateLogging(p.second.get("rateLogging", channel.GetRateLogging())); + // // if the socket field specifies or overrides something from the common channel, apply those settings + // channel.UpdateType(p.second.get("type", channel.GetType())); + // channel.UpdateMethod(p.second.get("method", channel.GetMethod())); + // channel.UpdateAddress(p.second.get("address", channel.GetAddress())); + // channel.UpdateTransport(p.second.get("transport", channel.GetTransport())); + // channel.UpdateSndBufSize(p.second.get("sndBufSize", channel.GetSndBufSize())); + // channel.UpdateRcvBufSize(p.second.get("rcvBufSize", channel.GetRcvBufSize())); + // channel.UpdateSndKernelSize(p.second.get("sndKernelSize", channel.GetSndKernelSize())); + // channel.UpdateRcvKernelSize(p.second.get("rcvKernelSize", channel.GetRcvKernelSize())); + // channel.UpdateRateLogging(p.second.get("rateLogging", channel.GetRateLogging())); - LOG(DEBUG) << "" << channelName << "[" << socketCounter << "]:"; - LOG(DEBUG) << "\ttype = " << channel.GetType(); - LOG(DEBUG) << "\tmethod = " << channel.GetMethod(); - LOG(DEBUG) << "\taddress = " << channel.GetAddress(); - LOG(DEBUG) << "\ttransport = " << channel.GetTransport(); - LOG(DEBUG) << "\tsndBufSize = " << channel.GetSndBufSize(); - LOG(DEBUG) << "\trcvBufSize = " << channel.GetRcvBufSize(); - LOG(DEBUG) << "\tsndKernelSize = " << channel.GetSndKernelSize(); - LOG(DEBUG) << "\trcvKernelSize = " << channel.GetRcvKernelSize(); - LOG(DEBUG) << "\trateLogging = " << channel.GetRateLogging(); + // LOG(DEBUG) << "" << channelName << "[" << socketCounter << "]:"; + // LOG(DEBUG) << "\ttype = " << channel.GetType(); + // LOG(DEBUG) << "\tmethod = " << channel.GetMethod(); + // LOG(DEBUG) << "\taddress = " << channel.GetAddress(); + // LOG(DEBUG) << "\ttransport = " << channel.GetTransport(); + // LOG(DEBUG) << "\tsndBufSize = " << channel.GetSndBufSize(); + // LOG(DEBUG) << "\trcvBufSize = " << channel.GetRcvBufSize(); + // LOG(DEBUG) << "\tsndKernelSize = " << channel.GetSndKernelSize(); + // LOG(DEBUG) << "\trcvKernelSize = " << channel.GetRcvKernelSize(); + // LOG(DEBUG) << "\trateLogging = " << channel.GetRateLogging(); - channelList.push_back(channel); - ++socketCounter; - } + // channelList.push_back(channel); + // ++socketCounter; + // } } // end socket loop if (socketCounter)