diff --git a/libs/node/src/ecflow/node/AvisoAttr.cpp b/libs/node/src/ecflow/node/AvisoAttr.cpp index a5c5eb369..321aebac5 100644 --- a/libs/node/src/ecflow/node/AvisoAttr.cpp +++ b/libs/node/src/ecflow/node/AvisoAttr.cpp @@ -93,6 +93,14 @@ void AvisoAttr::reset() { } } +void AvisoAttr::reload() { + if (controller_) { + state_change_no_ = Ecf::incr_state_change_no(); + finish(); + start(); + } +} + bool AvisoAttr::isFree() const { if (controller_ == nullptr) { diff --git a/libs/node/src/ecflow/node/AvisoAttr.hpp b/libs/node/src/ecflow/node/AvisoAttr.hpp index 4c8e33245..aa11e392b 100644 --- a/libs/node/src/ecflow/node/AvisoAttr.hpp +++ b/libs/node/src/ecflow/node/AvisoAttr.hpp @@ -56,6 +56,8 @@ class AvisoAttr { static constexpr const char* default_polling = "%ECF_AVISO_POLLING%"; static constexpr const char* default_auth = "%ECF_AVISO_AUTH%"; + static constexpr const char* reload_option_value = "reload"; + static bool is_valid_name(const std::string& name); /** @@ -98,8 +100,19 @@ class AvisoAttr { bool why(std::string& theReasonWhy) const; + /** + * Initialises the Aviso procedure, which effectively starts the background polling mechanism. + * Typically, called when traversing the tree -- does nothing if Aviso service is already set up. + */ void reset(); + /** + * Restarts the Aviso procedure, which effectively stops before restarting the background polling mechanism. + * Typicallly, called explicitly via Alter command -- forces the reinitialisation of the Aviso service, + * guaranteeing that parameters, given as ECF variables, are reevaluated. + */ + void reload(); + [[nodiscard]] bool isFree() const; void start() const; diff --git a/libs/node/src/ecflow/node/NodeChange.cpp b/libs/node/src/ecflow/node/NodeChange.cpp index 8befadb15..6f31e9c4f 100644 --- a/libs/node/src/ecflow/node/NodeChange.cpp +++ b/libs/node/src/ecflow/node/NodeChange.cpp @@ -172,7 +172,11 @@ void Node::changeAviso(const std::string& name, const std::string& value) { throw std::runtime_error("Node::changeAviso: Could not find aviso " + name); } - *found = AvisoParser::parse_aviso_line(value, name); + if (value == AvisoAttr::reload_option_value) { + found->reload(); + } else { + *found = AvisoParser::parse_aviso_line(value, name); + } state_change_no_ = Ecf::incr_state_change_no(); }