Loading...
Searching...
No Matches
gpr::track Namespace Reference

Classes

class  JsonRecord
 A JSON object assembled field by field; one line of a record stream. More...
class  MlflowRestClient
class  MlflowRun

Functions

std::string sanitizeKey (std::string_view key)
 MLflow key alphabet: alphanumerics, underscore, dash, dot, space, slash.
std::string jsonStringField (std::string_view json, std::string_view key)
void setActiveRun (MlflowRun *run) noexcept
MlflowRun * activeRun () noexcept

Function Documentation

◆ activeRun()

MlflowRun * gpr::track::activeRun ( )
nodiscardnoexcept

Definition at line 739 of file MlflowFileStore.cpp.

740{
741 return g_active_run;
742}

◆ jsonStringField()

std::string gpr::track::jsonStringField ( std::string_view json,
std::string_view key )
nodiscard

Extract a string field from a flat JSON response ("key":"value"); empty when absent.

Definition at line 155 of file MlflowFileStore.cpp.

156{
157 const std::string needle = "\"" + std::string(key) + "\"";
158 std::size_t at = json.find(needle);
159 while (at != std::string_view::npos) {
160 std::size_t p = at + needle.size();
161 while (p < json.size() &&
162 std::isspace(static_cast<unsigned char>(json[p])))
163 ++p;
164 if (p < json.size() && json[p] == ':') {
165 ++p;
166 while (p < json.size() &&
167 std::isspace(static_cast<unsigned char>(json[p])))
168 ++p;
169 if (p < json.size() && json[p] == '"') {
170 std::string out;
171 for (++p; p < json.size() && json[p] != '"'; ++p) {
172 if (json[p] == '\\' && p + 1 < json.size()) ++p;
173 out += json[p];
174 }
175 return out;
176 }
177 return "";
178 }
179 at = json.find(needle, at + 1);
180 }
181 return "";
182}
eon_relax_band_t eon_relax_surface_fn void eon_relax_outcome_t * out
Eigen::Vector3d at(const FieldMatrixd &mat, Index_t i)

◆ sanitizeKey()

std::string gpr::track::sanitizeKey ( std::string_view key)
nodiscard

MLflow key alphabet: alphanumerics, underscore, dash, dot, space, slash.

Definition at line 141 of file MlflowFileStore.cpp.

142{
143 std::string out;
144 out.reserve(key.size());
145 for (const char c: key) {
146 const bool ok = std::isalnum(static_cast<unsigned char>(c)) ||
147 c == '_' || c == '-' || c == '.' || c == ' ' ||
148 c == '/';
149 out += ok ? c : '_';
150 }
151 if (out.empty()) out = "_";
152 return out;
153}

◆ setActiveRun()

void gpr::track::setActiveRun ( MlflowRun * run)
noexcept

The process-wide run the search components log to; nullptr when tracking is off.

Definition at line 734 of file MlflowFileStore.cpp.

735{
736 g_active_run = run;
737}