CMS 3D CMS Logo

triton_utils.cc
Go to the documentation of this file.
4 
5 #include <sstream>
6 #include <experimental/iterator>
7 
8 namespace triton_utils {
9 
10  template <typename C>
11  std::string printColl(const C& coll, const std::string& delim) {
12  if (coll.empty())
13  return "";
14  std::stringstream msg;
15  //avoid trailing delim
16  std::copy(std::begin(coll), std::end(coll), std::experimental::make_ostream_joiner(msg, delim));
17  return msg.str();
18  }
19 
20  void throwIfError(const Error& err, std::string_view msg) {
21  if (!err.IsOk())
22  throw cms::Exception("TritonServerFailure") << msg << ": " << err;
23  }
24 
25  bool warnIfError(const Error& err, std::string_view msg) {
26  if (!err.IsOk())
27  edm::LogWarning("TritonServerWarning") << msg << ": " << err;
28  return err.IsOk();
29  }
30 
31 } // namespace triton_utils
32 
33 template std::string triton_utils::printColl(const edm::Span<std::vector<int64_t>::const_iterator>& coll,
34  const std::string& delim);
35 template std::string triton_utils::printColl(const std::vector<uint8_t>& coll, const std::string& delim);
36 template std::string triton_utils::printColl(const std::vector<float>& coll, const std::string& delim);
37 template std::string triton_utils::printColl(const std::unordered_set<std::string>& coll, const std::string& delim);
MessageLogger.h
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
mps_check.msg
tuple msg
Definition: mps_check.py:285
triton_utils::warnIfError
bool warnIfError(const Error &err, std::string_view msg)
Definition: triton_utils.cc:25
triton_utils::Error
nvidia::inferenceserver::client::Error Error
Definition: triton_utils.h:15
triton_utils::throwIfError
void throwIfError(const Error &err, std::string_view msg)
Definition: triton_utils.cc:20
mps_fire.end
end
Definition: mps_fire.py:242
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
triton_utils.h
gen::C
C
Definition: PomwigHadronizer.cc:78
triton_utils
Definition: triton_utils.h:13
Exception.h
cms::Exception
Definition: Exception.h:70
edm::Log
Definition: MessageLogger.h:70
edm::Span
Definition: Span.h:16
triton_utils::printColl
std::string printColl(const C &coll, const std::string &delim=", ")
Definition: triton_utils.cc:11