fix: ProcessPoolTaskRunner now checks upstream task states in wait_for dependencies
Previously, _resolve_futures_and_submit called wait() on wait_for
futures but discarded their states by passing wait_for=None to the
subprocess. This meant the subprocess task engine never ran
_wait_for_dependencies, so failed upstream tasks were silently ignored
and the downstream task would execute instead of being set to NotReady.
The fix extracts the terminal State from each waited future and passes
those states (which are picklable, unlike futures) to the subprocess.
The task engine's _wait_for_dependencies -> resolve_to_final_result
already handles State objects, correctly raising UpstreamTaskError for
non-completed upstreams, which sets the downstream task to NotReady.
Closes #21117
Co-authored-by: alex.s <alex.s>
Co-Authored-By: unknown <>
fix: revert FlowRunFilterCreatedBy id_/type_ to is not None checks
These are list fields used with .in_(), so empty lists should match
nothing (like any_ fields), not skip the filter and match everything.
Co-authored-by: alex.s <alex.s@prefect.io>
Co-Authored-By: alex.s <ajstreed1@gmail.com>
Kill process group on flow run cancellation to stop child processes
Start flow run subprocesses in their own process group
(start_new_session=True) and use os.killpg instead of os.kill when
cancelling. This ensures child processes spawned by ShellOperation
(or anything else) get terminated along with the flow run process,
instead of being orphaned.
Fixes #20979