goutamadwant opened a new issue, #12190:
URL: https://github.com/apache/seatunnel/issues/12190

   ### Search before asking
   
   - [x] Searched existing issues and PRs and found no issue or active PR for 
this specific retry-forwarding defect. This is a focused follow-up to merged 
#10863.
   
   ### What happened
   
   The `AMAZON` path in `EmbeddingTransform.open()` does not pass the 
configured invocation options into `BedrockModel`. The model therefore uses the 
default single SeaTunnel attempt even when `model_retry_max_attempts` requests 
additional attempts.
   
   This matters for embedding pipelines using the common retry settings to 
recover from transient model failures. Other providers already receive the 
invocation options; the Amazon construction path drops them.
   
   ### SeaTunnel Version
   
   Reproduced against `dev` at `8bea8c681cacccbd99fa642ca0853718980b9234`. 
Released-version coverage has not been established.
   
   ### SeaTunnel Config
   
   The reproduction constructs the actual transform with these options, a 
single STRING `text` field, and a local HTTP endpoint allocated by the test:
   
   ```hocon
   model_provider = AMAZON
   model = "amazon.titan-embed-text-v2:0"
   aws_region = "us-east-1"
   api_key = "test-access-key"
   secret_key = "test-secret-key"
   dimension = 2
   vectorization_fields { vector = text }
   model_retry_max_attempts = 3
   model_retry_backoff_ms = 0
   model_retry_max_backoff_ms = 0
   model_request_timeout_ms = 5000
   ```
   
   These credentials and the two-dimensional vector are synthetic fixture 
values, not a configuration to send to AWS. The test sets `api_path` to its 
loopback server; no AWS account or paid model service is needed.
   
   ### Reproduction
   
   1. Construct `EmbeddingTransform` with the options above and map one row 
containing `test document`.
   2. The local server queues two HTTP 424 responses with `x-amzn-errortype: 
ModelErrorException` and a temporary-error message.
   3. It then queues HTTP 200 with `{"embedding":[0.25,0.5]}`.
   4. On the original production code, mapping fails after the first HTTP 
request instead of reaching the successful third response. This was reproduced 
on both Java 8 and Java 11.
   
   HTTP 424 in this fixture is retryable by SeaTunnel's adapter, but is not 
retried by the SDK's default HTTP retry policy. That separates SeaTunnel 
attempts from SDK-internal retries.
   
   ### Running Command
   
   The compare contains 
`seatunnel-transforms-v2/src/test/java/org/apache/seatunnel/transform/embedding/AmazonEmbeddingInvocationTest.java`.
 After the usual repository dependency setup:
   
   ```shell
   ./mvnw -B -ntp -pl seatunnel-transforms-v2 \
     -Dskip.spotless=true \
     
'-Dtest=AmazonEmbeddingInvocationTest#shouldApplyConfiguredRetriesThroughTransform'
 test
   ```
   
   For a red/green comparison in an isolated baseline checkout, apply only that 
regression test file, leaving production sources unchanged, and run the same 
test. Then run it with the compare's production change.
   
   ### Error Exception
   
   The baseline failure includes:
   
   ```text
   java.lang.RuntimeException: Failed to data vectorization
   Caused by: ModelInvocationException: Model invocation failed:
   provider=BEDROCK, errorType=TEMPORARY_REMOTE_ERROR,
   retryable=true, httpStatus=424
   ```
   
   ### Expected behavior and proposed fix
   
   Pass the invocation options through the existing client factory and existing 
model constructor. Read model ID, dimension, and batch-size configuration 
before allocating the client.
   
   Before: three configured attempts still fail on the first retryable response.
   
   After: the same fixture makes three requests and returns the expected 
vector. Exhaustion is bounded by the configured attempt count. Omitting retry 
settings still uses one SeaTunnel attempt.
   
   Existing public constructors, dependencies, credentials, endpoints, 
batching, schema, client ownership, and SDK HTTP retry policy remain unchanged. 
Explicitly configured additional attempts can incur additional model charges; 
EN/ZH documentation and upgrade notes explain this behavior correction.
   
   Timeout enforcement is outside this fix. `model_request_timeout_ms` remains 
unapplied to Bedrock SDK calls. This is not a timeout or prompt-cancellation 
fix.
   
   ### Zeta or Flink or Spark Version
   
   Engine-independent transform/SDK reproduction. No full distributed engine 
deployment was used.
   
   ### Java or Scala Version
   
   Reproduced and validated on actual Java 8 (Corretto 1.8.0_504) and Java 11 
(Temurin 11.0.32.1), not Java 21 substitutes.
   
   ### Validation
   
   - Complete transform suite: 1,117 tests on each Java version, zero failures, 
errors, or skips.
   - Eight new tests cover recovery, exhaustion, the unchanged default, 
nonretryable authentication/malformed/missing-vector errors, external-interrupt 
preservation without another HTTP request, and config validation before client 
construction.
   - Tests use the actual transform and AWS SDK against local HTTP fixtures, 
not just private-method mocks.
   - Repository Spotless and full-repository `./mvnw -q -DskipTests verify` 
passed. The latter ran on Java 11 and skips tests; it is separate from the Java 
8/11 transform suites.
   
   ### Implementation
   
   [Reviewable compare 
branch](https://github.com/apache/seatunnel/compare/dev...goutamadwant:fix/amazon-embedding-retries).
 A PR will be linked after review.
   
   ### Are you willing to submit PR?
   
   - [x] Yes, I am willing to submit a PR.
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to