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.
Implementing retry for remote connector to mitigate throttling issue (o…
…pensearch-project#2462) * use retryable action; execution context Signed-off-by: zhichao-aws <zhichaog@amazon.com> * change to groupedActionListener Signed-off-by: zhichao-aws <zhichaog@amazon.com> * fix group Signed-off-by: zhichao-aws <zhichaog@amazon.com> * retry policy Signed-off-by: zhichao-aws <zhichaog@amazon.com> * base time Signed-off-by: zhichao-aws <zhichaog@amazon.com> * retry option, cluster settings Signed-off-by: zhichao-aws <zhichaog@amazon.com> * nit Signed-off-by: zhichao-aws <zhichaog@amazon.com> * lint Signed-off-by: zhichao-aws <zhichaog@amazon.com> * change interface to class Signed-off-by: zhichao-aws <zhichaog@amazon.com> * fix ut due to code change Signed-off-by: zhichao-aws <zhichaog@amazon.com> * license header Signed-off-by: zhichao-aws <zhichaog@amazon.com> * add ut Signed-off-by: zhichao-aws <zhichaog@amazon.com> * add test Signed-off-by: zhichao-aws <zhichaog@amazon.com> * fix core interface Signed-off-by: zhichao-aws <zhichaog@amazon.com> * test Signed-off-by: zhichao-aws <zhichaog@amazon.com> * license header Signed-off-by: zhichao-aws <zhichaog@amazon.com> * use exception holder Signed-off-by: zhichao-aws <zhichaog@amazon.com> * add max retry times settings Signed-off-by: zhichao-aws <zhichaog@amazon.com> * fix typo Signed-off-by: zhichao-aws <zhichaog@amazon.com> * nit Signed-off-by: zhichao-aws <zhichaog@amazon.com> * change the order to avoid misleading log Signed-off-by: zhichao-aws <zhichaog@amazon.com> * license header Signed-off-by: zhichao-aws <zhichaog@amazon.com> * move settings to connector Signed-off-by: zhichao-aws <zhichaog@amazon.com> * remove settings Signed-off-by: zhichao-aws <zhichaog@amazon.com> * add test Signed-off-by: zhichao-aws <zhichaog@amazon.com> * add retry_backoff_policy setting Signed-off-by: zhichao-aws <zhichaog@amazon.com> * changes for comments Signed-off-by: zhichao-aws <zhichaog@amazon.com> * fix retry times Signed-off-by: zhichao-aws <zhichaog@amazon.com> * make the error handling more neat in MLSdkAsyncHttpResponseHandler Signed-off-by: zhichao-aws <zhichaog@amazon.com> * change to SageMakerThrottlingException Signed-off-by: zhichao-aws <zhichaog@amazon.com> * use enum for retry backoff policy Signed-off-by: zhichao-aws <zhichaog@amazon.com> * fix seconds to milliseconds in equal jitter policy Signed-off-by: zhichao-aws <zhichaog@amazon.com> * disable retry by default Signed-off-by: zhichao-aws <zhichaog@amazon.com> --------- Signed-off-by: zhichao-aws <zhichaog@amazon.com>
- Loading branch information
1 parent
865a424
commit 399825f
Showing
19 changed files
with
940 additions
and
441 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
22 changes: 22 additions & 0 deletions
22
common/src/main/java/org/opensearch/ml/common/connector/RetryBackoffPolicy.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,22 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.ml.common.connector; | ||
|
||
import java.util.Locale; | ||
|
||
public enum RetryBackoffPolicy { | ||
CONSTANT, | ||
EXPONENTIAL_EQUAL_JITTER, | ||
EXPONENTIAL_FULL_JITTER; | ||
|
||
public static RetryBackoffPolicy from(String value) { | ||
try { | ||
return RetryBackoffPolicy.valueOf(value.toUpperCase(Locale.ROOT)); | ||
} catch (Exception e) { | ||
throw new IllegalArgumentException("Unsupported retry backoff policy"); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.