How do I un-register / delete a flow

import sqlite3
from datetime import timedelta, datetime

from prefect import Flow, task
from prefect.schedules import Schedule, filters
from prefect.schedules.clocks import IntervalClock

schedule = Schedule(
    clocks=[IntervalClock(interval=timedelta(seconds=60))],
)

@task()
def print_time():
    print(datetime.utcnow())

with Flow("print_time", schedule=schedule) as flow:
    print_time()

flow.register("print_time")

I ran this as a test, but now I want to remove it. I was expecting a flow.unregister(“print_time”), but the method doesn’t exist.

I looked at the dashboard, but there’s only a pause.

Any way to wipe the flow, other than deleting the entire project?

There are at least two ways to do it.

From the UI (the easiest way):


image

From the GraphQL API:

you could use the delete_flow mutation, but note that this requires passing the UUID to the input.

1 Like