Jordan Jones
12/05/2025, 8:35 PMWorker 'ProcessWorker b853a4fb-074e-4dfc-8c4f-e5a4d16a684f' submitting flow run '0b6f887d-6b7c-4261-99b3-df23c18a0aa5'
Is the best option to cancel and retry the pending run? If so what would be an automation to automatically retry if they are stuck in pending for more than X number of minutes?Marvin
12/05/2025, 8:35 PMMarvin
12/05/2025, 8:42 PMprefect flow-run cancel <FLOW_RUN_ID>
- Start a new run for the same deployment:
prefect deployment run <FLOW_NAME>/<DEPLOYMENT_NAME> --watch
A couple of quick checks to prevent future stuck Pending runs
- Ensure at least one healthy worker is polling the correct work pool/queue and that neither is paused.
- Verify pool/queue concurrency limits are not set to zero and aren’t saturated.
- Review worker logs for infra creation errors around the time the run went Pending.
If you can share:
- Prefect version (Cloud/Server)
- Worker type (you mentioned ProcessWorker) and pool/queue names
- Whether pool/queue concurrency limits or pauses are in use
…I can suggest a more precise trigger filter and action order.Jordan Jones
12/05/2025, 8:46 PMMarvin
12/05/2025, 8:46 PMMarvin
12/05/2025, 8:55 PMMarvin
12/05/2025, 8:55 PMJordan Jones
12/05/2025, 9:48 PMfr_filter = FlowRunFilter(
state=FlowRunFilterState(type=FlowRunFilterStateType(any_=[StateType.PENDING]))
)Marvin
12/05/2025, 9:48 PMMarvin
12/05/2025, 9:48 PMfrom prefect.client.schemas.filters import (
FlowRunFilter,
FlowRunFilterState,
FlowRunFilterStateType,
)
from prefect.client.schemas.objects import StateType
fr_filter = FlowRunFilter(
state=FlowRunFilterState(
type=FlowRunFilterStateType(any_=[StateType.PENDING])
)
)
Equivalent “by name” version (also valid) would be:
from prefect.client.schemas.filters import (
FlowRunFilter,
FlowRunFilterState,
FlowRunFilterStateName,
)
fr_filter = FlowRunFilter(
state=FlowRunFilterState(
name=FlowRunFilterStateName(any_=["Pending"])
)
)
Tip: you can combine this with other filters (e.g., FlowRunFilterDeploymentId, FlowRunFilterTags) to scope which Pending runs you want to reschedule.