is there a way programatically to get a list of de...
# prefect-community
r
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
The deployments endpoint doesn’t seem to have a “list all”. I’d need to ask someone
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
oh it only reads 200?
k
Returns 200 at a time so you need to add offset to get the next 200
r
ah got it
162 Views