From 11ae7584cb0ebf18006e2ef854caaab8ba2be89d Mon Sep 17 00:00:00 2001 From: Kai-Uwe Hermann Date: Mon, 19 Aug 2024 17:04:28 +0200 Subject: [PATCH] cleanup Signed-off-by: Kai-Uwe Hermann --- everestpy/src/everest/misc.cpp | 5 +++-- include/framework/runtime.hpp | 2 -- lib/config.cpp | 5 ----- lib/module_config.cpp | 7 ------- lib/runtime.cpp | 8 ++------ 5 files changed, 5 insertions(+), 22 deletions(-) diff --git a/everestpy/src/everest/misc.cpp b/everestpy/src/everest/misc.cpp index 3558ce40..5064a273 100644 --- a/everestpy/src/everest/misc.cpp +++ b/everestpy/src/everest/misc.cpp @@ -61,9 +61,10 @@ static std::shared_ptr get_mqtt_settings_from_env() { return mqtt_settings; } -// just for compatibility... +/// This is just kept for compatibility RuntimeSession::RuntimeSession(const std::string& prefix, const std::string& config_file) : RuntimeSession() { - EVLOG_info << "called the old RuntimeSession ctor"; + EVLOG_warning << "everestpy: Usage of the old RuntimeSession ctor detected, config is now loaded via MQTT not via " + "the provided config_file."; } RuntimeSession::RuntimeSession() { diff --git a/include/framework/runtime.hpp b/include/framework/runtime.hpp index b6a700d5..29abbd5f 100644 --- a/include/framework/runtime.hpp +++ b/include/framework/runtime.hpp @@ -176,8 +176,6 @@ class ModuleLoader { std::string original_process_name; ModuleCallbacks callbacks; VersionInformation version_information; - std::string prefix_opt; - std::string config_opt; // TODO fs::path logging_config_file; bool parse_command_line(int argc, char* argv[]); diff --git a/lib/config.cpp b/lib/config.cpp index d8779231..c22c30c8 100644 --- a/lib/config.cpp +++ b/lib/config.cpp @@ -91,7 +91,6 @@ static ParsedConfigMap parse_config_map(const json& config_map_schema, const jso json_validator validator(Config::loader, Config::format_checker); validator.set_root_schema(config_entry); try { - // EVLOG_info << "parse_config_map"; auto patch = validator.validate(config_entry_value); if (!patch.is_null()) { // extend config entry with default values @@ -254,7 +253,6 @@ void ManagerConfig::load_and_validate_manifest(const std::string& module_id, con json_validator validator(Config::loader, Config::format_checker); validator.set_root_schema(this->_schemas.manifest); - // EVLOG_info << "load_and_validate_manifest: " << module_id; auto patch = validator.validate(this->manifests[module_name]); if (!patch.is_null()) { // extend manifest with default values @@ -681,7 +679,6 @@ json ManagerConfig::load_interface_file(const std::string& intf_name) { // --> validating against draft-07 will be done in an extra step below json_validator validator(Config::loader, Config::format_checker); validator.set_root_schema(this->_schemas.interface); - // EVLOG_info << "load_interface_file"; auto patch = validator.validate(interface_json); if (!patch.is_null()) { // extend config entry with default values @@ -1140,9 +1137,7 @@ json ConfigBase::extract_implementation_info(const std::string& module_id, const json info; info["module_id"] = module_id; - // EVLOG_info << "before get module name"; info["module_name"] = get_module_name(module_id); - // EVLOG_info << "after"; info["impl_id"] = impl_id; info["impl_intf"] = ""; diff --git a/lib/module_config.cpp b/lib/module_config.cpp index cc8c9a88..f9df0c53 100644 --- a/lib/module_config.cpp +++ b/lib/module_config.cpp @@ -75,9 +75,6 @@ json ModuleConfig::get_config(std::shared_ptr mqtt_settings, const } mqtt.spawn_main_loop_thread(); - // TODO: move this to its own function - - // START get config auto get_config_topic = fmt::format("{}modules/{}/get_config", mqtt_settings->mqtt_everest_prefix, module_id); auto config_topic = fmt::format("{}modules/{}/config", mqtt_settings->mqtt_everest_prefix, module_id); std::promise res_promise; @@ -119,10 +116,8 @@ json ModuleConfig::get_config(std::shared_ptr mqtt_settings, const auto interface_names_topic = fmt::format("{}interfaces", mqtt_settings->mqtt_everest_prefix); auto interface_names = mqtt.get(interface_names_topic, QOS::QOS2); - // EVLOG_info << "interface names from mqtt: " << interface_names.dump(); auto interface_definitions = json::object(); for (auto& interface : interface_names) { - // EVLOG_info << "interface: " << interface; auto interface_topic = fmt::format("{}interface_definitions/{}", mqtt_settings->mqtt_everest_prefix, interface.get()); auto interface_definition = mqtt.get(interface_topic, QOS::QOS2); @@ -130,8 +125,6 @@ json ModuleConfig::get_config(std::shared_ptr mqtt_settings, const } result["interface_definitions"] = interface_definitions; - // just get all the interfaces into this interface definitions struct - // TODO: maybe only get the ones we actually need auto module_provides_topic = fmt::format("{}module_provides", mqtt_settings->mqtt_everest_prefix); auto module_provides = mqtt.get(module_provides_topic, QOS::QOS2); diff --git a/lib/runtime.cpp b/lib/runtime.cpp index a7b78117..bd67475d 100644 --- a/lib/runtime.cpp +++ b/lib/runtime.cpp @@ -413,8 +413,6 @@ int ModuleLoader::initialize() { } auto& rs = this->runtime_settings; - // FIXME: get this logging_config_file from command line since we cannot re-init later! - // Logging::init(rs->logging_config_file.string(), this->module_id); try { Config config = Config(this->mqtt_settings, result); auto config_instantiation_time = std::chrono::system_clock::now(); @@ -429,7 +427,7 @@ int ModuleLoader::initialize() { } const std::string module_identifier = config.printable_identifier(this->module_id); - EVLOG_info << fmt::format("Initializing framework for module {}...", module_identifier); + EVLOG_debug << fmt::format("Initializing framework for module {}...", module_identifier); EVLOG_verbose << fmt::format("Setting process name to: '{}'...", module_identifier); int prctl_return = prctl(PR_SET_NAME, module_identifier.c_str()); if (prctl_return == 1) { @@ -442,7 +440,7 @@ int ModuleLoader::initialize() { rs->telemetry_enabled); // module import - EVLOG_info << fmt::format("Initializing module {}...", module_identifier); + EVLOG_debug << fmt::format("Initializing module {}...", module_identifier); if (!everest.connect()) { if (this->mqtt_settings->mqtt_broker_socket_path.empty()) { @@ -674,8 +672,6 @@ bool ModuleLoader::parse_command_line(int argc, char* argv[]) { this->logging_config_file = assert_file(default_logging_config_file, "Default logging config"); } - this->prefix_opt = parse_string_option(vm, "prefix"); - this->config_opt = parse_string_option(vm, "config"); this->original_process_name = argv[0]; if (vm.count("module") != 0) {