Gregory Hunt
07/21/2023, 6:56 PMNate
07/21/2023, 7:04 PMflow_filter
and/or flow_run_filter
In [1]: from prefect import get_client
In [2]: async with get_client() as client:
...: runs = [run for run in await client.read_flow_runs() if run.parameters != {}]
...:
In [3]: runs
Gregory Hunt
07/21/2023, 7:04 PMNate
07/21/2023, 7:05 PMGregory Hunt
07/21/2023, 7:07 PMasync with get_client() as client:
runs = [run for run in await client.read_flow_runs() if run.state.is_pending()]
print(runs)
Nate
08/03/2023, 9:39 PMGregory Hunt
08/03/2023, 9:40 PMNate
08/03/2023, 9:41 PMGregory Hunt
08/03/2023, 9:42 PMawait client.read_flow_runs()
only pulls back 200 flows. DO you have an example of how to pass a filter for pending ?Nate
08/04/2023, 1:04 PMIn [15]: from prefect.client.schemas.filters import FlowRunFilter, FlowRunFilterState, FlowRunFilterStateType
In [16]: async with get_client() as client:
...: runs = await client.read_flow_runs(
...: flow_run_filter=FlowRunFilter(state=FlowRunFilterState(type=FlowRunFilterStateType(any_=["PENDING"])))
...: )
...:
Gregory Hunt
08/04/2023, 1:23 PMGiacomo Chiarella
09/11/2023, 9:43 AMGregory Hunt
09/12/2023, 1:03 PMGiacomo Chiarella
09/12/2023, 1:07 PM