- Newest
- Most votes
- Most comments
AWS Step Functions provides several options for handling failed Glue jobs within your state machine workflows:
- Built-in Retry Functionality: You can configure retry logic directly in your Step Functions state machine for Glue tasks. You can add retriers to action states that specify:
- Which errors should trigger retries
- The interval before the first retry attempt
- Maximum number of retry attempts
- Backoff rate to increase the interval between retries
-
Redrive Capability: For Standard Workflows, you can use the redrive feature to restart executions that failed, were aborted, or timed out within the last 14 days. When you redrive an execution, Step Functions continues from the unsuccessful step using the same input, preserving the results and execution history of successful steps. This means only the failed Glue job would be rerun, not the entire workflow.
-
Error Handling with Catch: You can implement catch blocks in your state machine to handle specific errors from your Glue jobs. This allows you to:
- Process the error payload in a Lambda function
- Determine the type of error (e.g., business validation vs. dependency outage)
- Direct the workflow to different paths based on the error type
-
Choice State Pattern: After catching an error, you can use a Choice state to determine the next steps based on the error type. For example, if a Glue job fails due to a dependency issue, you could route to a retry state; if it's a business validation error, you might proceed to a different path.
-
Manual Intervention: You can implement a callback pattern where the workflow pauses at the failure point, allowing you to make necessary fixes to your Glue job, and then manually trigger the continuation of the workflow from that point.
To "mark" a state as successful and move forward from a failure point, you can:
- Use the redrive feature, which will continue from the failed step
- Implement a Choice state after error handling that can skip previously completed steps
- Design your state machine with checkpoints that store execution progress in an external system (like DynamoDB), allowing you to resume from specific points
These approaches give you flexibility in handling Glue job failures within Step Functions, whether you need automatic retries or manual intervention with the ability to continue from failure points.
Sources
Step Function Error Handling | AWS re:Post
Restarting state machine executions with redrive in Step Functions - AWS Step Functions
Configure error handling with Workflow Studio in Step Functions - AWS Step Functions
answered a year ago
Hello,
About the retry logic inside Step Functions, there are several ways to handle failures and resume without starting the whole workflow over:
-
Built-in Retries: You can configure retry logic on your Glue job state. Retries let you specify which errors to retry on, intervals between attempts, max retries, and backoff rates. They are useful for handling transient issues automatically.
-
Error Handling with Catch & Choice: By adding 'Catch' blocks, you can route different failure scenarios to separate paths (e.g., dependency outage vs. business validation failure). Combining this with 'Choice' states lets you decide whether to retry, skip, or take an alternate path.
-
Checkpoint Pattern: If redrive isn’t available (e.g., Express workflows), you can design your workflow with checkpoints (using DynamoDB or Choice states) so that you can resume execution from a specific point.
-
Redrive (Best Option for Standard Workflows): For Standard Step Functions, the redrive feature (available for executions within 14 days) allows you to resume from the exact failed state while preserving successful states. This avoids re-running the entire pipeline and is effectively how you can 'mark' prior states as already successful [2].
-
Manual Intervention: You can implement a callback pattern where the workflow pauses at the failure point, allowing you to make necessary fixes to your Glue job, and then manually trigger the continuation of the workflow from that point.
To "mark" a state as successful and move forward from a failure point, you can:
- Use the redrive feature, which will continue from the failed step
- Implement a Choice state after error handling that can skip previously completed steps
- Design your state machine with checkpoints that store execution progress in an external system (like DynamoDB), allowing you to resume from specific points
In practice, a robust design often combines Retry -> Catch -> Redrive: retries handle transient failures, catches route errors appropriately, and redrive gives you an efficient way to resume after making fixes.
References:
[1] Step Functions Error Handling: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html
[2] Step Functions Redrive: https://docs.aws.amazon.com/step-functions/latest/dg/redrive-executions.html
[3] Error Handling in Step Functions: https://repost.aws/questions/QURCK-cCaNRxmlYKxn6nlQXg/step-function-error-handling
[4] Handling Errors, Retries, and adding Alerting to Step Function State Machine Executions: https://aws.amazon.com/blogs/developer/handling-errors-retries-and-adding-alerting-to-step-function-state-machine-executions/
Relevant content
asked 3 years ago
- AWS OFFICIALUpdated 3 years ago
