<@ULVA73B9P> what is suspend opton in prefect ui i...
# ask-marvin
v
@Marvin what is suspend opton in prefect ui in prefet 2.X. Will it start from same step again after resuming
m
thought for 365.3 seconds
Short answer: In Prefect 2.x, the UI’s “Suspend” button puts the flow run into the Suspended state, tears down the running infrastructure, and stops execution. When you “Resume,” Prefect starts a new run environment and re-enters your flow from the beginning — it does not pick up at the exact line/step where it was suspended. Details and tips: - Suspend vs Pause: - Suspend (UI button or
suspend_flow_run
) stops the run and releases infrastructure. On resume, your flow code starts from the top in a fresh process. - Pause (
pause_flow_run()
in your code) is for interactive workflows; when resumed, execution continues after the pause point (no full restart). - Avoiding rework after a Suspend: - Without caching/result persistence, tasks will be re-submitted and re-run. - To skip recomputation, enable task caching and persist results: - Set a cache key (e.g.,
cache_key_fn=task_input_hash
) and
cache_expiration
. - Persist results (
persist_result=True
) and configure result storage. Then, on resume, previously-completed tasks with unchanged inputs can be short-circuited using their cached results. - Running tasks at the moment of suspension are stopped; any in-memory results are lost unless persisted. Helpful links: - Interactive workflows (pause/resume concepts): blog post - Core concepts (flows/states): flows concept doc If your goal is to truly continue from “the same step,” consider using
pause_flow_run()
at that point in your flow. If you’re using Suspend for cost control or manual stops, add caching + result persistence to avoid rework after resuming. If you share a small snippet of your flow, I can suggest where to add a pause or how to configure caching/persistence for your tasks.