forked from opensearch-project/ml-commons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change httpclient to async (opensearch-project#1958) (opensearch-proj…
…ect#2375) * Change httpclient from sync to async * Change from CRTAsyncHttpClient to NettyAsyncHttpClient * Add publisher to request * Change sync httpclient to async * Handle error case and return error response in actionLListener * Fix no response when exception * Add content type header * Fix issues found in functional test * Fix no response issue in functional test * fix default step size error * Add track inference duration for async httpclient * Change client appsec highlight issues implementation for async httpclient * Add UTs * Add UTs * Remove unused file * Add UTs * format code * Change error code to honor remote service error code * Add more UTs * Change SSRF code to make it correct for return error stattus * Fix failure UTs and add more UTs * Fix failure ITs * format code * Fix partial success response not correct issue * format code * Fix failure ITs * Add more UTs to increase code coverage * Change url regex * Address comments * format code * Fix failure UTs * Add UT for httpclientFactory throw exception when creating httpclient * format code * Address comments and add modelTensor status code * Address comments * format code * Add status code to process error response * format code * Rebase main after connector level http parameter support * Fix UT * Change error message when remote model return empty and chaange the behavior when one of the requests fails * Add comments\ * Remove redundant builder and change the error code check * format code * Add more UTs for throw exception cases * fix failure UTs * format code * Fix test cases since the error message change * Rebase code * fix failure IT * Add more UTs * Fix duplicate response to client issue * fix duplicate response in channel * change code for all successfully responses case * Address comments * format code * Increase nio httpclient version to fix vulnerbility * Change validate localhost logic to same with existing code * change method signature to private * format code --------- Signed-off-by: zane-neo <[email protected]>
- Loading branch information
Showing
21 changed files
with
1,298 additions
and
759 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/remote/ExecutionContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* | ||
* * Copyright OpenSearch Contributors | ||
* * SPDX-License-Identifier: Apache-2.0 | ||
* | ||
*/ | ||
|
||
package org.opensearch.ml.engine.algorithms.remote; | ||
|
||
import java.util.concurrent.CountDownLatch; | ||
import java.util.concurrent.atomic.AtomicReference; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
/** | ||
* This class encapsulates several parameters that are used in a split-batch request case. | ||
* A batch request is that in neural-search side multiple fields are send in one request to ml-commons, | ||
* but the remote model doesn't accept list of string inputs so in ml-commons the request needs split. | ||
* sequence is used to identify the index of the split request. | ||
* countDownLatch is used to wait for all the split requests to finish. | ||
* exceptionHolder is used to hold any exception thrown in a split-batch request. | ||
*/ | ||
@Data | ||
@AllArgsConstructor | ||
public class ExecutionContext { | ||
// Should never be null | ||
private int sequence; | ||
private CountDownLatch countDownLatch; | ||
// This is to hold any exception thrown in a split-batch request | ||
private AtomicReference<Exception> exceptionHolder; | ||
} |
Oops, something went wrong.