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  using std::begin;
15  using std::end;
16  std::stringstream msg;
17  //avoid trailing delim
18  std::copy(begin(coll), end(coll), std::experimental::make_ostream_joiner(msg, delim));
19  return msg.str();
20  }
21 
22  void throwIfError(const Error& err, std::string_view msg) {
23  if (!err.IsOk())
24  throw cet::exception("TritonServerFailure") << msg << ": " << err;
25  }
26 
27  bool warnIfError(const Error& err, std::string_view msg) {
28  if (!err.IsOk())
29  MF_LOG_WARNING("TritonServerWarning") << msg << ": " << err;
30  return err.IsOk();
31  }
32 
33 } // namespace triton_utils
34 
36  const std::string& delim);
37 template std::string triton_utils::printColl(const std::vector<uint8_t>& coll, const std::string& delim);
38 template std::string triton_utils::printColl(const std::vector<float>& coll, const std::string& delim);
39 template std::string triton_utils::printColl(const std::unordered_set<std::string>& coll, const std::string& delim);
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
string delim()
Definition: fcldump.cxx:40
void msg(const char *fmt,...)
Definition: message.cpp:107
std::string printColl(const C &coll, const std::string &delim)
Definition: triton_utils.cc:11
std::string string
Definition: nybbler.cc:12
bool warnIfError(const Error &err, std::string_view msg)
Definition: triton_utils.cc:27
intermediate_table::const_iterator const_iterator
void throwIfError(const Error &err, std::string_view msg)
Definition: triton_utils.cc:22
nvidia::inferenceserver::client::Error Error
Definition: triton_utils.h:15
void err(const char *fmt,...)
Definition: message.cpp:226
T copy(T const &v)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
#define MF_LOG_WARNING(category)
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33