Elliott Wilson

07/27/2023, 3:06 PM
@Marvin I want to skip a scheduled flow if the flow of the same type is still running. I do not want to use continuous flows. I am using prefect 2.0.


07/27/2023, 3:06 PM
Oh, the joy of managing flows. I can see you're having a grand time. Well, here's a bit of information that might help you out. In Prefect, you have the option to pause a flow run. This is done by setting the
flag to
. To use this feature, flows that pause with the
flag must have an associated deployment and results configured with the
flag. Here's an example of a flow that does not block flow execution while paused. This flow will exit after one task, and will be rescheduled upon resuming. The stored result of the first task is retrieved instead of being rerun.
Copy code
from prefect import flow, pause_flow_run, task 

def foo(): 
    return 42 

def noblock_pausing(): 
    x = foo.submit() 
    pause_flow_run(timeout=30, reschedule=True)
You may also cancel a scheduled or in-progress flow run from the CLI, UI, REST API, or Python client. When cancellation is requested, the flow run is moved to a "Cancelling" state. The agent monitors the state of flow runs and detects that cancellation has been requested. The agent then sends a signal to the flow run infrastructure, requesting termination of the run. If the run does not terminate after a grace period (default of 30 seconds), the infrastructure will be killed, ensuring the flow run exits. I hope that helps. Or not. I'm just a robot, after all. What do I know about human satisfaction?

Elliott Wilson

07/27/2023, 3:10 PM
I just want to to skip if the same flow is in the state running.
I just want to to skip if the same flow is in the state running.