PrefectHQ
prefect
BlogDocsChangelog

Branches performance

Pull requests

fix: allow pause_flow_run() to pause parent flow when called from task#19457
last run
2 days ago
fix: allow pause_flow_run() to pause parent flow when called from task closes #19435 this pr changes pause_flow_run() to pause the parent flow when called from within a task, instead of raising "cannot pause task runs" error. <details> <summary>context</summary> previously, calling pause_flow_run() from within a task would raise: ``` RuntimeError: Cannot pause task runs. ``` this was overly restrictive since: 1. the function is named pause_flow_run(), not pause_task_run() 2. both FlowRunContext and TaskRunContext are independently active when a task runs inside a flow 3. users reasonably expect to encapsulate approval/pause logic in reusable tasks </details> <details> <summary>changes</summary> **src/prefect/flow_runs.py** - removed the guard that raised RuntimeError when TaskRunContext.get() was truthy - now directly accesses FlowRunContext.get() (which works even inside tasks) to pause the parent flow **tests/test_flow_engine.py** - renamed test_tasks_cannot_be_paused to test_pause_flow_run_from_task_pauses_parent_flow - updated to verify pause works correctly instead of expecting error - added test_pause_flow_run_from_task_with_input to verify pause with wait_for_input works from tasks </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2 days ago
99df9f2
fix/19435-pause-flow-run-from-task
CodSpeed Performance Gauge
0%
fix: defer forward reference resolution in ValidatedFunction closes #19447 When using `from __future__ import annotations`, the `@flow` decorator was failing if a forward-referenced Pydantic model was defined after the function using it. The issue occurred because ValidatedFunction tried to resolve forward references at decoration time by calling `model_rebuild()`, but the referenced types didn't exist in the function's `__globals__` yet. This fix: - Tracks deferred rebuilds with `_needs_rebuild` flag to avoid performance overhead - Only calls `model_rebuild()` once during first validation if needed - Catches NameError/AttributeError during initial model_rebuild attempt - Extended test coverage to ensure no rebuilds happen when not needed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2 days ago
680f8e7
fix/19447-forward-references
CodSpeed Performance Gauge
0%
fix: serialize concurrency acquisition requests when requesting lease-based concurrency Adds ConcurrencySlotAcquisitionWithLeaseService to serialize acquisition attempts for lease-based concurrency limits. This prevents concurrent retry attempts when multiple tasks wait for available slots. The service uses a singleton pattern (one instance per unique set of limit names) with a single-threaded queue to process acquisition requests serially. This matches the pattern used by ConcurrencySlotAcquisitionService for non-lease-based concurrency. Benefits: - Prevents thundering herd when many tasks retry simultaneously - Reduces unnecessary API load - Improves slot acquisition efficiency - Adds limit names to debug logging for easier troubleshooting Related to ENGPAR-11 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2 days ago
58b58a8
fix/concurrency-thundering-herd
CodSpeed Performance Gauge
0%
move result_serializer test to proper location in test_flow_results.py
2 days ago
1861fce
fix-subflow-log-prints-inheritance
CodSpeed Performance Gauge
0%
© 2025 CodSpeed Technology
Home Terms Privacy Docs