View in #prefect-community on Slack
@Matthew_Seligson: What options do we have for decommissioning a flow we no longer use? Can we archive it without deleting it? Can we do any of this via the API?
@Anna_Geller: Are you on Prefect Cloud? if so, on which tier?
You don’t have to delete a flow, but you can simply set schedule to inactive if you no longer need it. When it comes to the flow runs, on the Standard plan the history is kept for 2 weeks so after that the history will be gone but there is no other way to decommission a flow afaik.
You could also create a project called Archive
and reregister such flows to that “archived” project - perhaps that’s one way of marking a flow as decommissioned in the UI?
@Matthew_Seligson: Thanks Anna. We are on enterprise. If we set the schedule to inactive, can’t someone still run it manually? We want to truly decommission it; no one should be able to run it, it should not get scheduled, etc.
@Anna_Geller: I see, in that case I have those ideas:
• a hack: setting a concurrency limit for this flow set to 0 - this will prevent from having any new flow runs of this flow
• set some extra label to this flow to ensure that no agent will pick up flow runs from this flow e,g. a label “decommissioned-flow”
• deleting the flow entirely - a guarantee that nobody will be able to run it
@Matthew_Seligson: Thanks Anna! Can we use the GraphQL api to set the latest version to “archived”?
@Matthew_Seligson: It is not one of the options you mentioned. Are you familiar with the archiveFlow graphql mutation? I believe this will decommission the flow: it will no longer be runnable (manually or scheduled) and it will remain in the UI. Do you agree or am I misunderstanding something?
@Anna_Geller: Ok, I think you’re right on that one, it seems you actually can archive a flow with no active flow versions. Just tried that mutation and it worked as you described:
mutation {
archive_flow(input: {flow_id: "0f94bd12-87d7-4fb6-b3a1-cebb510db8d3"}) {
success
}
}
@Matthew_Seligson: Awesome! Thanks so much Anna