Hi, is there a way to get try / catch behavior in ...
# ask-the-community
v
Hi, is there a way to get try / catch behavior in a Flyte workflow. I have a workflow where one of the tasks can fail to run. If it fails to run, I would like to perform different steps vs when it succeeds. Something like this:
Copy code
@workflow
def wf():
    try:
        output0 = t0()
    except Exception:
        return handle_failure(...)
    
    return handle_success(...)
One way I can think of achieving this behavior is to move the try/catch inside
t0
, and conditioning on the output. Ideally I would like to reflect in the state of the workflow execution that t0 failed. Is there a better way to do this?
k
Not support for now. We are working on eager workflow that allows you to use try and catch. https://github.com/flyteorg/flytekit/pull/1579
v
Thanks for the response. I'll keep an eye on the issue
162 Views