#1506 [Core Feature] Failure-Node support
Issue created by
kumare3
Motivation: Why do you think this is important?
Flyte backend supports a Failure-node for every workflow / sub-workflow. This is not currently exposed in flytekit (python or Java)
Goal: What should the final outcome look like, ideally?
Users should be able to define failure nodes for their workflows. An example for the python SDK is as follows
@task
def my_error_handler(...):
...
@workflow(on_error=my_error_handler)
def my_wf():
...
If my_wf() fails at any point during execution, it'll call my_error_handler() task and will pass some context (error info... etc.) to allow it to handle the error. The expectation is that my_error_handler() would do things like clean up resources, log/send customized notifications... etc. The thing it will NOT let you do is recover from failure... The execution of this workflow will still fail, be marked as failure and upstream callers will still be notified of its failure.
An example of sub-workflows:
@workflow(on_error=my_error_handler)
def my_sub_wf():
...
@workflow(failure_policy=WorkflowFailurePolicy.FAIL_AFTER_EXECUTABLE_NODES_COMPLETE)
def my_parent_wf() -> str:
n1 = my_sub_wf()
n2 = my_sub_wf()
n3 = my_sub_wf()
return n3.out1
In this case, my_parent_wf will continue running even if any of the nodes fails. The overall status of the execution will again be marked as failure but it'll let as many nodes as possible to execute... Whenever my_sub_wf fails, it'll invoke an instance of my_error_handler task to cleanup resources... etc.
Describe alternatives you've considered
NA
[Optional] Propose: Link/Inline OR Additional context
More discussion in
#1012
Related flytekit java issue -
#1012
flyteorg/flyte