#917 Enhancement: Add Support for Custom Error Handling in Workflows
Issue created by
AquaSponsor4
Feature Request
Overview
I'm currently working with the Flyte SDK and I've encountered a situation where I need more control over error handling within my workflows. Currently, the SDK provides default error handling, but there is no straightforward way to implement custom error handling logic for various tasks.
Proposed Enhancement
I would like to suggest that we enhance the Flyte SDK by adding a feature to support custom error handling mechanisms in workflows. This could include:
• Allowing users to define custom error handlers for individual tasks.
• Providing a way to specify different retries and fallback strategies based on the error type.
• Logging error details for better debugging and monitoring.
Benefits
• Greater flexibility in managing different failure scenarios.
• Improved robustness of workflows by allowing custom fallback mechanisms.
• Better debugging experience through detailed logging of errors.
Additional Context
Currently, whenever a task fails, the workflow terminates depending on the default error handling. Custom error handling could enhance user experience significantly, especially in production environments where handling various failure cases gracefully is crucial.
Example
Here is a basic example of how this could be implemented:
@task
def my_task():
# Task logic
pass
def custom_error_handler(error):
# Logic to handle error
pass
@workflow
def my_workflow():
try:
my_task()
except Exception as e:
custom_error_handler(e)
I believe this feature would be a great addition to the Flyte SDK and would appreciate any feedback or guidance on how to proceed with this enhancement.
flyteorg/flyte-sdk