exception flytekit.experimental.EagerException[source]#

Raised when a node in an eager workflow encounters an error.

This exception should be used in an @eager workflow function to catch exceptions that are raised by tasks or subworkflows.

from flytekit import task
from flytekit.experimental import eager, EagerException

def add_one(x: int) -> int:
    if x < 0:
        raise ValueError("x must be positive")
    return x + 1

def double(x: int) -> int:
    return x * 2

async def eager_workflow(x: int) -> int:
        out = await add_one(x=x)
    except EagerException:
        # The ValueError error is caught
        # and raised as an EagerException
    return await double(x=out)