1 #ifndef ARTDAQ_TRANSFERPLUGINS_DETAIL_HOSTMAP_HH
2 #define ARTDAQ_TRANSFERPLUGINS_DETAIL_HOSTMAP_HH
7 #include "artdaq/TransferPlugins/TransferInterface.hh"
8 #include "fhiclcpp/ParameterSet.h"
9 #include "fhiclcpp/types/Atom.h"
10 #include "fhiclcpp/types/Sequence.h"
11 #include "fhiclcpp/types/Table.h"
23 fhicl::Atom<int>
rank{fhicl::Name{
"rank"}, fhicl::Comment{
"Rank index"}};
25 fhicl::Atom<std::string>
host{fhicl::Name{
"host"}, fhicl::Comment{
"Hostname for artdaq application with this rank"}};
35 fhicl::Sequence<fhicl::Table<HostConfig>>
host_map{fhicl::Name(
"host_map"), fhicl::Comment(
"List of artdaq applications by rank and location")};
46 inline std::vector<fhicl::ParameterSet>
MakeHostMapPset(std::map<int, std::string> input)
48 std::vector<fhicl::ParameterSet> output;
49 for (
auto& rank : input)
51 fhicl::ParameterSet rank_output;
52 rank_output.put<
int>(
"rank", rank.first);
53 rank_output.put<std::string>(
"host", rank.second);
54 output.push_back(rank_output);
67 if (pset.has_key(
"host_map"))
69 auto hosts = pset.get<std::vector<fhicl::ParameterSet>>(
"host_map");
70 for (
auto& ps : hosts)
73 auto hostname = ps.get<std::string>(
"host",
"localhost");
75 if (map.count(rank) && (map[rank] != hostname))
77 TLOG(TLVL_ERROR) <<
"Inconsistent host maps supplied! Check configuration! There may be TCPSocket-related failures!";
fhicl::Sequence< fhicl::Table< HostConfig > > host_map
List of artdaq applications by rank and location. See artdaq::HostMap::HostConfig ...
fhicl::Atom< int > rank
"rank": Rank index
std::vector< fhicl::ParameterSet > MakeHostMapPset(std::map< int, std::string > input)
Create a list of HostMap::HostConfig ParameterSets from a hostMap_t map
Template for the host_map configuration parameter.
fhicl::Atom< std::string > host
"host": Hostname for artdaq application with this rank
Entries in the host_map should have these parameters. May be used for parameter validation ...
Value to be returned upon receive timeout.
std::map< int, std::string > hostMap_t
The host_map is a map associating ranks with artdaq::DestinationInfo objects.
hostMap_t MakeHostMap(fhicl::ParameterSet const &pset, hostMap_t map=hostMap_t())
Make a hostMap_t from a HostMap::Config ParameterSet