is there a way programatically to get a list of deployments in prefect?
i know we can do
Copy code
prefect deployment ls
but i want to get all my created deployments...1000 of them and run them all. so im assuming i have to programatically execute prefect deployment run deploymenet_name for each deployment in my deployments
discourse 1
k
Kevin Kho
04/06/2022, 8:13 PM
The deployments endpoint doesn’t seem to have a “list all”. I’d need to ask someone
Kevin Kho
04/06/2022, 8:19 PM
You would do:
Copy code
async with get_client() as client:
deployments = await client.read_deployments(
flow_filter=FlowFilter(name={"any_": flow_name}) if flow_name else None
)
and they also you will need to paginate through the deployments (pass
limit
and
offset
to
client.read_deployments
) because the default limit is 200 objects
r
Rajan Subramanian
04/06/2022, 8:28 PM
oh it only reads 200?
k
Kevin Kho
04/06/2022, 8:29 PM
Returns 200 at a time so you need to add offset to get the next 200
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.