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

[ML] Improving existing job check in anomaly detection wizard #87674

Conversation

jgowdyelastic
Copy link
Member

@jgowdyelastic jgowdyelastic commented Jan 7, 2021

The new job wizards for anomaly detection jobs now use the /api/ml/jobs/jobs_exist endpoint as the user is typing, rather than using a preloaded list of existing jobs.

When entering a job ID, a user cannot use a job or group ID that has already been used in any space.
When entering a group ID, the user cannot use an ID that has been used as a job ID in any space. Reusing a group ID is fine as it'll just add the new job to the existing group.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@jgowdyelastic
Copy link
Member Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@jgowdyelastic
Copy link
Member Author

@elasticmachine merge upstream

@peteharverson
Copy link
Contributor

When logged into a non-Default space, I am seeing this error in the server console when typing in an ID which exists only in the Default space (Single metric job wizard):

image

And in the network tab I see:

{"statusCode":500,"error":"Internal Server Error","message":"Cannot read property 'includes' of undefined"}

Comment on lines 68 to 71
const message =
jobValidator.groupIds.message === undefined
? jobValidator.latestValidationResult.groupIdsExist?.message
: jobValidator.groupIds.message;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const message =
jobValidator.groupIds.message === undefined
? jobValidator.latestValidationResult.groupIdsExist?.message
: jobValidator.groupIds.message;
const message = jobValidator.groupIds.message ?? jobValidator.latestValidationResult.groupIdsExist?.message;

@jgowdyelastic
Copy link
Member Author

@elasticmachine merge upstream

@peteharverson
Copy link
Contributor

Can this check be extended to the groups control of the edit job flyout? Currently you don't get an in-form error if you try to add a group which already exists as a job ID in another space:

image

…s' of github.com:jgowdyelastic/kibana into improving-existing-job-jobs-in-anomaly-detection-wizards
@jgowdyelastic
Copy link
Member Author

jgowdyelastic commented Jan 14, 2021

@peteharverson

Can this check be extended to the groups control of the edit job flyout? Currently you don't get an in-form error if you try to add a group which already exists as a job ID in another space

added group id check to the edit job flyout in 6029c11

It is also possible to add a group using the multi-select controls in the jobs list.
Adding async validation to this component is quite a bit of work, so much so that it'd probably be worth completely rewriting the component in typescript and so is outside of the scope of this PR.

I think the current behaviour is acceptable. Jobs in the current space are checked for duplication but if you attempt to add a group which already exists as a job id in a different space, when you try to apply the changes a toast is displayed.

Copy link
Contributor

@darnautov darnautov left a comment

Choose a reason for hiding this comment

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

Code LGTM, just one small suggestion

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested latest changes and LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
ml 7.1MB 7.1MB +2.7KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@jgowdyelastic jgowdyelastic merged commit 686ece9 into elastic:master Jan 15, 2021
@jgowdyelastic jgowdyelastic deleted the improving-existing-job-jobs-in-anomaly-detection-wizards branch January 15, 2021 12:57
jgowdyelastic added a commit to jgowdyelastic/kibana that referenced this pull request Jan 15, 2021
…c#87674)

* [ML] Improving existing job check in anomaly detection wizard

* fixing job id validation

* allow group ids to be reused

* updating module exists endpoint

* fixing issuse with job without group list

* fixing test and translation ids

* fixing validator when model plot is disabled

* changes based on review

* adding group id check to edit job flyout

* small refactor and fixing edit job issue

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
jgowdyelastic added a commit that referenced this pull request Jan 15, 2021
#88457)

* [ML] Improving existing job check in anomaly detection wizard

* fixing job id validation

* allow group ids to be reused

* updating module exists endpoint

* fixing issuse with job without group list

* fixing test and translation ids

* fixing validator when model plot is disabled

* changes based on review

* adding group id check to edit job flyout

* small refactor and fixing edit job issue

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
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.

5 participants