Alix Cook
09/19/2022, 3:09 PMflow_runs = await client.read_flow_runs(
flow_run_filter=FlowRunFilter(
state=FlowRunFilterState(type=FlowRunFilterStateType(any_=state_types)),
)
)
And I get this error:
prefect.exceptions.PrefectHTTPStatusError: Server error '500 Internal Server Error' for url '<https://api.prefect.cloud/api/accounts/c105509e-95a3-458e-ae6c-c944f68863e7/workspaces/1a48caf0-2425-487e-9081-e6a6c36575c0/flow_runs/filter>'
Response: {'exception_message': 'Internal Server Error'}
For more information check: <https://httpstatuses.com/500>
Bianca Hoch
09/19/2022, 3:23 PMAlix Cook
09/19/2022, 3:24 PMMason Menges
09/19/2022, 4:11 PMAlix Cook
09/19/2022, 4:14 PM[StateType.SCHEDULED]
was what state_types
was set to. I haven't seen that call pass this morning (in like the last 2 hours)Mason Menges
09/19/2022, 4:18 PMtest_filter = FlowRunFilter(state=FlowRunFilterState(type=FlowRunFilterStateType(any_=['FAILED', 'CRASHED', 'SCHEDULED'])))
async with get_client() as client:
flow_runs = await client.read_flow_runs(
flow_run_filter=test_filter,
limit=1
)
Alix Cook
09/19/2022, 4:22 PMPENDING
, it fails
test_filter = FlowRunFilter(
state=FlowRunFilterState(type=FlowRunFilterStateType(any_=["PENDING"]))
)
but if i also add something else, it works:test_filter = FlowRunFilter(
state=FlowRunFilterState(
type=FlowRunFilterStateType(any_=["PENDING", "FAILED"])
)
)
Mason Menges
09/19/2022, 6:46 PMAlix Cook
09/19/2022, 7:45 PMimport asyncio
from prefect.client import get_client
from prefect.orion.schemas.filters import (
FlowRunFilter,
FlowRunFilterState,
FlowRunFilterStateType,
)
async def fetch_matching_flow_runs(
state_types,
):
async with get_client() as client:
flow_runs = await client.read_flow_runs(
flow_run_filter=FlowRunFilter(
state=FlowRunFilterState(type=FlowRunFilterStateType(any_=state_types)),
)
)
return flow_runs
asyncio.run(fetch_matching_flow_runs(["PENDING"]))
prefect --version
2.3.1