Skip to content

Commit

Permalink
Enable reloading of Aviso configuration
Browse files Browse the repository at this point in the history
Re ECFLOW-1986
  • Loading branch information
marcosbento committed Nov 14, 2024
1 parent 0db490b commit 9948ab5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
8 changes: 8 additions & 0 deletions libs/node/src/ecflow/node/AvisoAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
13 changes: 13 additions & 0 deletions libs/node/src/ecflow/node/AvisoAttr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion libs/node/src/ecflow/node/NodeChange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 9948ab5

Please sign in to comment.