Fabrice Toussaint

    Fabrice Toussaint

    6 months ago
    Hi all, Is it possible to cancel a flow after it ran for an X amount of time? Let's say I want to cancel flows that take longer than 1 hour? How would I approach this?
    t

    Tomer Cagan

    6 months ago
    Seems there's a timeout argument - from https://docs.prefect.io/api/latest/core/task.html: • timeout (Union[int, timedelta], optional): The amount of time (in seconds) to wait while running this task before a timeout occurs; note that sub-second resolution is not supported, even when passing in a timedelta.
    Fabrice Toussaint

    Fabrice Toussaint

    6 months ago
    Hi @Tomer Cagan thank you for your answer! The link you send is focused on a task and not on a flow. I want to be able to cancel a flow after it has surpassed 1 hour (for example by running another flow who checks active flows and then cancels the ones that are running for over an hour).
    I found a way to do it, I am just retrieving the running flows from GraphQL and handle the rest with Python
    t

    Tomer Cagan

    6 months ago
    Ah, I see now I misread the question!
    Kevin Kho

    Kevin Kho

    6 months ago
    This is a Prefect Cloud feature called automations. It’s not in server but yes you can do something that works with the GraphQL API