Thread
#prefect-community
    Matthew Seligson

    Matthew Seligson

    7 months ago
    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

    Anna Geller

    7 months ago
    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

    Matthew Seligson

    7 months ago
    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

    Anna Geller

    7 months ago
    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

    Matthew Seligson

    7 months ago
    Thanks Anna! Can we use the GraphQL api to set the latest version to “archived”?
    Anna Geller

    Anna Geller

    7 months ago
    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.
    Matthew Seligson

    Matthew Seligson

    7 months ago
    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

    Anna Geller

    7 months ago
    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

    Matthew Seligson

    7 months ago
    Awesome! Thanks so much Anna