-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
[ML] Make GetJobStats work with arbitrary wildcards and groups #36683
Conversation
fixing match function to use expandedJobId instead of a single jobid
Pinging @elastic/ml-core |
In my commit instead of 'expandedJobsIds[i]' it's expandedJobsIds.get(i). All tests pass with the code submited. P.s:Already made a commit editing the mistake mention above. |
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.
I am not sure what which tests @davidkyle was mentioning in the issue.
I know we have tests here: https://github.com/elastic/elasticsearch/blob/master/client/rest-high-level/src/test/java/org/elasticsearch/client/MachineLearningIT.java but those are more for ensuring the client acts correctly, not that the job stats are handled appropriately.
@@ -118,7 +118,12 @@ public boolean allowNoJobs() { | |||
|
|||
@Override | |||
public boolean match(Task task) { | |||
return OpenJobAction.JobTaskMatcher.match(task, jobId); | |||
for(int i = 0; i < expandedJobsIds.size(); i++) |
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.
This can be reduced to a single line using stream().anyMatch
for(int i = 0; i < expandedJobsIds.size(); i++) | |
return expandedJobsIds.stream().anyMatch(jobId -> OpenJobAction.JobTaskMatcher.match(task, jobId)); |
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.
Will commit the changes thx for the review!
Jenkins test this please |
@up201608320 Thanks for taking a look at this issue. Looking at You can rerun these with:
Relevant test is here: elasticsearch/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/job_groups.yml Line 242 in 4103d3b
I ran the test locally against master and it passed. So, either your change is causing the failure, or some past commit (that has since been corrected) caused the failure and you need to merge in the latest master into your branch. Documentation on how the test formatting is here: https://github.com/elastic/elasticsearch/blob/master/rest-api-spec/src/main/resources/rest-api-spec/test/README.asciidoc From what I can see, it is a simple re-ordering issue. |
The failing test in with master https://github.com/elastic/elasticsearch/blob/master/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportGetJobsStatsAction.java#L151 where the call to Actually this call is also missing from the master branch https://github.com/elastic/elasticsearch/blob/6.x/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportGetJobsStatsAction.java#L100 I assume this change has somehow affected the ordering causing the tests to fail which is good as it has revealed an issue. As for testing this change a unit test added to |
@up201608320 I raised #36841 to fix the ordering of the GET job stats response. Once that is merged please rebase your change on the master branch and the test failure will go away |
@up201608320 #36841 is now merged. If you pull the latest master branch, then merge it into your PR branch then hopefully this PR will pass CI and can be merged. |
Jenkins test this please |
Jenkins run elasticsearch-ci/default-distro |
1 similar comment
Jenkins run elasticsearch-ci/default-distro |
Jenkins test this please |
Jenkins test this please |
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.
LGTM
The /_ml/anomaly_detectors/{job}/_stats endpoint now works correctly when {job} is a wildcard or job group. Closes #34745
Fixing match function to use expandedJobId instead of a single jobid.
Closes #34745