Igor Serko
03/02/2026, 4:52 PMMarvin
03/02/2026, 4:52 PMcheck_cli_command
📊 Tools used:
• check_cli_command (3x)
• research_prefect_topic (2x)Igor Serko
03/02/2026, 9:43 PMMarvin
03/02/2026, 9:44 PMMarvin
03/02/2026, 9:44 PMprefect version
If it’s easier, paste the error and the few lines around where it occurs—I can usually spot the issue quickly.Igor Serko
03/02/2026, 10:21 PMMarvin
03/02/2026, 10:21 PMMarvin
03/02/2026, 10:34 PMprefect worker start --pool <your-pool> --limit 50
- Scale out with multiple workers instead of one very “wide” worker.
- Find and clear orphaned PENDING runs (if any)
- In the UI, filter Flow Runs by state=PENDING and take action (reschedule or cancel + re-run).
- Or use a quick script to reset specific runs from PENDING back to SCHEDULED:
import asyncio, datetime
from prefect import states
from prefect.client.orchestration import get_client
async def reschedule(flow_run_id: str):
async with get_client() as client:
await client.set_flow_run_state(
flow_run_id,
state=states.Scheduled(
scheduled_time=datetime.datetime.utcnow(),
message="Rescheduled after worker OOM"
),
)
asyncio.run(reschedule("<FLOW_RUN_ID>"))
- Right-size the worker
- 3GB may be tight under heavy load. Either increase memory for the worker service or reduce per-worker concurrency (--limit) and add additional workers to spread load.
- Poll settings (optional tuning)
- Defaults are generally fine; if needed you can adjust worker poll interval/prefetch:
- PREFECT_WORKER_QUERY_SECONDS (default ~10s)
- PREFECT_WORKER_PREFETCH_SECONDS (default ~10s)
- See Settings & Profiles.
References:
- Workers overview: https://docs.prefect.io/v3/concepts/workers/
- Worker CLI (includes --limit): https://docs.prefect.io/v3/api-ref/cli/worker
- Work pools and concurrency: https://docs.prefect.io/v3/concepts/work-pools/#concurrency-limits
If you’d like, share a screenshot/count of PENDING runs in that pool and your current worker --limit (if any). I can help you pick a safe per-worker limit and give you a small script to bulk reschedule any stuck PENDING runs.Igor Serko
03/02/2026, 10:43 PMMarvin
03/02/2026, 10:43 PMMarvin
03/02/2026, 10:44 PM--limit, queue limits, or cluster policies). If your K8s worker submits fewer runs at a time, it uses far less memory.
What to do (works well on ECS)
- Set a per-worker concurrency cap. This is the single most effective control.
prefect worker start --pool <your-pool> --limit 25
- Then scale out workers horizontally (e.g., 8 workers x 25 = 200 total), instead of one worker trying to drive the entire 400. This makes memory predictable.
- Keep an eye on PENDING runs. If a worker OOMs mid-submission, runs may stick in PENDING and tie up your pool limit. Clear or reschedule any orphans so they don’t “soak” capacity.
- Optional tuning:
- Poll interval/prefetch can be adjusted to smooth spikes:
- PREFECT_WORKER_QUERY_SECONDS (default ~10s)
- PREFECT_WORKER_PREFETCH_SECONDS (default ~10s)
- Prefer several smaller workers (each 512MB–1GB) to a single very large one.
How to confirm this is your case
- Check the worker logs during OOM periods: how many flow runs was it submitting at once?
- In the UI, look at concurrent PENDING + RUNNING in that pool when the worker is healthy.
- If you’re starting the worker without --limit, add it and watch memory flatten.
Docs for reference
- Workers overview (includes --limit): https://docs.prefect.io/v3/concepts/workers/
- Work pools and concurrency: https://docs.prefect.io/v3/concepts/work-pools/#concurrency-limits
- Worker CLI: https://docs.prefect.io/v3/api-ref/cli/worker
If you can share:
- Your current ECS worker start command (including flags),
- Launch type (Fargate vs EC2),
- Approximate concurrent runs shown in the pool when it OOMs,
…I can suggest a concrete --limit and worker count that will keep memory under 512MB–1GB per worker.