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

Return 400 on failed training request #168

Merged
merged 3 commits into from
Nov 1, 2021

Conversation

jmazanec15
Copy link
Member

Description

PR changes validation logic to throw 400 error codes as opposed to 500 errors codes during training.

In RestTrainModelHandler, change parser.text to parser.textOrNull to allow a user to pass in a null string argument. Validation is then done later.

In training request execution, throw a validation exception if there is no training capacity. This results in a 400 error being returned

Check List

  • Commits are signed as per the DCO using --signoff

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.

@codecov-commenter
Copy link

Codecov Report

Merging #168 (5b62017) into main (549b8ac) will decrease coverage by 0.09%.
The diff coverage is 33.33%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #168      +/-   ##
============================================
- Coverage     82.66%   82.57%   -0.10%     
  Complexity      803      803              
============================================
  Files           117      117              
  Lines          3582     3586       +4     
  Branches        338      338              
============================================
  Hits           2961     2961              
- Misses          466      470       +4     
  Partials        155      155              
Impacted Files Coverage Δ
...in/transport/TrainingJobRouterTransportAction.java 80.00% <0.00%> (-3.73%) ⬇️
...org/opensearch/knn/training/TrainingJobRunner.java 54.54% <0.00%> (-1.71%) ⬇️
...nsearch/knn/plugin/rest/RestTrainModelHandler.java 61.90% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 549b8ac...5b62017. Read the comment docs.

@@ -82,7 +83,9 @@ public void execute(TrainingJob trainingJob, ActionListener<IndexResponse> liste
// the number of training jobs that enter this function. Although the training threadpool size will also prevent
// this, we want to prevent this before we perform any serialization.
if (!semaphore.tryAcquire()) {
throw new RejectedExecutionException("Unable to run training job: No training capacity on node.");
ValidationException exception = new ValidationException();
exception.addValidationError("Unable to run training job: No training capacity on node.");
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to print node name?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, that information is not readily available.

Copy link
Member

Choose a reason for hiding this comment

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

Should we log the error as log.info?

@jmazanec15 jmazanec15 requested a review from vamshin November 1, 2021 16:32
Copy link
Member

@vamshin vamshin left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks

@jmazanec15 jmazanec15 merged commit f9fa5e6 into opensearch-project:main Nov 1, 2021
@naveentatikonda naveentatikonda added the Bug Fixes Changes to a system or product designed to handle a programming bug/glitch label Nov 12, 2021
martin-gaievski pushed a commit to martin-gaievski/k-NN that referenced this pull request Mar 7, 2022
martin-gaievski pushed a commit to martin-gaievski/k-NN that referenced this pull request Mar 7, 2022
martin-gaievski pushed a commit to martin-gaievski/k-NN that referenced this pull request Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fixes Changes to a system or product designed to handle a programming bug/glitch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants