Question:
Suspending flow runs. I’ve a flow that calls into a task and then suspends itself for human interaction. At the moment I’m using the prefect cloud to resume the flow. The problem is that the flow restarts from the beginning when resuming. How do I handle internal state? Can I persist something to say skip this task?
c
Chris White
05/25/2024, 2:57 AM
Hi J! A few notes:
• flow functions are always executed as a Python function, meaning any code within them will be rerun
• however, tasks within the flow function will not always rerun! Whether a given task call is rerun or not depends on 1.) whether the task run ID has already completed successfully and 2.) whether it persisted its output somewhere (which can be determined via setting a result)
Check out https://docs.prefect.io/latest/concepts/results/?h=persis#persisting-results for more info.
So in summary, things won't run if you encapsulate all logic within persisted tasks, but anything outside of a task will always rerun.
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.