@trahloff I think you need an additional level of filtering with the FlowRunFilterStateType
. So the state filter becomes:
from prefect.client.schemas.filters import FlowRunFilterState, FlowRunFilterStateType
...
state_filter = FlowRunFilterState(
type=FlowRunFilterStateType(
any_=[StateType.COMPLETED, StateType.FAILED, StateType.CRASHED, StateType.CANCELLED]
)
)
Here’s a similar example that uses name
instead of type
: How to bulk delete flow runs in a certain state with the API