https://prefect.io logo
#prefect-community
Title
# prefect-community
m

Matthew Seligson

02/23/2022, 2:21 PM
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?
a

Anna Geller

02/23/2022, 2:36 PM
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?
m

Matthew Seligson

02/23/2022, 2:40 PM
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.
a

Anna Geller

02/23/2022, 2:47 PM
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
m

Matthew Seligson

02/23/2022, 2:48 PM
Thanks Anna! Can we use the GraphQL api to set the latest version to “archived”?
a

Anna Geller

02/23/2022, 2:54 PM
not sure I understand, it's none of the options I mentioned above 🙂 Archived version is set once you register some new version. Only when you register some new version, the previous one is marked as archived. A flow must have one non-archived version afaik.
m

Matthew Seligson

02/23/2022, 2:57 PM
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?
a

Anna Geller

02/23/2022, 4:26 PM
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:
Copy code
mutation {
  archive_flow(input: {flow_id: "0f94bd12-87d7-4fb6-b3a1-cebb510db8d3"}) {
    success
  }
}
m

Matthew Seligson

02/23/2022, 4:41 PM
Awesome! Thanks so much Anna
👍 1
2 Views