Skip to content

[ML] inference only persist if there are stats#54752

Merged
benwtrent merged 7 commits intoelastic:masterfrom
benwtrent:feature/ml-inference-only-persist-if-there-are-stats
Apr 13, 2020
Merged

[ML] inference only persist if there are stats#54752
benwtrent merged 7 commits intoelastic:masterfrom
benwtrent:feature/ml-inference-only-persist-if-there-are-stats

Conversation

@benwtrent
Copy link
Copy Markdown
Member

@benwtrent benwtrent commented Apr 3, 2020

We needlessly send documents to be persisted. If there are no stats added, then we should not attempt to persist them.

closes #54786

@benwtrent benwtrent added >non-issue :ml Machine learning v8.0.0 labels Apr 3, 2020
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/ml-core (:ml)

@benwtrent
Copy link
Copy Markdown
Member Author

benwtrent commented Apr 3, 2020

I am adding this directly in the backport of the original stats persistence PR:

#54738

EDIT: No I am not. Will backport this PR instead

@benwtrent
Copy link
Copy Markdown
Member Author

@elasticmachine update branch

Copy link
Copy Markdown
Contributor

@dimitris-athanasiou dimitris-athanasiou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

modelId,
null,
timeStamp == null ? Instant.now() : Instant.ofEpochMilli(Double.valueOf(timeStamp.getValue()).longValue())
timeStamp == null || (Numbers.isValidDouble(timeStamp.getValue()) == false) ?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for timestamp to be an invalid number here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is. The agg could have not found any values, or the values they found were changed somehow. This type of check is effectively what aggs do under the hood when they serialize to JSON to protect against goofy doubles. The difference here is that we write out now() instead of null

Copy link
Copy Markdown
Contributor

@dimitris-athanasiou dimitris-athanasiou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Second time lucky!

@benwtrent
Copy link
Copy Markdown
Member Author

run elasticsearch-ci/1
run elasticsearch-ci/2

@benwtrent benwtrent merged commit 942e688 into elastic:master Apr 13, 2020
@benwtrent benwtrent deleted the feature/ml-inference-only-persist-if-there-are-stats branch April 13, 2020 16:55
benwtrent added a commit to benwtrent/elasticsearch that referenced this pull request Apr 13, 2020
We needlessly send documents to be persisted. If there are no stats added, then we should not attempt to persist them.

Also, this PR fixes the race condition that caused issue:  elastic#54786
benwtrent added a commit that referenced this pull request Apr 13, 2020
We needlessly send documents to be persisted. If there are no stats added, then we should not attempt to persist them.

Also, this PR fixes the race condition that caused issue:  #54786
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] InferenceIngestIT.testPipelineIngest occasionally fails

4 participants