From 05bb51b0fabbea0a4c5c667abfeec291e84b0a0e Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Thu, 9 Oct 2025 11:28:51 +0200 Subject: [PATCH 1/2] DPL: print an error when the configuration is not parsed correctly This should probably be a fatal error not sure why the rethrown exception is ignored (and where). --- Framework/Core/src/PropertyTreeHelpers.cxx | 46 ++++++++++++++++++---- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/Framework/Core/src/PropertyTreeHelpers.cxx b/Framework/Core/src/PropertyTreeHelpers.cxx index 3f2356eb37824..c16754b216738 100644 --- a/Framework/Core/src/PropertyTreeHelpers.cxx +++ b/Framework/Core/src/PropertyTreeHelpers.cxx @@ -14,12 +14,15 @@ #include "Framework/VariantPropertyTreeHelpers.h" #include "Framework/RuntimeError.h" #include "Framework/VariantJSONHelpers.h" +#include "Framework/Signpost.h" #include #include #include +O2_DECLARE_DYNAMIC_LOG(configuration); + namespace o2::framework { namespace @@ -37,6 +40,9 @@ void PropertyTreeHelpers::populateDefaults(std::vector const& s boost::property_tree::ptree& pt, boost::property_tree::ptree& provenance) { + O2_LOG_ENABLE(configuration); + O2_SIGNPOST_ID_GENERATE(cid, configuration); + O2_SIGNPOST_START(configuration, cid, "populateDefaults", "Filling with defaults"); for (auto const& spec : schema) { std::string key = spec.name.substr(0, spec.name.find(',')); try { @@ -77,9 +83,12 @@ void PropertyTreeHelpers::populateDefaults(std::vector const& s case VariantType::String: pt.put(key, spec.defaultValue.get()); break; - case VariantType::Bool: - pt.put(key, spec.defaultValue.get()); + case VariantType::Bool: { + bool value = spec.defaultValue.get(); + O2_SIGNPOST_EVENT_EMIT(configuration, cid, "populateDefaults", "Setting %{public}s: %{public}s", key.c_str(), value ? "true" : "false"); + pt.put(key, value); break; + } case VariantType::Dict: pt.put_child(key, boost::property_tree::ptree{}); break; @@ -126,13 +135,17 @@ void PropertyTreeHelpers::populateDefaults(std::vector const& s } provenance.put(key, "default"); } catch (std::runtime_error& re) { + O2_SIGNPOST_END_WITH_ERROR(configuration, cid, "populateDefaults", "Aborting because of runtime_error %{public}s", re.what()); throw; } catch (std::exception& e) { + O2_SIGNPOST_END_WITH_ERROR(configuration, cid, "populateDefaults", "Missing option %{public}s (%{public}s)", key.c_str(), e.what()); throw std::invalid_argument(std::string("missing option: ") + key + " (" + e.what() + ")"); } catch (...) { + O2_SIGNPOST_END_WITH_ERROR(configuration, cid, "populateDefaults", "Aborting because of missing option %{public}s", key.c_str()); throw std::invalid_argument(std::string("missing option: ") + key); } } + O2_SIGNPOST_END(configuration, cid, "populateDefaults", "Done"); } void PropertyTreeHelpers::populate(std::vector const& schema, @@ -140,6 +153,9 @@ void PropertyTreeHelpers::populate(std::vector const& schema, boost::program_options::variables_map const& vmap, boost::property_tree::ptree& provenance) { + O2_LOG_ENABLE(configuration); + O2_SIGNPOST_ID_GENERATE(cid, configuration); + O2_SIGNPOST_START(configuration, cid, "populate", "Filling parameters from variables_map"); for (auto const& spec : schema) { // strip short version to get the correct key std::string key = spec.name.substr(0, spec.name.find(',')); @@ -183,9 +199,11 @@ void PropertyTreeHelpers::populate(std::vector const& schema, pt.put(key, *v); } break; - case VariantType::Bool: - pt.put(key, vmap[key].as()); - break; + case VariantType::Bool: { + auto v = vmap[key].as(); + O2_SIGNPOST_EVENT_EMIT(configuration, cid, "populate", "Setting %{public}s: %{public}s", key.c_str(), v ? "true" : "false"); + pt.put(key, v); + } break; case VariantType::ArrayInt: { auto v = fromString(vmap[key].as()); pt.put_child(key, vectorToBranch(v.get(), v.size())); @@ -243,13 +261,17 @@ void PropertyTreeHelpers::populate(std::vector const& schema, } provenance.put(key, "fairmq"); } catch (std::runtime_error& re) { + O2_SIGNPOST_END_WITH_ERROR(configuration, cid, "populate", "Aborting because of runtime_error %{public}s", re.what()); throw; } catch (std::exception& e) { + O2_SIGNPOST_END_WITH_ERROR(configuration, cid, "populate", "Missing option %{public}s (%{public}s)", key.c_str(), e.what()); throw std::invalid_argument(std::string("missing option: ") + key + " (" + e.what() + ")"); } catch (...) { + O2_SIGNPOST_END_WITH_ERROR(configuration, cid, "populate", "Aborting because of missing option %{public}s", key.c_str()); throw std::invalid_argument(std::string("missing option: ") + key); } } + O2_SIGNPOST_END(configuration, cid, "populate", "Done"); } template @@ -273,6 +295,9 @@ void PropertyTreeHelpers::populate(std::vector const& schema, boost::property_tree::ptree& provenance, std::string const& provenanceLabel) { + O2_LOG_ENABLE(configuration); + O2_SIGNPOST_ID_GENERATE(cid, configuration); + O2_SIGNPOST_START(configuration, cid, "populate", "Filling parameters from ptree"); for (auto const& spec : schema) { // strip short version to get the correct key std::string key = spec.name.substr(0, spec.name.find(',')); @@ -318,9 +343,11 @@ void PropertyTreeHelpers::populate(std::vector const& schema, case VariantType::String: pt.put(key, (*it).get_value()); break; - case VariantType::Bool: + case VariantType::Bool: { + auto v = (*it).get_value(); + O2_SIGNPOST_EVENT_EMIT(configuration, cid, "populate", "Setting %{public}s: %{public}s", key.c_str(), v ? "true" : "false"); pt.put(key, (*it).get_value()); - break; + } break; case VariantType::Dict: case VariantType::ArrayInt: case VariantType::ArrayFloat: @@ -371,13 +398,18 @@ void PropertyTreeHelpers::populate(std::vector const& schema, } provenance.put(key, provenanceLabel); } catch (std::runtime_error& re) { + O2_SIGNPOST_END_WITH_ERROR(configuration, cid, "populate", "Aborting during processing of %{public}s because of runtime_error %{public}s", + key.c_str(), re.what()); throw; } catch (std::exception& e) { + O2_SIGNPOST_END_WITH_ERROR(configuration, cid, "populate", "Missing option %{public}s (%{public}s)", key.c_str(), e.what()); throw std::invalid_argument(std::string("missing option: ") + key + " (" + e.what() + ")"); } catch (...) { + O2_SIGNPOST_END_WITH_ERROR(configuration, cid, "populate", "Aborting because of missing option %{public}s", key.c_str()); throw std::invalid_argument(std::string("missing option: ") + key); } } + O2_SIGNPOST_END(configuration, cid, "populate", "Done"); } namespace From 766150de65ce960b97691890281e7dbea45eba91 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 9 Oct 2025 09:29:38 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- Framework/Core/src/PropertyTreeHelpers.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Framework/Core/src/PropertyTreeHelpers.cxx b/Framework/Core/src/PropertyTreeHelpers.cxx index c16754b216738..05cab67bf5797 100644 --- a/Framework/Core/src/PropertyTreeHelpers.cxx +++ b/Framework/Core/src/PropertyTreeHelpers.cxx @@ -399,7 +399,7 @@ void PropertyTreeHelpers::populate(std::vector const& schema, provenance.put(key, provenanceLabel); } catch (std::runtime_error& re) { O2_SIGNPOST_END_WITH_ERROR(configuration, cid, "populate", "Aborting during processing of %{public}s because of runtime_error %{public}s", - key.c_str(), re.what()); + key.c_str(), re.what()); throw; } catch (std::exception& e) { O2_SIGNPOST_END_WITH_ERROR(configuration, cid, "populate", "Missing option %{public}s (%{public}s)", key.c_str(), e.what());