<@ULVA73B9P> I want to run an automation for all f...
# ask-marvin
a
@Marvin I want to run an automation for all flows except a few to exclude. How can I do this?
m
To run automations for all flows in Prefect 2.x, you'd generally create a Deployment for each flow, specifying details such as infrastructure (e.g.
DockerContainer
,
KubernetesJob
, or
ECSTask
) and scheduling (e.g.,
Interval
,
Cron
, or
RRule
). If you want to exclude certain flows from automation, there's no native feature mentioned in the documents I can access right now that provides an exclude list. However, you could handle this by implementing a custom logic that filters out flows you don't want to include in your automation process. Here's a general approach: 1. List all flows: Use Prefect API/CLI to list all registered flows. 2. Filter flows: Before creating Deployments, programmatically exclude flows you do not wish to automate by filtering them out based on flow name or a custom label. 3. Create Deployments: For the remaining flows, proceed with automation as usual, creating Deployments with the required details. You would need to develop a Python script or an automated workflow that incorporates this logic, which appropriately selects the set of flows to deploy with automations. If you need more specific guidance or a piece of code to accomplish this, I suggest you start by looking at any relevant GitHub issues, or perhaps try searching in the Prefect Discourse for similar community questions. If you want, I can search GitHub issues for you to see if there's anything related to this topic.
n
hmm that's interesting - i think right now the easiest way to do this is to tag the ones you want to include and use that related resource to match but i can see how the inverse would be ideal in your case