Skip to content

[6.8][ML] Do not write model size stats after autodetect no-op #517

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@

//=== Regressions

== {es} version 6.8.2

=== Bug Fixes

* Don't write model size stats when job is closed without any input {ml-pull}512[#512] (issue: {ml-issue}394[#394])

== {es} version 6.7.2

=== Enhancements
Expand Down
16 changes: 11 additions & 5 deletions lib/api/CAnomalyJob.cc
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ bool CAnomalyJob::handleRecord(const TStrStrUMap& dataRowFields) {

void CAnomalyJob::finalise() {
// Persist final state of normalizer iff an input record has been handled or time has been advanced.
if (this->isPersistenceNeeded("quantiles state")) {
if (this->isPersistenceNeeded("quantiles state and model size stats")) {
m_JsonOutputWriter.persistNormalizer(m_Normalizer, m_LastNormalizerPersistTime);
}

// Prune the models so that the final persisted state is as neat as possible
this->pruneAllModels();
// Prune the models so that the final persisted state is as neat as possible
this->pruneAllModels();

this->refreshMemoryAndReport();
this->refreshMemoryAndReport();
}

// Wait for any ongoing periodic persist to complete, so that the data adder
// is not used by both a periodic periodic persist and final persist at the
Expand Down Expand Up @@ -1258,6 +1258,12 @@ void CAnomalyJob::writeOutModelPlot(const TModelPlotDataVec& modelPlotData) {
}

void CAnomalyJob::refreshMemoryAndReport() {
if (m_LastFinalisedBucketEndTime < m_ModelConfig.bucketLength()) {
LOG_ERROR(<< "Cannot report memory usage because last finalized bucket end time ("
<< m_LastFinalisedBucketEndTime << ") is smaller than bucket span ("
<< m_ModelConfig.bucketLength() << ')');
return;
}
// Make sure model size stats are up to date and then send a final memory
// usage report
for (const auto& detector_ : m_Detectors) {
Expand Down