Skip to content
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

[Forward port to 1.3] Use current time as training data end time (#547) #556

Merged
merged 2 commits into from
May 24, 2022

Conversation

kaituo
Copy link
Collaborator

@kaituo kaituo commented May 23, 2022

Description

  • Use current time as training data end time

The bug happens because we use job enabled time as training data end time. But if the historical data before that time is deleted or does not exist at all, cold start might never finish. This PR uses current time as the training data end time so that cold start has a chance to succeed later. This PR also removes the code that combines cold start data and existing samples in EntityColdStartWorker because we don't add samples until cold start succeeds. Combining cold start data and existing samples is thus unnecessary.

Testing done:

  1. manually verified the bug is fixed.
  2. fixed all related unit tests.

Signed-off-by: Kaituo Li [email protected]

Issues Resolved

#540

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

* Use current time as training data end time

The bug happens because we use job enabled time as training data end time. But if the historical data before that time is deleted or does not exist at all, cold start might never finish. This PR uses current time as the training data end time so that cold start has a chance to succeed later. This PR also removes the code that combines cold start data and existing samples in EntityColdStartWorker because we don't add samples until cold start succeeds. Combining cold start data and existing samples is thus unnecessary.

Testing done:
1. manually verified the bug is fixed.
2. fixed all related unit tests.

Signed-off-by: Kaituo Li <[email protected]>
@kaituo kaituo requested review from amitgalitz and ylwu-amzn May 23, 2022 17:45
@kaituo kaituo changed the title Use current time as training data end time (#547) [Forward port to 1.3] Use current time as training data end time (#547) May 23, 2022
ylwu-amzn
ylwu-amzn previously approved these changes May 23, 2022
This commit removes randomization of locale for SimpleDateFormat, instead using explicit locales. The test framework randomizes locales, so the test can be ran with " ./gradlew ':integTest' --tests "org.opensearch.ad.e2e.DetectionResultEvalutationIT.testRestartHCADDetector" -Dtests.seed=3892A75781CC10EC -Dtests.security.manager=false -Dtests.locale=th-TH-u-nu-thai-x-lvariant-TH -Dtests.timezone=America/Merida -Druntime.java=14". This would cause the code to write the data string in thai locale and make bulk api fail with message "failed to parse date field [๒๕๖๕-๐๕-๒๓T๒๐:๕๖:๐๐Z] with format [strict_date_optional_time||epoch_millis]","caused_by":{"type":"date_time_parse_exception".

Signed-off-by: Kaituo Li <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented May 23, 2022

Codecov Report

Merging #556 (1950e4b) into 1.3 (210a1ab) will increase coverage by 0.27%.
The diff coverage is 50.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##                1.3     #556      +/-   ##
============================================
+ Coverage     77.75%   78.02%   +0.27%     
- Complexity     4114     4134      +20     
============================================
  Files           296      296              
  Lines         17682    17680       -2     
  Branches       1879     1881       +2     
============================================
+ Hits          13748    13795      +47     
+ Misses         3029     2988      -41     
+ Partials        905      897       -8     
Flag Coverage Δ
plugin 78.02% <50.00%> (+0.27%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...n/java/org/opensearch/ad/ml/EntityColdStarter.java 81.78% <43.75%> (-1.96%) ⬇️
.../opensearch/ad/ratelimit/CheckpointReadWorker.java 87.68% <100.00%> (+0.44%) ⬆️
.../main/java/org/opensearch/ad/ml/CheckpointDao.java 70.19% <0.00%> (+0.64%) ⬆️
...ain/java/org/opensearch/ad/task/ADTaskManager.java 77.81% <0.00%> (+1.13%) ⬆️
...ain/java/org/opensearch/ad/model/ModelProfile.java 72.72% <0.00%> (+1.81%) ⬆️
...rch/ad/transport/ForwardADTaskTransportAction.java 97.45% <0.00%> (+3.38%) ⬆️
...ava/org/opensearch/ad/task/ADHCBatchTaskCache.java 92.59% <0.00%> (+3.70%) ⬆️
...java/org/opensearch/ad/task/ADBatchTaskRunner.java 86.32% <0.00%> (+4.25%) ⬆️

@kaituo kaituo requested a review from ylwu-amzn May 23, 2022 22:48
@kaituo kaituo merged commit 264ecc9 into opensearch-project:1.3 May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants