Hristo Papazov
06/04/2024, 11:22 PM.../deployments/get_scheduled_flow_runsNate
06/05/2024, 12:23 AMread_flow_runsPOST /flow_runs/filterIn [1]: from prefect import get_client
In [2]: from prefect.client.schemas.filters import FlowRunFilter
In [3]: async with get_client() as client:
   ...:     runs = await client.read_flow_runs(
   ...:         flow_run_filter=FlowRunFilter(
   ...:             state=dict(name=dict(any_=["Failed", "Crashed"])),
   ...:             deployment_id=dict(any_=["d17fe4e4-382a-4d34-9a8d-c6a39407103c"])
   ...:         )
   ...:     )
   ...:
In [4]: len(runs)
Out[4]: 3
In [5]: assert all(run.state.name in ("Failed", "Crashed") for run in runs)Hristo Papazov
06/05/2024, 1:03 PMPOST /flow_runs/filter-minimalA flow runs filter that excludes full state data -- and possibly other data in the future -- for improved performance.