beatum opened a new pull request, #8544:
URL: https://github.com/apache/hop/pull/8544

   ## Summary
   
   During pipeline execution, a REST API request may occasionally fail. For 
example, a pipeline may use an access token or API key to retrieve data from a 
third-party service. Although credentials are typically cached or stored 
securely, access tokens can expire. When an expired token is used, the API 
request may fail with an authentication or authorization error.
   
   In some pipelines, the token can be refreshed automatically before the next 
execution attempt. To support this scenario, this PR allows the Pipeline 
Executor to retry a failed pipeline a configurable number of times, with an 
optional delay between attempts.
   
   ## Implementation
   
   ### 1. Added configurable retry settings
   
   Added the following fields to `PipelineExecutorMeta`:
   
   - `retry_attempts`: The number of additional retry attempts after the 
initial execution fails.
   - `retry_delay`: The delay between retry attempts.
   
   Serialization and default-value handling are also included.
   
   ### 2. Added retry settings to the dialog
   
   Added configuration fields for retry attempts and retry delay to 
`PipelineExecutorDialog`.
   
   Corresponding labels and tooltips were added to:
   
   ```text
   messages_en_US.properties
   ```
   
   ### 3. Updated the runtime execution flow
   
   Updated `PipelineExecutor` to retry an execution when either of the 
following conditions is met:
   
   ```java
   !result.isResult()
   ```
   
   or:
   
   ```java
   nrErrors > 0
   ```
   
   If a retry delay is configured, the executor waits before starting the next 
attempt.
   
   The existing final-result handling remains unchanged after all execution 
attempts have completed.
   
   ### 4. Added and updated tests
   
   Updated the following test files and fixtures:
   
   - `PipelineExecutorMetaTest`
   - `PipelineExecutorTest`
   - `pipeline-executor-transform.xml`
   
   The tests cover:
   
   - Retry-setting serialization
   - Default retry values
   - Successful execution without retry
   - Failed execution followed by retry
   - Retry-attempt limits
   - Final-result handling after retries are exhausted
   
   ## Example Use Case
   
   1. A pipeline calls a third-party REST API using a cached access token.
   2. The token has expired, causing the API request to fail.
   3. The pipeline's error-handling logic refreshes the token.
   4. The Pipeline Executor waits for the configured delay.
   5. The Pipeline Executor retries the pipeline using the refreshed token.
   
   ## Backward Compatibility
   
   Retry behavior is disabled by default. Existing Pipeline Executor 
configurations continue to run once unless retry attempts are explicitly 
configured.


-- 
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