-
Notifications
You must be signed in to change notification settings - Fork 66
[ML] Correct handling of config updates #2821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* Enable updating of custom rules * Correctly update filters (scoped rules) These changes fix a bug whereby memory corruption was caused when updating filters for an open job. The bug had previously been masked by code that reset the job's analysis config to its original state after every config update - the downside of this was that custom rules could not be updated on the fly, only by stopping and restarting the job.
Avoid explicitly specifying the template arguments by relying on the class template argument deduction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job on fixing the bug. I have just a few minor comments.
//! Return a JSON string representing the analysis config | ||
const std::string& getAnalysisConfig(); | ||
|
||
//! Reparse the detector configuration object from within a stored | ||
//! string representing the analysis config object. | ||
//! This is necessary to correctly reinitialise scoped rule objects | ||
//! folowing an update of the fiter rules configuration. | ||
bool reparseDetectorsFromStoredConfig(const std::string& analysisConfig); | ||
|
||
void setConfig(const std::string& analysisConfigString) { | ||
m_AnalysisConfigString = analysisConfigString; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please leave a comment in this PR on why do you remove those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code to set
, get
and reparse
analysis config was introduced as part of the work to upgrade from boost 1.77 to 1.83. That upgrade included a major rewrite of boost unordered containers. Unfortunately it broke behaviour that we had come to rely on related to updating analysis config during a jobs' active lifetime. As a workaround the analysis config was reset to its previous state after an update, while allowing filter rules config to be updated. This PR provides a correct fix for the filter rules update, which also allows the analysis config to be updated safely as well. Therefore any code related to resetting the analysis config to its previous state is no longer needed.
lib/api/CConfigUpdater.cc
Outdated
json::object obj = doc.as_object(); | ||
for (json::object obj = doc.as_object(); const auto& kv : obj) { | ||
if (kv.key() == CAnomalyJobConfig::MODEL_PLOT_CONFIG) { | ||
LOG_DEBUG(<< "Updating model plot config"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOG_DEBUG(<< "Updating model plot config"); | |
LOG_TRACE(<< "Updating model plot config"); |
|
* Enable updating of custom rules * Correctly update filters (scoped rules) These changes fix a bug whereby memory corruption was caused when updating filters for an open job. The bug had previously been masked by code that reset the job's analysis config to its original state after every config update - the downside of this was that custom rules could not be updated on the fly, only by stopping and restarting the job.
* Enable updating of custom rules * Correctly update filters (scoped rules) These changes fix a bug whereby memory corruption was caused when updating filters for an open job. The bug had previously been masked by code that reset the job's analysis config to its original state after every config update - the downside of this was that custom rules could not be updated on the fly, only by stopping and restarting the job.
* Enable updating of custom rules * Correctly update filters (scoped rules) These changes fix a bug whereby memory corruption was caused when updating filters for an open job. The bug had previously been masked by code that reset the job's analysis config to its original state after every config update - the downside of this was that custom rules could not be updated on the fly, only by stopping and restarting the job.
* Enable updating of custom rules * Correctly update filters (scoped rules) These changes fix a bug whereby memory corruption was caused when updating filters for an open job. The bug had previously been masked by code that reset the job's analysis config to its original state after every config update - the downside of this was that custom rules could not be updated on the fly, only by stopping and restarting the job.
* Enable updating of custom rules * Correctly update filters (scoped rules) These changes fix a bug whereby memory corruption was caused when updating filters for an open job. The bug had previously been masked by code that reset the job's analysis config to its original state after every config update - the downside of this was that custom rules could not be updated on the fly, only by stopping and restarting the job. Backports #2821
* Enable updating of custom rules * Correctly update filters (scoped rules) These changes fix a bug whereby memory corruption was caused when updating filters for an open job. The bug had previously been masked by code that reset the job's analysis config to its original state after every config update - the downside of this was that custom rules could not be updated on the fly, only by stopping and restarting the job. Backports #2821
* Enable updating of custom rules * Correctly update filters (scoped rules) These changes fix a bug whereby memory corruption was caused when updating filters for an open job. The bug had previously been masked by code that reset the job's analysis config to its original state after every config update - the downside of this was that custom rules could not be updated on the fly, only by stopping and restarting the job. Backports #2821
* Enable updating of custom rules * Correctly update filters (scoped rules) These changes fix a bug whereby memory corruption was caused when updating filters for an open job. The bug had previously been masked by code that reset the job's analysis config to its original state after every config update - the downside of this was that custom rules could not be updated on the fly, only by stopping and restarting the job. Backports #2821
* Enable updating of custom rules * Correctly update filters (scoped rules) These changes fix a bug whereby memory corruption was caused when updating filters for an open job. The bug had previously been masked by code that reset the job's analysis config to its original state after every config update - the downside of this was that custom rules could not be updated on the fly, only by stopping and restarting the job. Backports #2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect. Relates elastic/ml-cpp#2821
These changes fix a bug whereby memory corruption was caused when updating filters for an open job. The bug had previously been masked by code that reset the job's analysis config to its original state after every config update - the downside of this was that custom rules could not be updated on the fly, only by stopping and restarting the job.
Closes #2741
Initially opening as a draft PR to see how it behaves against the ES integration tests.